vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Idioms and Patterns polymorphism -- inheritance and delegation idioms -- realizing concrete types patterns -- a catalogue of design patterns events -- the reactor pattern Additional keywords and phrases: generic types, assertions, canonical classes, event-driven computation
vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie A catalogue of design patterns Subsections: Creational Patterns Structural Patterns Behavioral Patterns
vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie A Catalogue of Design Patterns a common design vocabulary documentation and learning aid an adjunct to existing methods a target for redesign
vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie The Pattern Schema Name - handle increases design vocabulary Problem - when to apply explains the problem and the conflict Solution - general arrangement design, responsibilities, collaborations Consequences - tradeoffs to understand the costs and benefits
vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Causes for Redesign creating an object by specifying a class explicitly -- Abstract Factory, Factory Method, Prototype dependence on specific operations -- Chain of Responsibilty, Command dependence on hardware & software platforms -- Abstract Factory, Bridge dependence on object implementation or representation --Abstract Factory, Bridge, Memento, Proxy design for change
vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie algorithm dependence -- Iterator, Strategy, Template Method, Visitor extending functionality by subclassing -- Bridge, Composite, Decorator, Observer tight coupling -- Abstract Factory, Bridge, Chain of Responsibilities, Command, Facade, Mediator, Observer inability to alter classes conveniently -- Adaptor, Decorator,
vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Creational Patterns
vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Creational Patterns Factory -- hide concrete classes Factory Method -- virtual constructors Prototype -- dynamic creation by cloning Singleton -- one instance only
vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Structural Patterns Pattern Alias Remarks Composite part/whole collections of components Flyweight part/whole* extrinsic state, many objects Adaptor wrapper resolves inconsistencies Bridge handle/body abstraction to implementation Decorator wrapper to introduce functionality Facade wrapper* provides unified interface Proxy surrogate to defer... remote, virtual, protection object and class composition
vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Behavioral Patterns cooperation algorithms and the assignment of responsibilities between objects class Template Method -- the skeleton of an algorithm Interpreter -- to evaluate expressions object composition Mediator -- provides indirection Chain of Responsibility -- connect objects to interact Observer -- to handle dependencies
vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Encapsulating behavior Command -- action + undo Strategy -- choice of algorithms Visitor -- decouple traversal and operations Iterator -- access and traversal State -- object state -> behavioral change objectify!
vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie The Observer Pattern Observer one-to-many dependencies and notification Consequences abstract coupling between subject and observer constraint propagation deals with unexpected updates
vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie