Getting Started With Software Architectural Patterns
Have you ever wondered how large enterprise scale systems are built? Before we begin major software development, we must select an architecture that will provide us with the desired functionality and quality attributes. As a result, before applying different architectures to our design, we should first understand them.
What is an Architectural Pattern?
According to Wikipedia,
An architectural pattern is a general, reusable solution to a commonly occurring problem in software architecture within a given context. Architectural patterns are similar to software design pattern but have a broader scope.
1. Layered pattern
This pattern can be used to structure programs that can be broken down into groups of subtasks, each at a different level of abstraction. Each layer provides services to the layer above it.
The following are the four most common layers of a general information system.
- 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)
- General desktop applications.
- E commerce web applications.
2. Client-server pattern
A server and multiple clients are involved in this pattern. Multiple client components will be served by the server component. Clients request services from the server, and the server responds by providing those services. Furthermore, the server is still listening for client requests.
- Online applications such as email, document sharing and banking.
3. Master-slave pattern
This pattern has two parties: the master and the slaves. The master component divides the work among identical slave components and computes a final result from the slaves’ results.
- In database replication, the master database is regarded as the authoritative source, and the slave databases are synchronized to it.
- Peripherals connected to a bus in a computer system (master and slave drives).
4. Pipe-filter pattern
This pattern can be used to structure systems that generate and process data streams. Each processing step is contained by a filter component. Pipes transport data to be processed. These pipes can be used for buffering as well as synchronization.
- Compilers. The consecutive filters perform lexical analysis, parsing, semantic analysis, and code generation.
- Workflows in bioinformatics.
5. Broker pattern
This pattern is used to organize distributed systems that have decoupled components. Remote service invocations allow these components to communicate with one another. A broker component is in charge of coordinating communication among components.
A server’s capabilities (services and characteristics) are published to a broker. Clients request a service from the broker, who then directs the client to a suitable service in its registry.
- Message broker software such as Apache ActiveMQ, Apache Kafka, RabbitMQ and JBoss Messaging.
6. Peer-to-peer pattern
Individual components in this pattern are referred to as peers. Peers can act as both a client and a server, requesting services from other peers and providing services to other peers. A peer can act as a client, a server, or both, and its role can change dynamically over time.
- File-sharing networks such as Gnutella and G2)
- Multimedia protocols such as P2PTV and PDTP.
- Cryptocurrency-based products such as Bitcoin and Blockchain
7. Event-bus pattern
This pattern focuses on events and has four major components: an event source, an event listener, a channel, and an event bus. Messages are published by sources to specific channels on an event bus. Listeners subscribe to specific channels. Listeners are notified when messages are published to a channel to which they have previously subscribed.
- Android development
- Notification services
8. Model-view-controller pattern
This pattern, also known as MVC pattern, divides an interactive application in to 3 parts as,
- model — contains the core functionality and data
- view — displays the information to the user (more than one view may be defined)
- controller — handles the input from the user
This is done to separate internal information representations from how information is presented to and accepted by the user. It decouples components and facilitates code reuse.
- Architecture for World Wide Web applications in major programming languages.
- Web frameworks such as Django and Rails.
9. Blackboard pattern
This pattern is useful for problems with no known deterministic solution strategies. The blackboard pattern is made up of three main parts.
- blackboard — a structured global memory containing objects from the solution space
- knowledge source — specialized modules with their own representation
- control component — selects, configures and executes modules.
The blackboard is accessible to all components. Components may generate new data objects that are displayed on the blackboard. Components search for specific types of data on the blackboard and may find them by pattern matching against the existing knowledge source.
- Speech recognition
- Vehicle identification and tracking
- Protein structure identification
- Sonar signals interpretation.
10. Interpreter pattern
This design pattern is used to create a component that interprets programs written in a specific language. It primarily specifies how to evaluate program lines, also known as sentences or expressions written in a specific language. The basic idea is to have a class for each language symbol.
- Database query languages such as SQL.
- Languages used to describe communication protocols.
I hope you found this article informative. I’d love to hear what you think.