Softwre architecture Flashcards
Software architecture
Fundamental organization of a system embodied in its components, their relationship to each other and the environment and the principles governing its design and evolution
How components of a system communicate, constraints that rule the whole system
What are the 3 main parts of software architecture
1)Architectural patterns
2)Messages + API
3) Quality attributes
Architectural views
Context view
Functional View
Information view
Concurency view
Development view
Deployment view
Operational View
what is context view?
System scope and responsabilities
Expternal services and responsabilities
External Interface-API Specifications
What is informational view
How system stores manipulate manages distributes info
What is Functional view
Breaking system into high-level components
Defining interfaces
Describing interactions between components
How to represent architecture Context view
C4- Context Diagram
Are component , interface dependency
Lollipop notation- main interface of each component– The sockets (-c) denote the interfaces the component
requires (input)
– The lollipops (-o) denote the interfaces a given component
provides (output)
Merge a component into its only client. If you have a
component that is a server to only one other component,
you may decide to combine the two components.
Highly coupled classes belong
in the same component.
* Minimize the size of the message
flow between components
UML Sequence diagram
- Shows the sequence for a particular action in
the system - (Semi-)Detailed description of a particular
scenario - Highlights interactions between actors and the
components of your system - Sequence Diagrams (at a high level of
abstraction) can be used to support
requirements engineering and high-level
design - Sequence Diagrams (at a lower level of
abstraction) can be useful for documentation
purposes for developers
Be able to read and create sequence diagrams
– Lifeline, Destruction
– Synchronous message, Response message
– Combined fragments: Alt, Loop, Break
– We will not use other elements
Activity diagrams
UML Activity Diagram
* Show the activities involved in a process or
data processing
* In some cases better alternative to sequence
diagram
More useful for requirements elicitation and/or
implementation (tomorrow) than for designing
architecture
Be able to read activity diagrams
– Action, Edge, Object node
– Initial node, Activity Final node, Decision node, Merge
node, Parallelization node, Synchronization node
– We will not use other elements
Explain Client and Server Pattern
Server hosts, delivers and manages most
resources and services to be consumed by the
client. Multiple client computers connect to a
central server over a network (e.g. the internet).
The server does not know the
number or identities of clients
Clients know the server’s identity
Connectors are RPC-based
network interaction protocols
(RPC = Remote Procedure Call)
Client and Server are different processes with
well-defined interface
Client and Server have different roles
– Server provides the service; it has the business logic
– Client (usually) cannot be fully trusted
- Advantages
– Scalability: often easy to scale horizontally by
deploying more servers (with load balancers)
– Reusability: General functionality can be available to
all clients and does not need to be implemented by
all services - Disadvantages
– Reliability: Each service is a single point of failure
– Preformance: may be unpredictable (network
influence)
Explain what Layered Architecture is
This pattern is used for systems that can be decomposed into groups of layers, each of which is at a particular level of abstraction.
Each layer
provides services to the next higher layer and consumes services from the lower layer (least knowledge principle).
Each component exposes an interface to be used by the layer above
Each component sees the layer below (in the hierarchy) as one single opaque layer
(virtual machine)
For example, Layer 2 provides an API for Layer 1 and it uses the API of the layer 2
Every module (e.g., class or package) must be allocated to one and only one layer.
The API to the adjacent (higher) layer can be implemented using the Facade or the Proxy design patterns.
Using a Proxy or a Facade depends on the context (do we need to simplify the interface?)
If one of the layer is a legacy system, we could also use the Adapter pattern to manage the APIs
Ex computer networks, operating system
- Advantages
– Testability: we can test each layer in isolation (using mocks and stubs)
– Maintainability: a change in the behaviour of a layer has no effect on the layers below it
– Flexibility: we can exchange one layer (e.g., transport layer) with any alternative layer as long as the new and old layers
implement the same interface - Disadvantages
– Higher complexity: additional abstraction increases the overall
complexity
– Lower performance: one request may pass through all layers in a chain of responsibility to be properly handled by the system
What is MVC
Model-View-Controller (MVC)
* MVC is basically a three-layered architecture
* Commonly used in web development
91
Model-View-Controller (MVC)
* Advantages
– Maintainability: you can make changes to one component without
affecting the others (e.g. data can change independent of
representation)
– Reusability: components can be easily reused (e.g. same view for
different models)
– Flexibility: different representations of the same data
– Testability: possible to test each layer separately (with mocks and
stubs)
* Disadvantages
– Complexity: Additional code and complexity, especially when model
and interactions are simple
– Maintainability: Often easy to “escape” from MVC and do things in
wrong layers (e.g. views triggering database queries directly)
What is pipe and filter pattern
The Pipe-Filter pattern provides a structure for systems that produce a stream of data. Each processing step is encapsulated in a filter component while data is passed through pipes
Pipe: A connector, which transports data from
one filter to the next, preserving the order
Filter: a components that reads data, transforms it, and return the transformed data
Filters must define expected input and produced output (proper API and documentation needed)
Pipes have a single input and output, and do not alter the data in transit
Some variants of this pattern also include the source (where the data comes from) and the sink (the component receiving the final data)
This pattern is often used for data intensive applications, buffering or for synchronisation
- Advantages
– Reusability: possible to build different pipelines by recombining
a given set of filters
– Extensibility: it is very easy to add a new filter
– Testability: filters can be tested separately
– Concurrency: input and output consist of streams; filters start
computing when they receive data (async) - Disadvantages
– Performance: large overhead due to data transformation (and
depending on pipeline length)
– Low responsiveness (latency): not useful for interactive
applications
What is mocroservice arhitecture
- Microservices re-arrange
an application as a
collections of loosely
coupled services. - Each microservice can be
implemented in different
programming languages,
database, hardware and
software environment, etc - Services are small and easily
maintained. - Services are independently
deployable. - Services are independently
scalable. - The microservice architecture
enables teams to be
autonomous. - Advantages
– Modularity: application is divided into small microservices that are easy to maintain, test, understand, etc.
– Scalability: since microservices are implemented and deployed
independently of each other, they can be monitored and scaled independently
– Integration: microservices can be integrated with legacy systems
– Distributed development: different teams can develop different microservices
independently from one another - Disadvantages
– Network overhead: all communications between microservices happen in the
network. Thus, there is higher network latency and message processing time than in-process calls within a monolithic architecture
– Deployment is more complicated
– Security: the more the data in the network the larger the attack surface
– Moving responsibilities between services is more difficult - When to use it
– Large and complex system
– Need for scaling up and down
– Working with multiple software development teams
– Scale of > 500,000 users
– Heterogeneous tech stack - When not to use it
– Small or simple application
– Intensive communication between services
– Inadequate team size or no skills in distributed systems
– Lack of experience with microservices
– Early-stage projects or rapid prototyping
– Data consistency requirements
What is Publish subscribe pattern
Publishers and subscribers are independent
and unaware of each other
* Multiple consumers subscribe to events
published by various producers
Publisher: any component that publishes an event. Specific events published should be
documented
Subscriber: any component that subscribes to an event
Event Bus: responsible for registering component subscriptions and delivering published events (e.g., network protocol
- Publishers and subscribers don’t know of each
others existence - Subscribers receive only a subset of published
messages (the event bus filters) - Advantages
– Reusability: services can be reused to make many applications
– Testability: publishers and subscribers can be tested separately
– Scalability: we can have as many publishers or subscribers as we
want
– Separation of concerns
– Loose coupling: publishers and subscribers are loosely coupled, and
don’t even need to know each other - Disadvantages
– Scalability (bottleneck): all messages travel through same event bus
– Security: all messages are sent through the same event bus
– Availability: did the subscriber receive the requested data?