The definition of software architecture decision-making lists the decisions that need to be made in a series of architectural design phases, including "Determining architectural style", so what is the architectural style? What are the common architectural styles?
definition
Architectural styles Define a set of types of elements that can be used (such as modules, components, connectors, etc.) and define how these types of constraints are used, such as the real-time topology of the system, the dependencies between modules, and the visibility of components.
In fact, the architectural style is similar to the design pattern, which defines the relationship between components and components, but the level of abstraction is different, so their role is similar.
function
- Consistency and comprehension: The result of following the same style is that a good idea is implemented thoroughly, not a bunch of random, different good ideas.
- Communication
- Design Reuse
- Ensure quality properties
List of common architectural styles
A list of common architectural styles is given in the book "Appropriate software Architecture".
- Layered style: Layered architecture is the most common architecture, such as the common external interface layer, the business logic layer, the data access layer of the three-tier architecture, it should be noted that the hierarchical architecture is the style of the logical Schema View. The elements of a layered architecture are layers, relationships are use relationships, and constraints are the only layer where a layer uses its next level, with the benefits of being modifiable, reusable, and portable.
- Pipeline-Filter Style: In this style, the data flows from the pipe to the filter, and the filter processes the data, which is the style of running the Schema View. Pipeline-filter architecture style elements include pipelines, filters, read ports and write ports, the filter reads the data from the read port, processes it, and then writes to the write port, and the pipe connects the write port to the read port, which is equivalent to connecting two filters together. There are two constraints: (1) The filter is independent and there is no interaction between the filters. (2) filter increment reading, processing and writing. A typical example is a Linux operating system pipeline + various executable commands. The benefits are reusability (filters can be reused), modifiable and re-configured (pipelines can be used to connect multiple filters to form flexible functions).
- Model-centric style: all components interact with only one central model (also called a data store or Data Warehouse), also called a warehouse style, shared data style, or data-centric style, which is the style of running the Schema View. Elements include a model, one or more views, and a controller. Benefits include: (1) modifiable, which comes from decoupling between information producers and consumers, and (2) extensibility: After the model is fixed, it is easy to add views and controllers. A typical example is a modern, integrated development environment, where the central model represents the state of the program being edited, including the source code and the parsed representation, which is presented to many views and controllers, and the view and controller components are independent of each other, but all depend on the central model component.
- Distribution-Subscription style: Also known as event-based style, the components that distribute events and subscribe to events are independent and run the Schema View style. Elements include a sub-port, a subscriber, and an event bus. By decoupling the producers and consumers of events, it is possible to achieve better maintainability and scalability, which is not likely to cause performance damage because an additional event bus is introduced to do the interaction layer.
- Client-server style: Run the Schema View style, which is also a very common architectural style. Elements include client components and server components, and typically there is a request-response connector and some ports. The constraint is that the client can initiate the communication proactively, and the server side cannot. The benefit is a maintainability boost, as the main business process implementations are on the server side. A variant of the client-server style is the N-tier style (N-tier), which splits the business logic processing and data processing of the server components into "Application layer" and "layer", which is a common style of the current.
- Peer style: Also called point-to-point style (peer-to-peer), communication peers between nodes, there can be no hierarchical relationship, each node has the ability to do both the client and server side, run the Schema View style. A typical example is the BitTorrent network, with the benefits of usability and resiliency.
- Map-reduce style: Elements include master Worker, MAP worker, Reduce worker, Local FileSystem, Gobal FileSystem. Large datasets are split into small datasets splits, then stored in a Glbal FileSystem, each map Workder read one or more split Kingsning Palace processing, and the intermediate results are written to local filesystem,reduce Workder reads intermediate results from multiple local FileSystem and merges them, then writes Gobal FileSystem. The Master worker is responsible for instantiating other worder, assigning split to map Worder, and monitoring and handling workers health. Constraints: Each map Worder independent of each other, reduce Worder independent. Benefits: Scalability, usability improvements.
Common architectural styles