当前位置:网站首页>10 common software architecture patterns
10 common software architecture patterns
2020-11-08 13:02:00 【osc_0vd38ylb】
Python The actual combat community
Java The actual combat community
Long press to identify the QR code below , Add as needed
Scan code, pay attention to add customer service
Into the Python community ▲
Scan code, pay attention to add customer service
Into the Java community ▲
Source Java Technical station
https://mp.weixin.qq.com/s/6R4QP-gAimHzi-I8js8B6A
Want to know how to design a large enterprise class system ? Before starting major code development , We have to choose the right Architecture , It will give us the functionality and quality attributes we need . therefore , Before we apply them to our designs , You should first understand the different architectures .
- What is architecture pattern -
According to Wikipedia ,
Architecture patterns are generic solutions to common problems in software architecture in a given context 、 Reusable solutions . Architecture pattern is similar to software design pattern , But more broadly .
In this paper , I will briefly introduce the following 10 Common architecture patterns , And its use 、 Advantages and disadvantages .
- Hierarchical mode -
This pattern can be used to build programs that can be decomposed into subtask groups , Each of them is at a specific level of abstraction . Every time we serve higher levels .
The most common in general information systems 4 The layers are divided as follows :
Presentation layer The presentation layer ( That is to say UI layer )
Application layer application layer ( That is the service layer )
Business logic layer Business logic layer ( It's the domain level )
Data access layer Data access layer ( Data persistence layer )
application
General desktop applications
Electronic Commerce Web Applications
- client - Server mode -
The model consists of two parts : One server and multiple clients , The server provides services to multiple clients . The client makes a request to the server , The server provides services to these clients , after , The server continues to listen for requests from clients .
application
Online applications , E-mail 、 File sharing and banking
- A master-slave mode -
The model is also divided into two parts : Master module and slave module . The master module distributes work between the same slave modules , And calculate the final result according to the structure returned from the module .
application
In database replication , The master database is considered the authoritative data source , And keep it in sync with the database
Peripheral devices connected to the computer system bus ( Master and slave drives )
- Pipeline filter mode -
This pattern can be used to build systems that generate and process data streams . Each processing step is contained in a filter component , Data to be processed is piped . These pipes can be used to buffer or synchronize .
application
compiler . Lexical analysis is performed using different filters in turn 、 analysis 、 Syntax analysis and code generation
Workflow in bioinformatics
- Broker Pattern -
This pattern uses decoupled components to build distributed systems , These components can interact through remote service calls . The agent component is responsible for coordinating communication between components .
Servers put their functions ( Services and features, etc ) Publish to agent , Client requests service from agent , The agent then forwards the client request to the appropriate service according to its registry .
application
Message broker software , Such as Apache ActiveMQ, Apache Kafka, RabbitMQ and JBoss Messaging.
- P2P Pattern -
In this mode , Each individual component is called a peer ( Or peer ,peer). A peer can act as a client ( Request services from other peers ), It can also act as a server ( Providing services to other peers ). The same peer may be both a client , It's the server again , And it can dynamically change its role .
application
File sharing network , Such as Gnutella and G2
Multimedia protocol , Such as P2PTV and PDTP
Cryptocurrency based products , Such as bitcoin and blockchain
- Things bus mode -
This pattern mainly deals with components , Yes 4 An important component : Event source 、 Event Listener 、 Channel and event bus . The event source sends the message to a specific channel on the event bus , Listeners subscribe to specific channels . When the message is sent to the channel , Listeners that subscribe to the channel receive notification of the message .
application
Android Development
Notification services
- MVC Pattern -
This pattern divides the interactive application into three parts ,
Model —— Including core functions and data
View —— Show information to users ( You can define multiple views )
controller —— Handle user input
This is done to separate the internal representation of the data from the form of user input and presentation , This decouples the components , At the same time, it can also make efficient code reuse .
application
Internet application architecture of mainstream programming languages
Network framework , Such as Django and Rails.
- Blackboard mode -
This pattern is useful for problems where there is no definitive solution , The blackboard model consists of three parts :
blackboard —— A structured global memory , Contains objects in the solution domain
Knowledge source —— Professional module with its own meaning
Control components —— choice 、 Configuration and execution modules
All components have access to the blackboard , Components may generate new data objects to be added to the blackboard , Components look for specific types of data on the blackboard , And matching these data sources with existing patterns .
application
speech recognition
Vehicle identification and tracking
Protein structure identification
Sonar signal interpretation
- Interpreter mode -
This pattern is often used to design components to interpret programs written in a dedicated language , It mainly specifies how to estimate program lines , A statement or expression written in a specific language . The basic idea is to design a class for each language symbol .
application
Database query language , Such as SQL
The language used to describe a communication protocol
- Architecture pattern comparison -
Pattern |
advantage |
shortcoming |
Hierarchical mode |
A low-level service can be used by different high-level services ; |
It's not a pervasive Architecture ; |
CS Pattern |
Easy to model series of services , For client request |
Requests are usually responded to in different threads on the server ; |
A master-slave mode |
accuracy —— The execution of the service is delegated to different slave modules |
The slave module is independent : No shared state ; |
Pipe filter mode |
Support concurrent processing , Where input 、 When the output consists of data streams , The filter starts calculating as soon as it receives the data ; |
Overall efficiency is limited by the slowest filter program ; |
The proxy pattern |
Allow objects to be dynamically modified 、 increase 、 Delete 、 relocation , Content distribution is transparent to developers |
Service description needs to be standardized |
P2P Pattern |
Support decentralization operations ; |
There is no guarantee of service quality , Because the nodes cooperate voluntarily ; |
Event bus mode |
It's easy to add new publishers to the system 、 Subscribers and connections ; |
Scalability can be a problem , Because all information is transmitted through the same time bus |
MVC Pattern |
The first mock exam is easy to build multiple views , You can connect or disconnect at runtime |
Added complexity , User actions can lead to many unnecessary updates |
Blackboard mode |
Easy to add new applications ; |
It's hard to modify the structure of a data space , Because all applications will be affected ; |
Interpreter mode |
May support highly dynamic behavior ; |
Because interpretive languages are usually slower than compiled languages , So performance can be a problem |
Copyright notice : Content source network , The copyright belongs to the creator . Unless you can't confirm , We all mark the author and the source , Please let me know if there is any infringement , We will delete it immediately and apologize . thank you !
Programmer column Scan code and pay attention to customer service Press and hold to recognize the QR code below to enter the group
Recent highlights are recommended :
My girlfriend thinks the annual salary is 50 Ten thousand is the average level , What do I do ?
The sexy goddess of the biggest straight men forum in China overturned
IntelliJ IDEA Fully optimized settings , Efficiency bars !
Here's a look Good articles to share with more people ↓↓
版权声明
本文为[osc_0vd38ylb]所创,转载请带上原文链接,感谢
边栏推荐
- 值得一看!EMR弹性低成本离线大数据分析最佳实践(附网盘链接)
- 如何将 PyTorch Lightning 模型部署到生产中
- 2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
- How to cooperate with people in software development? |Daily anecdotes
- Stm32uberide download and install - GPIO basic configuration operation - debug (based on CMSIS DAP debug)
- 最全!阿里巴巴经济体云原生实践!(附网盘链接)
- OR Talk NO.19 | Facebook田渊栋博士:基于蒙特卡洛树搜索的隐动作集黑盒优化 - 知乎
- Python basic syntax
- From a friend recently Ali, Tencent, meituan and other P7 Python development post interview questions
- Python基础语法
猜你喜欢
Xamarin 从零开始部署 iOS 上的 Walterlv.CloudKeyboard 应用
TiDB 性能竞赛 11.02-11.06
The most complete! Alibaba economy cloud original practice! (Internet disk link attached)
2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
Drink soda, a bottle of soda water 1 yuan, two empty bottles can change a bottle of soda, give 20 yuan, how much soda can you
Shell uses. Net objects to send mail
阿里云加速增长,进一步巩固领先优势
Adobe media encoder / me 2021 software installation package (with installation tutorial)
Top 5 Chinese cloud manufacturers in 2018: Alibaba cloud, Tencent cloud, AWS, telecom, Unicom
如何将 PyTorch Lightning 模型部署到生产中
随机推荐
Q & A and book giving activities of harbor project experts
Introduction to mongodb foundation of distributed document storage database
Introduction to mongodb foundation of distributed document storage database
阿里教你深入浅出玩转物联网平台!(附网盘链接)
STM32CubeIDE下载安装-GPIO基本配置操作-Debug调试(基于CMSIS DAP Debug)
Research on WLAN direct connection (peer-to-peer connection or P2P) and cross platform research of IOS
This paper analyzes the top ten Internet of things applications in 2020!
【Python 1-6】Python教程之——数字
Eight ways to optimize if else code
适合c/c++新手学习的一些项目,别给我错过了!
Harbor项目高手问答及赠书活动
谷歌开源能翻译101种语言的AI模型,只比Facebook多一种
Flink从入门到真香(7、Sink数据输出-文件)
AQS解析
Top 5 Chinese cloud manufacturers in 2018: Alibaba cloud, Tencent cloud, AWS, telecom, Unicom
还不快看!对于阿里云云原生数据湖体系全解读!(附网盘链接)
2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
From a friend recently Ali, Tencent, meituan and other P7 Python development post interview questions
浅谈单调栈