Twee - Common Software Architecture Patterns

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Common Software Architecture Patterns

1 Let's Go Through the Transcript!


00:00 - 07:41
https://youtu.be/ZTVAs9cNo30

Welcome to web.programming, where we simplify programming with easy-to-understand


whiteboard videos and today I'll be sharing with you the most common software architecture
patterns that are used by enterprises all across the globe. So let's get started.
First, as basics, let me briefly explain what is a software architecture. Well, it is nothing but a
pictorial representation of the IT system that serves as a blueprint for a system. It provides an
abstraction to manage the system complexity and establish a communication and coordination
mechanism among different components in it. It also helps define a structured solution to meet
all the technical and operational requirements while optimizing the common quality attributes
like performance and security.
The primary goal of a software architecture is to identify requirements that affect the structure
of the application. A well-laid architecture reduces the business risks associated with building a
technical solution and builds a bridge between business and technical requirements.
With that being said, let's start understanding major software architecture patterns starting
with
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. Here, each layer provides services
to the next higher layer. The most commonly found four layers of a general information system
are as follows, where we have
1. Presentation Layer, which is also known as the UI layer
2. Application Layer, which is also known as the Service layer
3. Business Logic Layer, which is also known as the Domain layer
4. Data Access Layer, which is also known as the Persistent layer
Such a setting of software architecture is widely used in building general desktop applications
and e-commerce web applications.
2. Client-Server Pattern
This pattern consists of two parties, a server and multiple clients. Here, the server component
will provide services to multiple client components. Client requests services from the server,
and the server provides relevant services to those clients. Furthermore, the server continues to
listen to the client requests as well. This software architecture is generally used in online
applications such as email, document sharing, and banking, etc.
3. Master-Slave Pattern
This pattern consists of two parties, master and slave. Here, the master component distributes
the work among identical slave components, and computes a final result from the results which
the slaves return. This architecture pattern is employed in database application methods and
situations where peripherals are connected to a bus in the system.
4. Event Bus Pattern
This pattern primarily deals with events and has four major components, event source, event
listeners, channel, and event bus. Here, the source publishes messages to a particular channel
on the event bus, and listeners subscribe to that particular channel. Therefore, listeners are
notified of messages that are published to a channel to which they have subscribed to before.
This software architecture pattern is used in Android development and is widely employed in
building notification services.
5. Pipe Filter Pattern
This pattern can be used to structure systems which produce and process a stream of data.
Here, each processing step is enclosed within a filter component. Data to be processed is
passed through pipes, and these pipes can be used for buffering or for synchronization
purposes. This architecture pattern is used in building compilers and defining workflows in
bioinformatics.
6. Broker Pattern
This pattern is used to structure distributed systems with decoupled components. These
components can interact with each other by remote service invocations, and a broker
component is responsible for the coordination of communication among the components.
Here, servers publish their capabilities which are services and characteristics to a broker, and
clients request a service from the broker, and the broker then redirects the client to a suitable
service from its registry. This particular architecture is generally employed in message broker
software such as Apache Kafka and JBoss messaging.
7. Peer-to-Peer Pattern
In this pattern, individual components are known as peers. Now, do note that peers may
function both as clients, requesting services from other peers, or as servers 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. It is widely used in building file-sharing networks, multimedia protocols,
and various blockchain-based products.
8. Model-View-Controller Pattern
This pattern, also known as the MVC pattern, divides an interactive application into three parts.
As
1. Model which contains the core functionality and data,
2. View which displays the information to the user, and more than one view may be defined as
well.
3. Model-View-Controller which 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. This software
architecture pattern forms as the foundation of web frameworks such as Django and Rails.
9. Particular 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. Here, the basic idea is to have a class for each
symbol of the language. This software architecture is used in database query languages such as
SQL.
10. Blackboard Pattern
Now, this pattern is used for problems for which no deterministic solution strategies are known.
The blackboard pattern consists of three main components.
1. Blackboard, which is a structured global memory containing objects from the solution space.
2. Knowledge Source, which is specialized modules with their own representation. And
3. Control Component, which selects, configures, and executes modules. Here, all the
components have access to Blackboard. And components may produce new data objects that
are added to the same Blackboard. Components look for particular kinds of data on the
Blackboard and may find these patterns matching with the existing knowledge source. This
architectural pattern is widely used in applications that use speech recognition, vehicle
identification, and tracking, etc.
With that, I hope this video was helpful to you and served value. If you love my content, feel free
to smash that like button and if you haven't already subscribed to my channel, please do as it
keeps me motivated and helps me create more content like this for you.

2 Answer the Questions!


00:00 - 07:41
https://youtu.be/ZTVAs9cNo30

1 What is the primary purpose of software architecture, as described in the video?


a To provide a comprehensive technical blueprint of the entire IT system.
b To manage system complexity and facilitate communication between components.
c To define all the operational and performance requirements for the system.
d To optimise the system's security and reliability.

2 How does the layered pattern in software architecture help structure programs?
a By decomposing them into hierarchical groups of tasks at different abstraction levels.
b By distributing work among identical components and aggregating their results.
c By facilitating the publication and subscription of events through a central bus.
d By separating user input handling from the internal data representation.
3 Which software architecture pattern is commonly used in message broker applications?
a Client-Server
b Master-Slave
c Broker
d Peer-to-Peer

