架构师必看之六大经典软件架构风格
各位软件架构师及技术从业者:
Dear software architects and technical professionals,
在探讨软件架构风格时,许多人首先关注微服务、面向服务架构(SOA)等现代模式。但在软件开发领域,最基础、应用最广泛的框架仍是经典架构风格,它们是系统设计的基石。
When discussing software architecture styles, many individuals first focus on modern patterns such as microservices and Service-Oriented Architecture (SOA). However, the most fundamental and widely adopted frameworks in software development are the classic architecture styles, which serve as the cornerstone of system design.
这些风格虽具理论属性,但并不复杂,掌握其核心特征及对应应用案例,即可有效应用于实际项目设计中。本文将以清晰、结构化的方式,详细阐述全部6大类经典架构风格,并搭配实战案例,建议收藏本文,方便项目设计时快速查阅。
While these styles are theoretical in nature, they are not complex to comprehend. By mastering their core characteristics and corresponding application examples, practitioners can effectively apply them in practical project design. This article elaborates on all six major classic architecture styles in a clear and structured manner, accompanied by real-world cases. It is recommended to save this article for quick reference during project design.
核心提示:经典架构风格的定位
Key Reminder: Positioning of Classic Architecture Styles
✅ 来源:源自软件工程教材,是行业内公认的权威系统设计基础框架。
✅ Source: Derived from authoritative software engineering textbooks, these styles are widely recognized in the industry as the basic framework for system design.
✅ 应用:适用于各类软件系统的初期设计与框架选型,为后续系统扩展、优化奠定坚实基础。
✅ Application: Suitable for the initial design and framework selection of various software systems, laying a solid foundation for subsequent system expansion and optimization.
✅ 重点:掌握类别+风格+核心特征+应用案例的框架,可根据项目需求快速选型合适的架构风格。
✅ Key Point: Mastering the “category + style + core characteristics + application examples” framework enables the rapid selection of an appropriate architecture style based on project requirements.
✅ 误区:无需过度探究底层原理,重点关注关键词和应用场景,以实际应用为核心。
✅ Misunderstanding: Excessive exploration of underlying principles is unnecessary; focus should be placed on key words and application scenarios, with practical application as the priority.
一、数据流风格:按顺序流转,分步处理数据
I. Data Flow Style: Step-by-Step Data Processing Through Sequential Flow
核心逻辑:数据像水流一样,从一个处理单元顺序流转到另一个处理单元,每个单元负责特定的处理任务,完成后将处理后的数据传递给下一个单元。该风格适用于数据处理类场景,包含2种常用类型。
Core Logic: Data flows sequentially from one processing unit to another, analogous to water flow. Each unit is responsible for a specific processing task and transmits the processed data to the next unit upon completion. This style is suitable for data processing scenarios and includes two commonly used types.
1. 管道-过滤器风格
1. Pipe-Filter Style

核心特征:由多个“过滤器”(数据处理单元)和“管道”(数据传输通道)组成,数据通过管道在过滤器之间传输,每个过滤器独立工作,不依赖其他过滤器的内部逻辑。
Core Characteristics: Composed of multiple “filters” (data processing units) and “pipes” (data transmission channels). Data is transmitted between filters via pipes, and each filter operates independently without relying on the internal logic of other filters.
应用示例(必掌握):
Application Examples (Essential for mastery):
-
编译器:编译过程依次为源代码→词法分析→语法分析→语义分析→目标代码,每一步都是一个过滤器,数据(代码)通过管道顺序传输。
-
Compiler: The compilation process sequentially includes source code → lexical analysis → syntax analysis → semantic analysis → object code. Each step functions as a filter, and data (code) is transmitted sequentially through pipes.
-
数据ETL工具:例如数据库中的原始数据,经过抽取(过滤器1)→清洗(过滤器2)→转换(过滤器3)→加载(过滤器4),最终存入数据仓库,全程由管道负责数据传输。
-
Data ETL Tools: For instance, raw data in a database undergoes extraction (Filter 1) → cleaning (Filter 2) → transformation (Filter 3) → loading (Filter 4), and is ultimately stored in a data warehouse. Pipes are responsible for data transmission throughout this process.
-
Linux管道命令:例如命令
ls -l | grep .txt | wc -l,每个命令都是一个过滤器,管道(|)负责数据传输,最终实现“统计.txt文件数量”的功能。 -
Linux Pipe Commands: For example, the command
ls -l | grep .txt | wc -l, where each command acts as a filter, and the pipe (|) facilitates data transmission, ultimately achieving the function of “counting the number of .txt files”.
核心要点:出现“数据流、独立处理、高可复用”等关键特征,可直接判定为管道-过滤器风格。
Key Notes: The Pipe-Filter style can be directly identified by the presence of key features such as “data flow, independent processing, and high reusability”.
2. 批处理序列风格
2. Batch Processing Sequence Style

