Home > Common Problem > What are some common software architectures?

What are some common software architectures?

青灯夜游
Release: 2020-08-29 11:31:40
Original
18906 people have browsed it

Common software architecture patterns: layered architecture pattern, client-server pattern, master-slave pattern, pipeline-filter pattern, proxy pattern, point-to-point pattern, event bus pattern, model-view-controller ( MVC) mode, blackboard mode, interpreter mode, etc.

What are some common software architectures?

10 common software architecture patterns

#Want to know what large enterprise-level systems are? How was it designed? Before the main body of software is developed, we must choose a suitable architecture to provide the required functionality and quality characteristics. So we should understand the different architectures before applying them to the design.


What is architectural pattern

Wikipedia:Architectural pattern is A common, reusable solution to a commonly occurring problem within a given context of software architecture. Architectural patterns are similar to software design patterns, but broader in scope.

In this article, I will briefly explain the applications, advantages and disadvantages of the following 10 common architectural patterns.

1. Layered mode
2. Client-server mode
3. Master-slave mode
4. Pipe-filter mode
5. Proxy mode
6. Point-to-point mode
7. Event bus mode
8. Model-view-controller mode
9. Blackboard mode
10. Interpreter mode

1. Hierarchical pattern

This pattern is used to build programs that can be decomposed into multiple groups of subtasks. Each subtask is in a certain abstraction layer, and each layer is The service is provided by the previous higher level. The most common 4-layer system in general information systems is as follows.

  • Presentation layer (also called UI layer)
  • Application layer (also called service layer)
  • Business logic layer (also called domain layer)
  • Data access layer (also called persistence layer)
Application scenario
  • General desktop program
  • E-commerce web page program


##2. Client-server mode

This mode consists of two Partial composition: single server and multiple clients. A server component provides services to multiple client components. Clients request services from the server, and the server provides corresponding services to these clients. Additionally, the server continues to listen for client requests.


Application scenarios

    Online applications, such as email, document sharing and banking


3. Master-slave mode

This mode consists of two parts: the master node and multiple slave nodes. The master node component dispatches tasks to multiple independent slave node components and calculates the final result based on the results returned by the slave nodes.


Application scenario

    Database replication, the master database is regarded as the authoritative source and synchronized to the slave database
  • Connect to the calculation Peripheral devices of the system (master-slave driver)


##4. Pipe-filter mode This pattern is used to build systems that produce and process data streams. Each processing step is encapsulated in a filter component. The data to be processed is sent to pipes, which can be used for buffering or synchronization.


Application scenarios

Compiler, successive filters perform word semantic analysis, syntax analysis, semantic analysis and code generation
  • workflow of biodata discipline


5. Agent mode This pattern is used to build distributed systems with decoupled components. These components interact with each other through remote calls. The proxy component is responsible for the communication coordination of multiple components. The server exposes their capabilities (services and features) to the proxy; the client obtains the service from the proxy, and then the proxy redirects the client to an appropriate service in the registered service library.


Application scenarios

Message queue software, such as Apache ActiveMQ, Apache Kafka, RabbitMQ and JBoss Messaging

6. Point-to-point mode

In this mode, each independent component is called a peer. Peers can either act as clients to obtain services from other peers, or act as servers to provide services to other peers. Peers can act as clients, servers, or both, and dynamically switch roles at any time.

Application Scenario

  • File sharing network, such as Gnutella and G2
  • Multimedia protocols, such as P2PTV and PDTP
  • Private media programs, such as Spotify


##7. Event bus mode

This mode mainly handles events and has 4 main components: event source, event listener, channel and event bus. The event source publishes messages to a channel on the event bus, and the listener subscribes to a channel and learns about messages published in the subscribed channel.


Application Scenario

    Android Development
  • Notification Service


8. Model-View-Controller Pattern

This pattern is also called the MVC pattern. It divides the interactive program into three parts: Model - Contains core functionality and data, View - displays information to the user (multiple views can be defined), Controller - handles user input. It does this by splitting the internal representation of user information from the way it is presented and received, decoupling components and allowing efficient code reuse.


Application scenarios

    World Wide Web program architecture of mainstream programming languages
  • Web page frameworks, such as Django and Rails


9. Blackboard mode

This mode is very suitable for problems where there is no deterministic solution strategy. it works. The blackboard pattern consists of three main components, the blackboard - a structured global memory containing solution space objects, the knowledge source - a specialized module with its own representation, and the control component - the selection, configuration and execution module. All components have access to the blackboard and new data objects can be generated and added to the blackboard. In Blackboard, certain types of data can be found based on matching rules from existing knowledge sources.


Application scenarios

    Speech recognition
  • Vehicle recognition and tracking
  • Protein structure identification
  • Sonar Signal Interpretation


10. Interpreter Mode

This pattern is used for designing components that interpret programs written in a specific language. This component mainly specifies how to evaluate lines of program code, which are so-called statements or expressions written in a certain language. The basic point is to classify language symbols.


Application scenarios

    Database query language, such as SQL
  • Language used to describe communication protocols


Architectural Pattern Comparison

The following table outlines the pros and cons of each architectural pattern.


# I hope this article is helpful to you, and I would also like to hear your thoughts. thanks for reading. ^_^


The above is the detailed content of What are some common software architectures?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template