4 What is the key objective of the Model-View-Controller (MVC) pattern?


a To decouple the internal data representation from the user interface.
b To interpret domain-specific programming languages.
c To handle problems without deterministic solution strategies.
d To structure distributed systems with loosely coupled components.
5 Which software architecture pattern is typically employed in applications involving
speech recognition and vehicle tracking?
a Layered
b Client-Server
c Blackboard
d Interpreter

6 What type of software systems commonly utilize the Peer-to-Peer architecture pattern?
a File sharing networks, multimedia protocols, and blockchain-based applications.
b Database applications and peripherals connected to a bus.
c General desktop applications and e-commerce web apps.
d Notification services and Android development.
7 What is the primary role of the Controller component in the Model-View-Controller
(MVC) pattern?
a To handle user input and interactions.
b To display information to the user.
c To contain the core functionality and data.
d To select, configure, and execute processing modules.

3 Answer the Questions!


00:00 - 07:41
https://youtu.be/ZTVAs9cNo30
1 The main aim of software architecture is to recognize the needs that impact the
application's structure.
2 The speaker will be discussing the least common software architecture patterns.

3 The four layers of a general information system include the presentation layer, application
layer, business logic layer, and data access layer.
4 The server component only provides services to one client component.

5 The Master component does not distribute work among slave components.

6 Messages are published by the source to a specific channel on the event bus, and listeners
subscribe to that channel.
7 Not all components have access to Blackboard and cannot produce new data objects.

4 Can You Fill in the Gaps?


Software architecture is a _______________(1)
It helps manage system complexity and establish _______________(2)
The primary goal is to identify requirements that affect the _______________(3)
Layered pattern divides programs into subtasks at different _______________(4)
Client-server pattern involves a server providing services to multiple _______________(5)
Master-slave pattern distributes work among slave components for a final _______________(6)
Event bus pattern deals with events and has components like _______________(7)

5 Answer the Questions!


00:00 - 07:41
https://youtu.be/ZTVAs9cNo30

1 What is the primary goal of software architecture according to the speaker?

2 How does the Layered Pattern structure programs, and what are the four layers commonly
found in a general information system?
3 Explain how the Client-Server pattern functions and provide examples of applications
where it is used.

4 Describe the Master-Slave pattern and its application in different scenarios.

5 What are the major components of the Event Bus pattern, and where is this software
architecture pattern commonly employed?

6 How does the Pipe-Filter pattern process data, and in which fields is it typically used?

7 Discuss the Broker Pattern and its role in coordinating communication among distributed
systems.

8 In the Peer-to-Peer pattern, how do individual components (peers) function, and what are
some common uses of this pattern?

9 Explain the Model-View-Controller pattern and its division into three parts. Provide
examples of web frameworks that use this pattern.

10 What is the Interpreter Pattern used for, and in which type of languages is it commonly
applied?
Correct Answers
2 Correct Answers:
1 b
2 a
3 c
4 a
5 c
6 a
7 a

3 Correct Answers:
1 True
2 False - This statement contradicts the factual information provided in the text - the
speaker is talking about the most common patterns, not the least common.
3 True
4 False - This statement contradicts the factual information provided in the text - the
server provides services to multiple client components, not just one.
5 False - This statement contradicts the factual information provided in the text - the
Master component does distribute work among slave components.
6 True
7 False - This statement contradicts the factual information provided in the text - all
components have access to Blackboard and can produce new data objects.

4 Correct Answers:
1 pictorial representation of an IT system 2 communication among components
3 application structure 4 levels of abstraction 5 clients 6 result
7 event source and listeners

5 Correct Answers:
1 The primary goal of software architecture is to identify requirements affecting the
structure of an application, reducing business risks associated with technical
solutions, and bridging the gap between business and technical needs.
2 The Layered Pattern structures programs by decomposing them into subtasks at
different levels of abstraction. The four common layers are Presentation/UI layer,
Application/Service layer, Business Logic/Domain layer, and Data Access/Persistent
layer.
3 The Client-Server pattern involves a server providing services to multiple clients who
request these services. It is commonly used in online applications like email,
document sharing, and banking.
4 The Master-Slave pattern consists of a master component distributing work among
identical slave components. This pattern is often used in database applications and
situations involving connected peripherals.
5 The Event Bus pattern deals with events through components like Event Source, Event
Listeners, Channel, and Event Bus. It is widely used in Android development and
notification services.
6 The Pipe-Filter pattern processes a stream of data by passing it through filters
enclosed within processing steps. It is used in building compilers and defining
workflows in bioinformatics.
7 The Broker Pattern structures distributed systems with decoupled components using
a broker for communication coordination. It is employed in message broker software
like Apache Kafka and JBoss messaging.
8 In the Peer-to-Peer pattern, individual components known as peers can function as
both clients and servers, dynamically changing roles. It is used in file-sharing
networks, multimedia protocols, and blockchain-based products.
9 The Model-View-Controller pattern divides interactive applications into model, view,
and controller parts to separate core functionality, user display, and input handling.
Web frameworks like Django and Rails are based on this pattern.
10 The Interpreter Pattern is used to interpret programs written in a specific language by
evaluating sentences or expressions. It is commonly used in database query languages
such as SQL.

You might also like