核心特征:与管道-过滤器风格类似,但核心强调“批量处理”,先收集全部数据,一次性批量处理后,再传递到下一个处理环节,过程中无交互,属于“离线处理”模式。
Core Characteristics: Similar to the Pipe-Filter style, but with an emphasis on “batch processing”. All data is collected first, processed as a single batch, and then transferred to the next processing step. No interaction occurs during the process, making it an “offline processing” mode.
应用示例(日常常见,高频场景):
Application Examples (Common daily and high-frequency scenarios):
-
银行批量发薪:每月固定时间,银行批量收集所有员工的薪资数据(姓名、工号、金额),一次性完成计算、扣款、转账操作,全程无人工交互。
-
Bank Batch Salary Payment: At a fixed time each month, banks collect salary data (name, employee ID, amount) for all employees in batches, and complete calculation, deduction, and transfer in one operation, with no manual interaction throughout the process.
-
批量日志分析:服务器每天产生大量日志,在非高峰时段(通常为夜间),系统自动批量收集、解析、统计全天日志,生成日报,无需实时处理。
-
Batch Log Analysis: Servers generate a large volume of logs daily. During off-peak hours (typically at night), the system automatically collects, parses, and counts the full day’s logs to generate a daily report, without real-time processing.
-
数据备份:每天凌晨,将数据库中的所有数据批量备份到磁盘,备份完成后执行校验操作,是批处理的典型应用。
-
Data Backup: Every early morning, all data in the database is backed up to disk in batches. A verification operation is performed after the backup is completed, which is a typical application of batch processing.
核心要点:关键词为“批量、离线、无交互、一次性处理”,区别于管道-过滤器风格的“实时流转”特征。
Key Notes: Key identifiers include “batch, offline, no interaction, and one-time processing”, which distinguish it from the “real-time flow” characteristic of the Pipe-Filter style.
二、调用/返回风格:“调用与执行”——最贴近日常开发的架构逻辑
II. Call/Return Style: “Invocation and Execution” — The Most Widely Used Architecture Logic

