Chapter 13 - Patterns and Tactics Flashcards
what is a pattern?
it establishes a relationship between a context, a problem, and a solution
What is a pattern context?
a recurring, common situation in the world that gives rise to a problem
what is a pattern problem
the issue that arises in the given context
what is the pattern solution?
a successful architectural resolution to the problem appropriately abstracted
4 aspects that describe a pattern
- a set of elements
- a set of interactions
- a topological layout of components
- a set of semantic constraints
Layer Pattern: context
there is a need for a clear separation of concerns so that modules of a system may independently developed and maintained
Layer Pattern: problem
the SW needs to be segmented in a way such that modules can be evolved separately with little interaction among parts
Layer Pattern: solution overview
divide software into layers.Each layer contains a cohesive set of services. There is a unidirectional allowed-to-use relation among the layers
Layer Pattern: solution elements (1)
layer
Layer Pattern: solution relations (between elements)
allowed-to-use
Layer Pattern: solution constraints
- each piece of SW only in 1 layer
- must be at least 2 layers
- allowed-to-use relation cannot be circular
Layer Pattern: solution weaknesses
- the addition of layers adds up-front cost and complexity
- additional layers have a performance penalty
Broker Pattern: context
many system are a collection of distributed services. How do several system like this connect to each other and exchange info
Broker Pattern: solution problem
how to structure distributed software so that users do not need to know the nature and location of service providers
Broker Pattern: solution overview
it defines a broker that mediates communication between a number of clients and servers (all communication from client to server goes through broker)
Broker Pattern: solution elements (5)
client - requester of services
server - provider
broker - intermediary
client-size proxy- an intermediary that manages the communication from the clients and forwards that info to broker
server-side proxy- same as above but for server
Broker Pattern: solution relations
the attachment relation associates clients and servers with brokers
Broker Pattern: solution constraints
client and server call only attach to the broker
Broker Pattern: solution weaknesses (5)
- broker adds latency and can become a communication bottleneck
- broke can be single point of failure
- broker add up front complexity
- broker can be target of security attacks
- broker hard to test
Model-View-Controller: context
the UI needs to change often. as the user looks at data it should reflect that data’s current state
Model-View-Controller: problem
how to make interface functionality separate from application functionality and yet still be responsive to user input and/or changes to the data
Model-View-Controller: solution overivew
breaks the system functionality down into 3 components: a model, a view, and a controller
Model-View-Controller: elements
model- represents the app data or state and contains app logic
view - UI component
controller - translates user actions into changes in the model or changes to the view
Model-View-Controller: relations
the notifies relation
connects instances of model, view, and controller notifying elements of relevant state changes
Model-View-Controller: constraints (2)
need at least one model, view, and controller
model should not interact directly with controller (no method calls or events to controller from model)
Model-View-Controller: weaknesses (2)
- complexity not worth it for simple UI
- model, view, and controller abstractions may not be good for some UI toolkits
Pipe and Filter Pattern: context
many system need to repeatedly transform streams of discrete information.
Thus we want certain types of transformations to be reusable pieces
Pipe and Filter Pattern: problem
this kind of system needs to be divided into reusable loosely coupled components with simple, generic interaction mechanisms