Software Architecturev
Software Architecturev
Software Architecture 2
1. Layered pattern
2. Client-server pattern
3. Master-slave pattern
4. Pipe-filter pattern
5. Broker pattern
6. Peer-to-peer pattern
7. Event-bus pattern
8. Model-view-controller pattern
9. Blackboard pattern
10. Interpreter pattern
1. Layered pattern
This pattern is also known as n-tier architecture pattern.
It 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.
Usage
General desktop applications.
E commerce web applications.
Common layers of a general information
systemlayer (also known as UI layer)
Presentation
Application layer (also known as service layer)
Business logic layer (also known as domain layer)
Data access layer (also known as persistence layer)
Layered patte
rn
• Different levels of
abstraction
• Requests go down,
notifictions go back up
• Possible to define stable
interaces between layers
• May add or change layers
over time
Layered patte
rn Solution
Start with the lowest later
Build layers on top
Use same level of abstraction within each
layer
Componenets cannot spread over two layers
Keey lower layers lean
Specify interfaces for each layer
Handle errors at the lowest level possible
2. Client-server pattern
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).
4. Pipe-filter pattern
Usage
Compilers. The consecutive filters perform lexical analysis, parsing,
semantic analysis, and code generation.
Workflows in bioinformatics.
Pipes eliminate need for intermediate files
Can replace filters easily
Can achive different effects through recombination
İf data stream format is standard, filters ay bbe developed independently
Parallelization possible
Data Stream processing may be subdivided into stages
May recombine stages
Non adjacent stages do not share information
May desire different stages to be on different processors
Standardized data structure between stages
5. Broker pattern
Usage
Message broker software such as Apache ActiveMQ, Apache Kafka,
RabbitMQ and JBoss Messaging.
6. Peer-to-peer pattern
Usage
File-sharing networks such as Gnutella and G2)
Multimedia protocols such as P2PTV and PDTP.
Proprietary multimedia applications such as Spotify.
7. 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
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 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.
9. 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.
Problem solvers work independently on part of the problem
Share common data structure
Central controller manages access to the blackboard
Blackboard may be strcured in levels of abtraction to allow work
at different levels
Blackbpard contain original input and partial solutions
Difficult to test
Difficult to guarantee an optimal solution
Control strategy often heuristic
May be computationally expensive
Parallelism possible
10. 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.