核心逻辑:通过“调用”与“返回”机制实现模块交互,调用关系清晰(如模块A调用模块B,模块B执行后返回结果),是最贴近日常开发的架构风格,包含3种常用类型。
Core Logic: Module interaction is realized through “call” and “return” mechanisms, with clear invocation relationships (e.g., Module A invokes Module B, and Module B returns the result after execution). This is the architecture style most closely aligned with daily development, including three commonly used types.
1. 分层架构风格
1. Layered Architecture Style
核心特征:根据功能需求,将系统划分为多个水平层级,每层仅依赖其直接下层提供的服务,不依赖上层,也不允许跨层依赖,实现“高内聚、低耦合”。
Core Characteristics: The system is divided into multiple horizontal layers based on functional requirements. Each layer only depends on the services provided by the layer directly below it, without relying on upper layers or allowing cross-layer dependencies, thereby achieving “high cohesion and low coupling”.
应用示例(高频使用,必掌握):
Application Examples (Frequently used, essential for mastery):
-
经典分层Web系统(最常用):由表示层(页面、前端)→业务逻辑层(接口、业务处理)→数据访问层(DAO、数据库操作)→数据层(数据库)组成,每层各司其职,例如业务逻辑层仅调用数据访问层,不直接操作数据库。
-
Classic Layered Web System (Most commonly used): Consists of the Presentation Layer (pages, front-end) → Business Logic Layer (interfaces, business processing) → Data Access Layer (DAO, database operations) → Data Layer (database). Each layer performs its dedicated functions; for example, the Business Logic Layer only invokes the Data Access Layer and does not directly operate the database.
-
操作系统分层:从下到上依次为硬件层→内核层→驱动层→应用层,每层提供固定服务,上层调用下层,互不干扰。
-
Operating System Layering: From bottom to top, it includes the Hardware Layer → Kernel Layer → Driver Layer → Application Layer. Each layer provides fixed services, and the upper layer invokes the lower layer without mutual interference.
-
APP分层:由UI层(页面展示)→逻辑层(业务处理)→数据层(本地存储/接口调用)组成,例如点击按钮后,UI层调用逻辑层,逻辑层处理后返回结果,更新UI。
-
APP Layering: Comprises the UI Layer (page display) → Logic Layer (business processing) → Data Layer (local storage/interface calls). For example, when a button is clicked, the UI Layer invokes the Logic Layer, which returns the processed result to update the UI.
核心要点:遇到“分层结构、高内聚低耦合、易维护、逐层调用”等关键特征,可直接选择分层架构风格。
Key Notes: The Layered Architecture style can be directly selected when encountering key features such as “layered structure, high cohesion and low coupling, easy maintenance, and layer-by-layer invocation”.
2. 主程序-子程序风格
2. Main Program-Subprogram Style
核心特征:存在一个“主程序”(入口点),根据预设逻辑调用多个“子程序”(子模块),子程序执行后返回结果,由主程序统一调度,是结构化编程的核心架构。
Core Characteristics: There is a single “main program” (entry point) that invokes multiple “subprograms” (submodules) according to predefined logic. Subprograms return results after execution, and the main program performs unified scheduling. This is the core architecture of structured programming.
应用示例:
Application Examples:
-
简易计算程序:例如“学生成绩统计程序”,主程序负责接收输入,调用“成绩录入子程序”“成绩计算子程序”“成绩打印子程序”,所有子程序由主程序统一调度。
-
Simple Calculation Program: For example, a “student score statistics program”. The main program is responsible for receiving input and invoking the “score entry subprogram”, “score calculation subprogram”, and “score printing subprogram”, with all subprograms scheduled uniformly by the main program.
-
脚本程序:例如Python脚本,主函数(主程序)调用多个子函数(子程序)顺序执行,完成文件处理、数据统计等具体任务。
-
Script Programs: For example, Python scripts, where the main function (main program) invokes multiple subfunctions (subprograms) to execute sequentially, completing specific tasks such as file processing and data statistics.
-
早期单机软件:例如传统计算器软件,主程序负责界面交互,调用“加法子程序”“减法子程序”等,实现计算功能。
-
Early Standalone Software: For example, traditional calculator software. The main program is responsible for interface interaction and invokes subprograms such as “addition subprogram” and “subtraction subprogram” to implement calculation functions.
核心要点:关键词为“单一入口、主程序调度、子程序执行”,区别于分层架构风格的“层级依赖”特征。
Key Notes: Key identifiers include “single entry point, main program scheduling, and subprogram execution”, which distinguish it from the “layer dependency” characteristic of the Layered Architecture style.
3. 面向对象风格
3. Object-Oriented Style
核心特征:将系统抽象为多个“对象”,每个对象封装数据(属性)和行为(方法),对象之间通过“消息传递”进行交互,核心是“封装、继承、多态”三大原则。
Core Characteristics: The system is abstracted into multiple “objects”, each encapsulating data (attributes) and behaviors (methods). Objects interact through “message passing”, with the core principles of “encapsulation, inheritance, and polymorphism”.
应用示例(适用于所有面向对象开发场景):
Application Examples (Applicable to all object-oriented development scenarios):
-
JavaWeb开发:例如电商系统中的“用户对象”“商品对象”“订单对象”,每个对象都有自身的属性(如用户ID、商品名称)和方法(如用户登录、商品下单),对象之间通过调用方法实现交互。
-
JavaWeb Development: For example, in an e-commerce system, “User Object”, “Product Object”, and “Order Object” each have their own attributes (e.g., user ID, product name) and methods (e.g., user login, product order placement). Objects interact by invoking each other’s methods.
-
移动APP开发:例如微信中的“联系人对象”,封装了联系人姓名、手机号等属性,以及“发送消息”“查看详情”等方法,多个联系人对象通过消息传递实现交互。
-
Mobile APP Development: For example, the “Contact Object” in WeChat encapsulates attributes such as contact name and phone number, as well as methods such as “send message” and “view details”. Multiple contact objects interact through message passing.
-
游戏开发:例如游戏中的“玩家对象”“怪物对象”,每个对象都有生命值、攻击力等属性,以及“攻击”“移动”等方法,对象通过消息传递触发行为。
-
Game Development: For example, “Player Object” and “Monster Object” in games each have attributes such as health and attack power, as well as methods such as “attack” and “move”. Objects trigger behaviors through message transmission.
核心要点:出现“对象、封装、继承、多态、消息传递”等关键特征,可直接对应面向对象风格。
Key Notes: The Object-Oriented style can be directly identified by the presence of key features such as “object, encapsulation, inheritance, polymorphism, and message passing”.
三、独立构件风格:“分散运行,互不干扰”——松耦合的天花板
III. Independent Component Style: “Decentralized Operation, No Mutual Interference” — The Pinnacle of Loose Coupling

