Most Useful Software Architecture Patterns

Most Useful Software Architecture Patterns

Layered Pattern (n-tier)

The layered architecture pattern is one of the most common patterns. The idea behind a Layered pattern is that components with the same functionalities will be organized into horizontal layers. As a result, each layer performs a specific role within the application.


In this pattern, we do not have a restriction on the number of layers that the application can have. In this, we also promote the concept of separation of concerns. The layered pattern style abstracts the view of the software as a whole; while providing enough detail to understand the roles and responsibilities of individual layers and the relationship between them. A typical implementation of the layered pattern could be:

  • UI / Presentation Layer: Render and run the user interface, sends requests to the server application.
  • Application Layer: This contains the presentation layer, the application layer, the domain layer, and the persistence layer.
  • Domain / Business Layer: This layer contains all the business logic, the entities, events, and other object types which contains Business Logic.
  • Database Layer: This would be the data layer and would be used for the persistence of data, which would be used by the application server.

No alt text provided for this image

Example: Desktop Application, E-Commerce or Web-Based Applications, etc.


Client-Server Pattern

It’s the simplest architecture pattern, which consists of a server and multiple clients. This pattern is a distributed structure that partitions tasks/workloads between the providers of a resource/service, called servers, and service requesters called clients.


In the client-server pattern, when the client sends a request for data to the server, the server accepts the requested process and responds with the required data to the client. Clients do not share any of their resources.

No alt text provided for this image

Examples: Email, Document Sharing, Banking, etc.


Event-Bus Pattern (Event-Driven Architecture)

This pattern is a distributed asynchronous architecture pattern to create highly scalable reactive applications. The suits for every level application stack from small to complex ones. The main idea of this pattern is delivering and processing events asynchronously.


This pattern has four major components:

  1. Event Source
  2. Event Listener
  3. Channel
  4. Event Bus.

Sources publish messages to particular channels on an event bus. Listeners subscribe to particular channels. Listeners get messages that are published to a channel to which they have subscribed.

No alt text provided for this image

Examples: e-commerce, mobile application development, notification services, etc.


Broker Pattern

This pattern can be used to structure distributed systems with decoupled components that interact by remote service invocations. A broker component is responsible for the coordination of communication among components; such as forwarding requests, as well as transmitting results and exceptions.


Servers?publish their capabilities (services and characteristics) to a?broker.?Clients?request a service from the?broker, and the?broker?then redirects the?client?to a suitable?service?from its registry.

No alt text provided for this image

Examples: Message broker software programs, Apache ActiveMQ, Apache Kafka, RabbitMQ, JBoss Messaging, etc.


Microservices Pattern

In this pattern, services communicate by using synchronous protocols like HTTP/REST or asynchronous protocols like AMQP (Advanced Message Queuing Protocol). Services can be developed and deployed independently, and each service will have its own database from other services. Data consistency between services is maintained by using the Saga Pattern (a sequence of local transactions).

No alt text provided for this image

Examples: can be implemented on many use cases, especially extensive data pipeline


Peer-to-Peer Pattern

As in the common client-server architecture, multiple clients communicate with a central server. But a peer-to-peer (P2P) pattern consists of a decentralized network of peers

In this pattern, nodes behave like clients and servers. Peers may function both as a client, requesting services from other peers, and as a server, providing services to other peers.

P2P networks distribute the workload between peers, and all peers contribute and consume resources within the network without the need for a centralized server. A peer may change its role dynamically with time.

No alt text provided for this image

Examples: file-sharing networks, multimedia protocols PDTP, P2PTV, bitcoin, blockchain, etc.


Blackboard Pattern

This pattern is useful for problems for which no deterministic solution strategies are known.


All the components have access to the blackboard. Components may produce new data objects which will be added to the blackboard. Components look for specific types of data on the blackboard and would find those by pattern matching with the existing knowledge source.

This pattern consists of three main components:

  • 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.

No alt text provided for this image

Examples: Speed Recognition, Protein structure identification, sonar signal interpretation, machine learning programs, etc.

Keep Learning!


Talha A.

Senior Software Engineer ? Full Stack ? JavaScript ? PHP ? MySQL ? AWS

2 年

Architectural patterns increase your productivity: These reusable schemes address common software design challenges.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了