Design and Architectural Patterns Flashcards
Architectural design working definition
high-level structural decisions about a system.
Architectural styles
High-level abstractions guiding the overall organisation of a system.
e.g. client/server, pipes and filters, microservices
Architectural patterns
detailed solution to recurring architectural problems within a specific style
e.g. model view controller (MVC), onion architecture
Design patterns
Specific solutions to recurring design problems at a lower level than architectural patterns, e.g. adapter, bridge, strategy, composite
Patterns are ways to describe best practices, good design, and capture experience
in a way that is possible for others to reuse this experience.
Layered architecture description
Architectural style.
Organises the system into layers with related functionality
associated with each layer. For example, a presentation layer would be responsible for handling all user interface and browser communication logic. The presentation layer doesn’t need to know or worry about how to get customer data; it only needs to display that information on a screen in particular format.
Advantages of layered architecture
Allows replacement of entire layers so long as the interface is maintained.
Redundant facilities (e.g. authentication) can be provided in each layer to increase the dependability of the system.
Disadvantages of layered architecture
Providing a clean separation between layers is often difficult and a high-level layer may have to interact directly with lower-level layers rather than through the layer immediately below it.
Performance can be a problem because need to be processed at each layer.
Pipes and filters architecture description
Architectural pattern.
Processing of the data in a system is organised so that each processing component (filter) is discrete and carries out one type of data transformation. The data flows (as in a pipe) from one component to another for processing.
Pipes and filters architecture advantages
Easy to understand and supports transformation reuse.
Workflow style matches the structure of many business processes.
Evolution by adding transformations is straightforward.
Can be implemented as either a sequential or concurrent system.
Pipes and filters architecture disadvantages
The format for data transfer has to be agreed upon between communication transformations.
Each transformation must parse its input and unparse its output to agreed form –> increases system overhead and may mean that it is impossible to reuse functional transformations that use incompatible data structures.
Model-view-controller (MVC) description
Separates presentation and interaction from the system data.
Structured into three logical components that interact with each other.
Model: manages the system data and associated operations on that data.
View: defines and manages how the data is presented to the user.
Controller: manages user interaction (e.g. key presses, mouse clicks, etc.) and passes these interactions to the View and the Model.
Model-view-controller when used
Used when there are multiple ways to view and interact with data.
Model-view-controller 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.
Model-view-controller disadvantages
Can involve additional code and code complexity when the data model and interactions are simple.
The design patterns can be categorised into three, what are they? and explain them
Structural patterns:
Simplify the composition of classes and objects to form larger structures.
Behavioural patterns:
Address communication between objects by defining how objects interact and distribute responsibilities.
Creational patterns:
Deal with the process of object creation, providing flexibility and reusability in creating objects.