核心逻辑:系统由多个独立的“构件”(模块)组成,构件之间不直接依赖,通过特定机制(通信、事件)实现交互,耦合度极低,适用于需要动态扩展、异构集成的场景,包含3种常用类型。
Core Logic: The system is composed of multiple independent “components” (modules). Components do not directly depend on each other and interact through specific mechanisms (communication, events), resulting in extremely low coupling. This style is suitable for scenarios requiring dynamic expansion and heterogeneous integration, including three commonly used types.
1. 进程通信风格
1. Process Communication Style
核心特征:多个独立的进程(构件)并行运行,进程之间通过进程间通信(IPC)机制(如消息队列、管道、共享内存)实现交互,每个进程有自己独立的内存空间,互不干扰。
Core Characteristics: Multiple independent processes (components) run in parallel. Processes interact through Inter-Process Communication (IPC) mechanisms such as message queues, pipes, and shared memory. Each process has its own independent memory space, ensuring no mutual interference.
应用示例:
Application Examples:
-
操作系统中的进程交互:例如电脑同时运行“浏览器进程”“微信进程”“音乐进程”,进程之间通过系统提供的IPC机制通信(如微信向浏览器发送文件,即为进程间通信)。
-
Process Interaction in Operating Systems: For example, a computer may simultaneously run a “browser process”, “WeChat process”, and “music process”. Processes communicate through the IPC mechanism provided by the system (e.g., WeChat sending files to the browser constitutes inter-process communication).
-
分布式系统中的进程通信:例如电商系统的“订单进程”和“支付进程”,两个进程独立运行,通过消息队列传输订单信息和支付结果。
-
Process Communication in Distributed Systems: For example, the “Order Process” and “Payment Process” of an e-commerce system run independently, transmitting order information and payment results through message queues.
-
嵌入式系统:例如智能手表中的“心率监测进程”和“时间显示进程”,独立运行,通过进程间通信同步数据(如将心率数据同步到屏幕显示)。
-
Embedded Systems: For example, the “heart rate monitoring process” and “time display process” in a smart watch run independently, synchronizing data through inter-process communication (e.g., synchronizing heart rate data to the screen display).
核心要点:关键词为“独立进程、进程间通信、并行运行”。
Key Notes: Key identifiers include “independent processes, inter-process communication, and parallel operation”.
2. 事件驱动风格(隐式调用)
2. Event-Driven Style (Implicit Invocation)
核心特征:构件之间不直接调用,通过“事件”触发实现交互——一个构件触发事件,所有订阅该事件的构件自动执行(隐式调用),彼此不知道对方的存在。
Core Characteristics: Components do not directly invoke each other but interact through “event” triggering. When one component triggers an event, all components subscribed to that event execute automatically (implicit invocation) without being aware of each other’s existence.
应用示例(高频应用,重点掌握):
Application Examples (High-frequency applications, focus on mastery):
-
GUI界面开发:例如微信中点击“发送”按钮(触发事件),自动执行“消息验证”“消息发送”“消息刷新”三个构件,这三个构件不直接调用,仅由事件触发。
-
GUI Interface Development: For example, clicking the “Send” button in WeChat triggers an event, which automatically executes three components: “message verification”, “message sending”, and “message refresh”. These components do not directly invoke each other and are triggered solely by the event.
-
日志系统:系统中“用户登录”“下单”等操作触发事件,日志构件订阅这些事件,自动记录操作日志,无需其他构件主动调用日志功能。
-
Log System: Operations such as “user login” and “order placement” in the system trigger events. The log component subscribes to these events and automatically records operation logs, eliminating the need for other components to actively invoke the log function.
-
物联网设备联动:例如智能家居中,触发“开门”事件后,订阅该事件的“灯光构件”“空调构件”自动启动,实现联动控制。
-
IoT Device Linkage: For example, in smart homes, triggering a “door opening” event automatically activates the “light component” and “air conditioning component” subscribed to the event, achieving linked control.
核心要点:关键词为“事件、订阅、隐式调用、解耦”,是独立构件风格中最常用的类型。
Key Notes: Key identifiers include “event, subscription, implicit invocation, and decoupling”, making it the most commonly used type in the Independent Component style.
3. C2架构风格
3. C2 Architecture Style
核心特征:由“构件”和“连接件”组成,每个构件和连接件都有“顶部”和“底部”接口,禁止构件之间直接连接,所有通信必须通过连接件中转,连接件按“底部→顶部”的规则连接。
Core Characteristics: Composed of “components” and “connectors”. Each component and connector has a “top” and “bottom” interface. Direct connection between components is prohibited; all communication must be relayed through connectors, which are connected according to the “bottom → top” rule.
应用示例(掌握2个场景,应对实际应用):
Application Examples (Master two scenarios for practical application):
-
插件化编辑器:例如VS Code,核心编辑器为一个构件,各类插件(代码高亮、自动补全)为独立构件,插件与核心编辑器通过连接件通信,不能直接调用,便于插件的动态增删。
-
Plug-in Editor: For example, VS Code. The core editor serves as a component, and various plug-ins (code highlighting, auto-completion) are independent components. Plug-ins and the core editor communicate through connectors and cannot be directly invoked, facilitating dynamic addition and deletion of plug-ins.
-
GUI框架:例如Java Swing,界面构件(按钮、文本框)为构件,构件之间的交互通过连接件(事件分发器)中转,符合C2风格的连接规则。
-
GUI Framework: For example, Java Swing. Interface components (buttons, text boxes) are components, and interaction between components is relayed through connectors (event dispatchers), which conforms to the connection rules of the C2 style.
核心要点:出现“构件+连接件、上下连接、无直接连接、异步消息”等关键特征,直接选择C2风格。
Key Notes: The C2 style can be directly selected when encountering key features such as “components + connectors, top-bottom connection, no direct connection, and asynchronous messages”.
四、虚拟机风格:“模拟环境,适配特殊需求”
IV. Virtual Machine Style: “Simulated Environment for Special Requirement Adaptation”

