System Design Patterns Flashcards
WHat can be represented by a class?
- real-world, external entities
- information entities
- abstract ‘metahpors’ and ideas
What are the 3 main design principles to aim for?
- Distribtuion of behaviours (decentralisation)
- Even granularit (components to have similar levels of complexity)
- Loose coupling (objects can be reused in another context)
Briefly describe CRC Card prototyping
+ low tech strategy for prototyping useful object concepts
+ flexible; allows the concept set to change
How do we write a CRC card? 3 steps
- Name concept accroding to main purpose
- Identify (up to 7) responsibilities: knowing, doing, enforcing (physical size constraints force decomposition)
- Identify collaborators (classes on which this one depend)
What do we put on the reverse side of a CRC card?
- categorise the card
- attributes (no remote get/set methods)
- constraints (business rules for attributes)
What are 3 ways to split a CRC card?
- 2 peer concepts; if responsibilties handle disjoint subset of attributes or collaborators.
- Parent-child concepts; if some responsibilties handle a subset of attributes or collaborators
- Subcontractor concepts; no obvious splitting move
Why focus on responsibilty for Responsibilty-Driven Design?
want to identfy objects which bear some responsibility for the system
- better than passive records which ancapsulate data
- better than abstract data types with just set/get methods
What are 3 methods of Transformation to reorganise communication-paths between subsystems?
- Delegation
- Encapsulation
- Refactoring
What is a design pattern?
reusable element of object oriented design
ready made solution to common design problems
Describe 3 typical uses of design pattern
- look out for problems in design; apply pattern
- design from scratch using patterns to get high-quality design
- retrofit extensions/adaptionsusing patterns
Describe the Bridge design pattern
reducing a number of specialised variants of a concept by encapsulating one varying dimension inside another
Describe the Mediator design pattern
introduce objects which handle communication between other objects
- removes need to couple objects directly
Describe the Chain of Responsibilty design pattern
give multiple objects the chance to handle a request
pass request along the chain
Describe the Command design pattern
encapsulate a funciton as an object with a single execture method, to add functions to a system incrementally
Describe the State design pattern
allows an object to alter its behaviour when its internal state changes