Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the design patterns commonly used in web architecture design

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what are the design patterns commonly used in web architecture design". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the design patterns commonly used in web architecture design?"

1. Hierarchical mode

This pattern is used for structured programs that can be broken down into subtasks, each of which is at a specific level of abstraction, and each layer serves the upper level. The four most common levels of 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 scenarios:

General desktop applications

E-commerce web application

General mobile App

two。 Client-server mode

This mode consists of two parts: a server and multiple clients. The server will provide services to multiple clients. The client requests services from the server, and the server provides related services to these clients. In addition, the server continues to listen for client requests.

Application scenarios:

Online applications such as email, document sharing and banking.

IPC-based applications

3. Master-slave mode

This model consists of two parts: master node and slave node. The master node assigns work to the same slave node and calculates the final result based on the result returned by the slave node.

Application scenarios:

In database replication, the master database is regarded as the authoritative source database, and the slave database is synchronized with it.

Peripherals connected to the computer system (master and slave drives) through a bus.

Multithreaded applications within a process.

4. Pipe-filter mode

This pattern can be used to construct systems that generate and process data streams. Each processing step contains a filter component. The data to be processed is passed through the pipeline. These pipes can be used for buffering or synchronization purposes.

Application scenarios:

Compiler. Continuous filters perform lexical analysis, lexical parsing, semantic analysis, and code generation.

Workflow of bioinformatics

Tool chain application

5. Agent mode

This model constructs a distributed system by decoupling components. These components can interact with each other through remote service invocations. The agent component is responsible for coordinating communication between components. The server publishes functions (services and features) to the agent. The client requests a service from the agent, and the agent redirects the client to the appropriate service. You should pay attention to the difference between broker,agent,proxy and delegate.

Application scenarios:

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

Agent software in network transmission.

6. P2P mode

In this mode, each component is called a peer node. The peer node can act as either a client (requesting services from other peers) or a server (providing services to other peers). The peer node can act as a single client or server, or both, and the role can be changed dynamically over time.

Use the scene:

File sharing networks, such as Gnutella and G2, etc.

Multimedia protocols, such as P2PTV and PDTP.

7. Event-bus mode

This pattern, also known as the subscription publish pattern, mainly deals with events and has four main components: event source, event listener, channel, and event bus. The event source publishes the message to a specific channel on the event bus and the listener subscribes to the specific channel. The message is published to the channel that the listener subscribed to before it is published, and the listener is notified of the message.

Use the scene:

Android development

Notification service

Registration center

8. Model-view-controller mode

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

Model-contains core functions and data

View-displays information to the user (multiple views can be defined)

Controller-handles input from the user

This is done to separate the internal representation of the information, the way it is presented to the user, and the way it accepts user input. This pattern decouples components and allows effective code reuse.

Application scenarios:

General web application architecture

Web frameworks such as Django and Rails

General GUI applications

9. Blackboard mode

This pattern is useful for problems that do not have a solution strategy. The blackboard pattern consists of three main parts:

Blackboard: a structured global memory containing objects from the solution space

Knowledge source: a specialized module with its own representation

Control components: selection, configuration, and execution modules

All the components can reach the blackboard. Component can generate new data objects that are added to the blackboard. The component looks for specific types of data on the blackboard and finds it by pattern matching with existing knowledge sources.

Application scenarios:

Speech recognition

Vehicle identification and tracking

Protein structure recognition

Interpretation of sonar signal

10. Interpreter mode

This pattern is used to design a program component that interprets writing in a special language. It mainly specifies how to evaluate each line of programs, that is, sentences or expressions written in a particular language. The basic idea is that every symbol of a language has a class.

Application scenarios:

Database query language, such as SQL.

A language used to describe communication protocols.

At this point, I believe you have a deeper understanding of "what are the design patterns commonly used in web architecture design?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report