核心逻辑:构建一个“虚拟机”(模拟环境),屏蔽底层硬件或规则的差异,使程序无需适配具体环境,即可在虚拟机中运行,包含2种常用类型。
Core Logic: A “virtual machine” (simulated environment) is constructed to shield differences in underlying hardware or rules, enabling programs to run in the virtual machine without adapting to specific environments. This style includes two commonly used types.
1. 解释器风格
1. Interpreter Style
核心特征:存在一个“解释器”,程序(源代码/脚本)不直接编译执行,而是由解释器逐行解释执行,实现对不同运行环境的适配。
Core Characteristics: An “interpreter” is employed. Programs (source code/scripts) are not directly compiled and executed but are interpreted and executed line by line by the interpreter, enabling adaptation to different operating environments.
应用示例:
Application Examples:
-
脚本语言解释器:例如Python、JavaScript解释器,编写的Python脚本无需编译,由解释器逐行执行,可在Windows、Linux等不同系统上运行。
-
Script Language Interpreters: For example, Python and JavaScript interpreters. Written Python scripts do not require compilation; the interpreter executes them line by line, allowing them to run on different systems such as Windows and Linux.
-
规则引擎:例如业务系统中的“风控规则引擎”,管理员配置的风控规则(如“单笔交易超过1万需验证”)由解释器解释执行,无需修改代码即可调整规则。
-
Rule Engine: For example, the “risk control rule engine” in business systems. Risk control rules configured by administrators (e.g., “verification is required for a single transaction exceeding 10,000”) are interpreted and executed by the interpreter, enabling rule adjustments without modifying the code.
-
SQL解释器:数据库中的SQL语句由SQL解释器解释执行,无需适配数据库的具体底层实现。
-
SQL Interpreter: SQL statements in the database are interpreted and executed by the SQL interpreter, eliminating the need to adapt to the specific underlying implementation of the database.
核心要点:关键词为“解释器、逐行执行、脚本、规则”。
Key Notes: Key identifiers include “interpreter, line-by-line execution, script, and rules”.
2. 规则驱动系统风格
2. Rule-Driven System Style
核心特征:以“规则库”为核心,系统根据输入数据,匹配规则库中的规则,并执行对应的动作,适用于业务规则需要频繁调整的场景。
Core Characteristics: Centered on a “rule base”, the system matches input data against rules in the rule base and executes corresponding actions. This style is suitable for scenarios requiring frequent adjustments to business rules.
应用示例:
Application Examples:
-
电商优惠券系统:规则库中存储“满100减20”“新用户减10”等规则,用户下单时,系统匹配对应规则,自动计算优惠金额。
-
E-commerce Coupon System: The rule base stores rules such as “20 off for every 100 spent” and “10 off for new users”. When a user places an order, the system matches the corresponding rules and automatically calculates the discount amount.
-
风控系统:规则库中存储“异地登录需验证”“连续3次密码错误锁定账户”等规则,系统实时匹配用户行为,执行风控动作。
-
Risk Control System: The rule base stores rules such as “verification is required for login from different locations” and “account is locked after 3 consecutive wrong passwords”. The system matches user behaviors in real time and executes risk control actions accordingly.
-
智能客服系统:规则库中存储“用户询问‘退款’时,触发退款流程”“用户询问‘物流’时,查询物流信息”等规则,自动响应用户咨询。
-
Intelligent Customer Service System: The rule base stores rules such as “trigger the refund process when a user inquires about ‘refund'” and “query logistics information when a user inquires about ‘logistics'”, enabling automatic responses to user inquiries.
核心要点:关键词为“规则库、规则匹配、动态调整”,区别于解释器风格的“逐行执行”特征。
Key Notes: Key identifiers include “rule base, rule matching, and dynamic adjustment”, which distinguish it from the “line-by-line execution” characteristic of the Interpreter style.
五、仓库风格:“一个中心,全员共享”
V. Repository Style: “Centralized Repository, Shared by All”

