Chapter 6
Chapter 6
❑ Definitions
❑ Architectural views
❑ Architectural patterns
❑ Design patterns
❑ Application architectures
➢ Architectural design
• how a software system should be organized and
designed
• identifies the main components and relation among
them.
• early stage of agile processes is to design an
overall systems architecture
➢ Output:
• architectural model that describes how the
system components are organized
02/01/2015 Chapter 6 Architectural Design 3
Architectural scale
Application architecture
• Small view of system architecture
• Very abstract
WebApp architecture
Serverless architecture
Performance
▪ Localise critical operations and minimise communications. Use
large rather than fine-grain components.
▪ Use caching whenever possible
▪ Use indexation engine for your queries
Security
▪ Use a layered architecture with critical assets in the inner layers.
▪ Reduce surface attack
▪ Security in all layers
▪ Principle of least priviliges
Safety
▪ Localise safety-critical features in a small number of sub-
02/01/2015
systems. Chapter 6 Architectural Design 12
Architecture and non-functional requirements
Safety
▪ Localise safety-critical features in a small number of sub-
systems.
Availability
▪ Include redundant components and mechanisms for fault
tolerance.
Maintainability
▪ Use fine-grain, replaceable components.
❑ Logical view
▪ The functionality, the services.
▪ UML diagrams: class-diagram, state diagram
❑ Process view
▪ Shows dynamics of the system
▪ Communication between components in runtime
▪ UML diagrams: sequence diagram, activity diagram
❑ Development view
▪ Programmers' perspective
▪ UML diagrams: component diagram, package diagram
❑ Physical view
▪ System engineer point of view
▪ Physical layers and network communication
▪ UML diagrams: deployment diagram
❑ Scenario (+1)
▪ Typical use-case
▪ Connecting views altogether
02/01/2015 Chapter 6 Architectural Design 17
Architectural patterns
❑ Pattern
▪ A template for representing, sharing, and reusing
knowledge
Description Separates presentation and interaction from the system data. The system is
structured into three logical components that interact with each other. The Model
component manages the system data and associated operations on that data. The
View component defines and manages how the data is presented to the user. The
Controller component manages user interaction (e.g., key presses, mouse clicks,
etc.) and passes these interactions to the View and the Model. See Figure 6.3.
Advantages Allows the data to change independently of its representation and vice versa.
Supports presentation of the same data in different ways with changes made
in one representation shown in all of them.
Disadvantages Can involve additional code and code complexity when the data model and
interactions are simple.
Description Organizes the system into layers with related functionality associated
with each layer. A layer provides services to the layer above it so the
lowest-level layers represent core services that
are likely to be used throughout the system. See Figure6.6.
Example Onion architecture in C#
When used Used when building new facilities on top of existing systems; when
the development is spread across several teams with each team
responsibility for a layer of functionality; when there is a requirement
for multi-level security.
Advantages Allows replacement of entire layers as long as the interface is
maintained. Redundant facilities (e.g., authentication) can be provided
in each layer to increase the dependability of the system.
Name Repository
Description All data in a system is managed in a central repository that is
accessible to all system components. Components do not interact
directly, only through the repository.
Example In-memory cache
Message broker
Database tables
FTP share
NoSQL change stream
When used You should use this pattern when you have a system in which large
volumes of information are generated that has to be stored for a
long time. You may also use it in data-driven
systems where the inclusion of data in the repository triggers an
action or tool.
Advantages Components can be independent—they do not need to know of the
existence of other components. All data can be managed
consistently (e.g., backups done at the same time) as it is all in one
place.
Name Client-server
Best for.
• New applications that need to be built quickly
• Teams with inexperienced developers who don’t
understand other architectures yet
Caveats
• Source code can turn into a “big ball of mud” if it is
unorganized
• Code can end up slow thanks to what some developers
call the “sinkhole anti-pattern.” Much of the code can be
devoted to passing data through layers without using any
logic
02/01/2015 Chapter 6 Architectural Design 34
Event-driven architecture
Best for.
• Asynchronous systems with asynchronous data flow
• User interfaces
Caveats
• Debugging and error handling can be difficult to structure
• Messaging overhead can slow down processing speed
• Developing a systemwide data structure for events can be
complex
• Testing is complex
Micro-services architecture
Best for.
• Application with well-defined boundaries
• Rapidly developing new businesses and web applications
• Development teams that are spread out
Caveats
• Performance can suffer when tasks are spread out
between different microservices
• Too many microservices can confuse users as parts of the
web page appear much later than others