Software Architecture : Software architecture is the blueprint of building software. It shows the overall structure of the software, the collection of components in it, and how they interact with one another while hiding the implementation.
This helps the software development team to clearly communicate how the software is going to be built as per the requirements of customers.
There are various ways to organize the components in software architecture. And the different predefined organization of components in software architectures are known as software architecture patterns. A lot of patterns were tried and tested. Most of them have successfully solved various problems. In each pattern, the components are organized differently for solving a specific problem in software architectures.
Well, I hope you don’t want to bore yourself by reading the endless types of software architecture patterns. That’s why among the multiple software architecture patterns, we are going to see a few of the most important and commonly used patterns.
Different Software Architecture Patterns :
Layered Pattern
Client-Server Pattern
Event-Driven Pattern
Microkernel Pattern
Microservices Pattern
Let’s see one by one in detail.
1. Layered Pattern : As the name suggests, components(code) in this pattern are separated into layers of subtasks and they are arranged one above another.
Each layer has unique tasks to do and all the layers are independent of one another. Since each layer is independent, one can modify the code inside a layer without affecting others.
It is the most commonly used pattern for designing the majority of software. This layer is also known as ‘N-tier architecture’. Basically, this pattern has 4 layers.
Presentation layer (The user interface layer where we see and enter data into an application.)
Business layer (this layer is responsible for executing business logic as per the request.)
Application layer (this layer acts as a medium for communication between the ‘presentation layer’ and ‘data layer’.
Data layer (this layer has a database for managing data.)
Ideal for:
E-commerce web applications development like Amazon.
Client-Server Pattern : The client-server pattern has two major entities. They are a server and multiple clients.
Here the server has resources(data, files or services) and a client requests the server for a particular resource. Then the server processes the request and responds back accordingly.
Examples of software developed in this pattern:
Email.
WWW.
File sharing apps.
Banking, etc…
So this pattern is suitable for developing the kind of software listed in the examples.
Event-Driven Pattern : Event-Driven Architecture is an agile approach in which services (operations) of the software are triggered by events.
Well, what does an event mean?
When a user takes action in the application built using the EDA approach, a state change happens and a reaction is generated that is called an event.
Eg: A new user fills the signup form and clicks the signup button on Facebook and then a FB account is created for him, which is an event.
Ideal for:
Building websites with JavaScript and e-commerce websites in general.
Microkernel Pattern : Microkernel pattern has two major components. They are a core system and plug-in modules.
The core system handles the fundamental and minimal operations of the application.
The plug-in modules handle the extended functionalities (like extra features) and customized processing.
Let’s imagine, you have successfully built a chat application. And the basic functionality of the app is that you can text with people across the world without an internet connection. After some time, you would like to add a voice messaging feature to the application, then you are adding the feature successfully. You can add that feature to the already developed application because the microkernel pattern facilitates you to add features as plug-ins.
Microkernel pattern is ideal for:
Product-based applications and scheduling applications. We love new features that keep giving dopamine boost to our brain. Such as Instagram reels, YouTube Shorts and a lot more that feasts us digitally. So this pattern is mostly preferred for app development.
5. Microservices Pattern : The collection of small services that are combined to form the actual application is the concept of microservices pattern. Instead of building a bigger application, small programs are built for every service (function) of an application independently. And those small programs are bundled together to be a full-fledged application.
So adding new features and modifying existing microservices without affecting
other microservices are no longer a challenge when an application is built in a microservices pattern.
Modules in the application of microservices patterns are loosely coupled. So they are easily understandable, modifiable and scalable.
Example Netflix is one of the most popular examples of software built-in microservices architecture. This pattern is most suitable for websites and web apps having small components.
Fundamentals of Software Architecture
Software Architecture :
Software Architecture defines fundamental organization of a system and more simply defines a structured solution. It defines how components of a software system are assembled, their relationship and communication between them. It serves as a blueprint for software application and development basis for developer team.
Software architecture defines a list of things which results in making many things easier in the software development process.
A software architecture defines structure of a system.
A software architecture defines behavior of a system.
A software architecture defines component relationship.
A software architecture defines communication structure.
A software architecture balances stakeholder’s needs.
A software architecture influences team structure.
A software architecture focuses on significant elements.
A software architecture captures early design decisions.
Characteristics of Software Architecture : Architects separate architecture characteristics into broad categories depending upon operation, rarely appearing requirements, structure etc. Below some important characteristics which are commonly considered are explained.
Operational Architecture Characteristics :
Availability
Performance
Reliability
Low fault tolerance
Scalability
Structural Architecture Characteristics :
Configurability
Extensibility
Supportability
Portability
Maintainability
Cross-Cutting Architecture Characteristics :
Accessibility
Security
Usability
Privacy
Feasibility
SOLID principles of Software architecture :
Each character of the word SOLID defines one principle of software architecture. This SOLID principle is followed to avoid product strategy mistakes. A software architecture must adhere to SOLID principle to avoid any architectural or developmental failure.
Single Responsibility – Each services should have a single objective.
Open-Closed Principle – Software modules should be independent and expandable.
Liskov Substitution Principle – Independent services should be able to communicate and substitute each other.
Interface Segregation Principle – Software should be divided into such microservices there should not be any redundancies.
Dependency Inversion Principle – Higher-levels modules should not be depending on low-lower-level modules and changes in higher level will not affect to lower level.
Architectural patterns:
Layered pattern
Client-server pattern
Master-slave pattern
Pipe-filter pattern
Broker pattern
Peer-to-peer pattern
Event-bus pattern
Model-view-controller pattern
Blackboard pattern
Interpreter pattern
1. Layered pattern
This pattern can be used to structure programs that can be decomposed into groups of subtasks, each of which is at a particular level of abstraction. Each layer provides services to the next higher layer.
The most commonly found 4 layers of a general information system 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)
Usage
General desktop applications.
E commerce web applications.
Layered pattern2. Client-server pattern
This pattern consists of two parties; a server and multiple clients. The server component will provide services to multiple client components. Clients request services from the server and the server provides relevant services to those clients. Furthermore, the server continues to listen to client requests.
Usage
Online applications such as email, document sharing and banking.
Client-server pattern3. Master-slave pattern
This pattern consists of two parties; master and slaves. The master component distributes the work among identical slave components, and computes a final result from the results which the slaves return.
Usage
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).
Master-slave pattern4. Pipe-filter pattern
This pattern can be used to structure systems which produce and process a stream of data. Each processing step is enclosed within a filter component. Data to be processed is passed through pipes. These pipes can be used for buffering or for synchronization purposes.
Usage
Compilers. The consecutive filters perform lexical analysis, parsing, semantic analysis, and code generation.
Workflows in bioinformatics.
Pipe-filter pattern5. Broker pattern
This pattern is used to structure distributed systems with decoupled components. These components can interact with each other by remote service invocations. A broker component is responsible for the coordination of communication among components.
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.
Usage
Message broker software such as Apache ActiveMQ, Apache Kafka, RabbitMQ and JBoss Messaging.
Broker pattern6. Peer-to-peer pattern
In this pattern, individual components are known as peers. Peers may function both as a client, requesting services from other peers, and as a server, providing services to other peers. A peer may act as a client or as a server or as both, and it can change its role dynamically with time.
Usage
File-sharing networks such as Gnutella and G2)
Multimedia protocols such as P2PTV and PDTP.
Cryptocurrency-based products such as Bitcoin and Blockchain
Peer-to-peer pattern7. Event-bus pattern
This pattern primarily deals with events and has 4 major components; event source, event listener, channel and event bus. Sources publish messages to particular channels on an event bus. Listeners subscribe to particular channels. Listeners are notified of messages that are published to a channel to which they have subscribed before.
Usage
Android development
Notification services
Event-bus pattern8. 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 representations of information from the ways information is presented to, and accepted from, the user. It decouples components and allows efficient code reuse.
Usage
Architecture for World Wide Web applications in major programming languages.
Web frameworks such as Django and Rails.
Model-view-controller pattern9. Blackboard pattern
This pattern is useful for problems for which no deterministic solution strategies are known. The blackboard pattern consists of 3 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.
All the components have access to the blackboard. Components may produce new data objects that are added to the blackboard. Components look for particular kinds of data on the blackboard, and may find these by pattern matching with the existing knowledge source.
Usage
Speech recognition
Vehicle identification and tracking
Protein structure identification
Sonar signals interpretation.
Blackboard pattern10. Interpreter pattern
This pattern is used for designing a component that interprets programs written in a dedicated language. It mainly specifies how to evaluate lines of programs, known as sentences or expressions written in a particular language. The basic idea is to have a class for each symbol of the language.
Usage
Database query languages such as SQL.
Languages used to describe communication protocols.
Comments