核心逻辑:存在一个“中央仓库”(共享数据中心),多个构件围绕仓库工作,构件之间不直接交互,通过仓库共享数据、协同工作,包含3种常用类型。
Core Logic: A “central repository” (shared data center) is established, around which multiple components operate. Components do not directly interact with each other but share data and collaborate through the repository. This style includes three commonly used types.
1. 数据库仓库风格
1. Database Repository Style
核心特征:以“数据库”为中央仓库,所有构件(模块)通过数据库共享数据,构件仅与数据库交互,彼此不依赖。
Core Characteristics: A “database” serves as the central repository, and all components (modules) share data through the database. Components only interact with the database and do not depend on each other.
应用示例(最常见,必掌握):
Application Examples (Most common, essential for mastery):
-
管理系统:例如学生管理系统,“学生信息录入”“成绩查询”“考勤统计”三个构件,均通过中央数据库共享数据,录入信息的构件无需通知查询构件,查询构件直接从数据库获取数据。
-
Management System: For example, a student management system. The three components of “student information entry”, “score query”, and “attendance statistics” all share data through the central database. The component responsible for student information entry does not need to notify the query component; the query component directly retrieves data from the database.
-
企业ERP系统:采购、销售、库存三个模块,共享中央数据库,采购模块录入的采购数据,由销售、库存模块直接从数据库获取,实现数据同步。
-
Enterprise ERP System: The three modules of procurement, sales, and inventory share a central database. Procurement data entered by the procurement module is directly retrieved by the sales and inventory modules from the database, achieving data synchronization.
核心要点:关键词为“中央数据库、数据共享、构件不直接交互”。
Key Notes: Key identifiers include “central database, data sharing, and no direct component interaction”.
2. 黑板系统风格
2. Blackboard System Style
核心特征:存在一个“共享黑板”(数据共享区),多个“知识源”(构件)围绕黑板工作,知识源将自身的计算结果写入黑板,其他知识源从黑板获取数据,共同完成复杂任务。
Core Characteristics: A “shared blackboard” (data sharing area) is established, around which multiple “knowledge sources” (components) operate. Knowledge sources write their calculation results into the blackboard, and other knowledge sources retrieve data from the blackboard to jointly complete complex tasks.
应用示例(实际应用中常见,重点掌握场景):
Application Examples (Common in practical applications, focus on scenario mastery):
-
语音识别系统:黑板存储语音信号、特征提取结果、文本转换结果,多个知识源(信号采集、特征提取、文本匹配)独立工作,将结果写入黑板,最终完成语音转文字。
-
Speech Recognition System: The blackboard stores speech signals, feature extraction results, and text conversion results. Multiple knowledge sources (signal collection, feature extraction, text matching) operate independently and write results into the blackboard, ultimately completing speech-to-text conversion.
-
信号处理系统:例如雷达信号处理,黑板存储雷达信号和信号分析结果,多个知识源协同处理,最终识别目标。
-
Signal Processing System: For example, radar signal processing. The blackboard stores radar signals and signal analysis results, and multiple knowledge sources collaborate to process the data and ultimately identify targets.
-
AI推理系统:黑板存储推理前提、中间结论、最终结论,多个推理模块(知识源)在黑板上读写数据,完成复杂推理任务。
-
AI Inference System: The blackboard stores inference premises, intermediate conclusions, and final conclusions. Multiple inference modules (knowledge sources) read from and write to the blackboard to complete complex inference tasks.
核心要点:关键词为“共享黑板、知识源、协同解决问题”,是仓库风格中最常用的类型。
Key Notes: Key identifiers include “shared blackboard, knowledge sources, and collaborative problem-solving”, making it the most commonly used type in the Repository style.
3. 超文本风格
3. Hypertext Style
核心特征:以“超文本”(链接文档)为核心,文档通过“超链接”连接,形成网络结构,用户可通过链接非线性访问文档。
Core Characteristics: Centered on “hypertext” (linked documents), documents are connected through “hyperlinks” to form a network structure. Users can access documents in a non-linear manner through these links.
应用示例:
Application Examples:
-
网页:例如百度百科,每个词条都是一个超文本,词条之间通过超链接连接,点击链接可跳转至相关词条,实现非线性阅读。
-
Web Pages: For example, Baidu Encyclopedia. Each entry is a hypertext, and entries are connected through hyperlinks. Clicking a link allows users to jump to related entries, enabling non-linear reading.
-
电子书:带有目录链接的电子书,点击目录链接可直接跳转至对应章节,文档之间通过链接关联。
-
E-books: E-books with directory links. Clicking a directory link directly jumps to the corresponding chapter, with documents associated through links.
-
帮助文档:软件的帮助文档,每个功能的描述都是一个超文本,通过链接跳转相关章节,方便用户快速查找内容。
-
Help Documents: Software help documents, where the description of each function is a hypertext. Links allow users to jump between related sections, facilitating quick access to relevant content.
核心要点:关键词为“超文本、超链接、网络结构、非线性访问”。
Key Notes: Key identifiers include “hypertext, hyperlinks, network structure, and non-linear access”.
六、控制风格:“自动调整,维持稳定”
VI. Control Style: “Automatic Adjustment for Stability Maintenance”
核心逻辑:通过“反馈回路”,收集系统的输出结果,与目标状态对比,自动调整输入,使系统维持在稳定的目标状态,仅包含1种常用类型。
Core Logic: Through a “feedback loop”, the system collects its output results, compares them with the target state, and automatically adjusts inputs to maintain the system in a stable target state. This style includes only one commonly used type.
闭环控制风格(反馈控制风格)
Closed-Loop Control Style (Feedback Control Style)

