primers

While looking at Scalable Frontend 1 — Architecture Fundamentals, I realized that there should be more than this layering pattern, so I went to find some materials and translated records.

原文 : 10 Common Software Architectural Patterns in a nutshelle

The body of the

Ever wonder how large enterprise systems are designed? Before major software development begins, we must choose an appropriate architecture that will give us the functionality and quality features we need. Therefore, we should understand the different architectures before applying them to our design.

What are architectural patterns?

According to Wikipedia,

An architectural pattern is a generic, reusable solution to common problems in software architecture in a particular context. Architectural patterns are similar to software design patterns, but broader in scope.

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

  1. Layered Pattern
  2. Client-server pattern
  3. Master-slave Pattern
  4. Pipe-filter Pattern
  5. Broker Pattern
  6. Peer-to-peer pattern
  7. Event-bus Pattern
  8. Model-view-controller Pattern
  9. Blackboard Pattern
  10. Interpreter Pattern

1. Layered Pattern

This pattern can be used to construct programs that can be decomposed into groups of subtasks, each at a specific level of abstraction. Each layer serves the next higher level.

The four most common levels in general information systems are as follows.

  • Presentation layer (also known as UI layer)
  • Application Layer (also known as service layer)
  • Business logic layer (also known as domain layer)
  • Data access layer (also known as persistence layer)

application

  • General desktop applications.
  • E-commerce Web applications.

2. Client-server pattern

This pattern consists of two parts: a server and multiple clients. The server component will serve multiple client components. Clients request services from servers, and servers provide related services to these clients. In addition, the server continues to listen for client requests.

application

  • Online applications, such as email, document sharing, and opening accounts.

3. Master-slave Pattern

This mode consists of two parts: the Master and the slave. The master component assigns work to the same slave component and computes the final result based on the result returned from the slave component.

application

  • In database replication, the master database is treated as the authoritative source, and the slave database is synchronized with the master database.
  • Peripheral devices connected to the bus of the computer system (master and slave drives).

4. Pipe-filter pattern

This pattern can be used to construct systems that generate and process data flows. Each processing step is contained in the filter component. The data to be processed is piped. These pipes can be used for buffering or synchronization.

application

  • The compiler. Continuous filters perform lexical analysis, parsing, semantic analysis, and code generation.
  • Bioinformatics workflow.

5. Broker Pattern

This pattern is used to construct distributed systems with decoupled components. These components can cooperate with each other through remote service invocations. The proxy component is responsible for coordinating communication between components.

The server publishes its functionality (services and features) to the agent. The client requests the service to the broker, which then redirects the client from the registry to the appropriate service.

application

  • Message broker software such as Apache ActiveMQ, Apache Kafka, RabbitMQ and JBoss Messaging.

6. Peer-to-peer pattern

In this pattern, individual components are called peers. Peers can either act as clients, requesting services from other peers, or as servers, providing services to other peers. Peers can act as clients, servers, or both, and can change their roles dynamically over time.

application

  • File sharing networks, such as Gnutella and G2.
  • Multimedia protocols, such as P2PTV and PDTP.
  • Products based on digital cryptocurrencies, such as Bitcoin and blockchain.

7. Event-bus Pattern

This mode deals with events and has four main components: event source, Event Listener, Channel, and Event bus. Sources publish messages to specific channels on an event bus. Listeners subscribe to specific channels. Listeners will be notified of messages that will be published to the channel to which they were previously subscribed.

application

  • Android development.
  • Notification service.

8.MVC Pattern (Model-view-Controller pattern)

This pattern, also known as the MVC pattern, divides an interactive application into three parts:

  • Model — Contains core functionality and data.
  • View — Displays information to the user (multiple views can be defined).
  • Controller – Handles input from the user.

This is done to distinguish between how internal information is presented to users and how it is received. It decouples components and allows efficient code reuse.

application

  • World Wide Web application architecture in major programming languages.
  • Web frameworks such as Django and Rails.

9. Blackboard Pattern

This pattern is useful for problems where you do not know the strategy for determining the solution. Blackboard mode consists of three main parts.

  • Blackboard – A structured global memory that contains objects from the solution space
  • Knowledge sources — specialized modules with self-identification
  • Control components — select, configure, and execute modules.

All components have access to the blackboard. The component might generate new data objects and add them to the blackboard. Components look up specific types of data on the blackboard and can find them by matching patterns with existing knowledge sources.

application

  • Speech recognition.
  • Vehicle identification and tracking.
  • Protein structure identification.
  • Sonar signal analysis.

10. Interpreter Pattern

This pattern is used to design components that interpret programs written in a particular language. It mainly specifies how each line of a program is parsed, using statements or expressions written in a particular language. The basic idea is to create a class for each symbol of the language.

application

  • Database query languages, such as SQL.
  • A language used to describe communication protocols.

Comparison of architectural patterns

The advantages and disadvantages of each architectural pattern are summarized below.

The resources

  • Architectural Patterns
  • 10 Common Software Architectural Patterns in a nutshelle

Recently, I finished reading a collection of essays by Taijae Ji. In his last work “The Loss of human life,” the hero experiences the loss of family love, friendship and love, and finally decides that he has lost his qualifications as a human being.

In his previous works, taizai ji did not have as many aspects as those described in “Human Loss”, but often focused on one aspect. What remains unchanged is that it seems that the idea of death is always involved in all his articles.

Taizai ji talked about wanting to die, there is not that kind of righteousness or noble reason, more is the despair of oneself, the despair of the world. Thinking over and over again, unable to find their way out of relief, there is the idea of death.

At the end of “Lost on Earth,” the main character realizes:

It will all pass in the end.