核心特征:由控制器、执行器、被控对象、传感器、反馈回路组成,传感器收集被控对象的当前状态,反馈给控制器,控制器将当前状态与目标状态对比,调整执行器的动作,形成闭环,实现自动调整。
Core Characteristics: Composed of a controller, actuator, controlled object, sensor, and feedback loop. The sensor collects the current state of the controlled object and feeds it back to the controller. The controller compares the current state with the target state and adjusts the actuator’s actions to form a closed loop, realizing automatic adjustment.
应用示例(日常场景,易掌握):
Application Examples (Daily life scenarios, easy to master):
-
空调恒温控制(最常用):设定目标温度(如26℃),传感器收集室内当前温度,反馈给控制器,若当前温度高于26℃,控制器指令空调制冷;若低于26℃,指令制热,维持温度恒定。
-
Air Conditioning Constant Temperature Control (Most commonly used): Set a target temperature (e.g., 26℃). The sensor collects the current indoor temperature and feeds it back to the controller. If the current temperature is higher than 26℃, the controller instructs the air conditioner to cool; if lower than 26℃, it instructs heating, maintaining a constant temperature.
-
自动驾驶:传感器收集车辆速度、距离、路况等信息,反馈给控制器,控制器调整油门、刹车,维持车辆安全、匀速行驶,实现自动巡航。
-
Autonomous Driving: Sensors collect the vehicle’s speed, distance, and road conditions and feed them back to the controller. The controller adjusts the accelerator and brake to maintain safe, constant-speed operation, realizing automatic cruise.
-
工业自动化:例如工厂生产线的温度控制,传感器收集生产线温度,反馈给控制器,控制器调整加热设备的功率,维持温度稳定。
-
Industrial Automation: For example, temperature control of a factory production line. The sensor collects the production line’s temperature and feeds it back to the controller, which adjusts the heating equipment’s power to maintain stable temperature.
核心要点:出现“反馈、自动调整、稳定、恒温、自动控制”等关键特征,直接对应闭环控制风格。
Key Notes: The Closed-Loop Control style can be directly identified by the presence of key features such as “feedback, automatic adjustment, stability, constant temperature, and automatic control”.
最后:简易速记口诀(必掌握)
Finally: Simple Memory Rhyme (Essential for Mastery)
数据流:管道批处理,数据来流转
调用类:分层面向对象,主程序来调用
独立构件:进程与事件,C2不直接连
虚拟机:解释加规则,适配各不同
仓库类:数据加黑板,超链接来连
控制类:闭环做反馈,自动保稳定
Data Flow: Pipes and batches, data flows
Call Type: Layered and object-oriented, main program calls
Independent Components: Processes and events, C2 no direct connection
Virtual Machine: Interpret rules, adapt to different
Repository: Data and blackboard, hyperlinks connect
Control Type: Closed-loop feedback, automatic stability
结语
Conclusion
以上内容详细阐述了所有经典软件架构风格的核心特征与应用示例,均符合行业标准,可直接应用于项目设计中。
The above content details the core characteristics and application examples of all classic software architecture styles, all of which comply with industry standards and can be directly applied in project design.
收藏本文,项目设计前花10分钟复习,即可快速选型最适合的架构风格。
Saving this article and reviewing it for 10 minutes prior to project design will facilitate the selection of the most appropriate architecture style.
夜雨聆风