Patterns and Frameworks: Purpose of This Lecture
Patterns and Frameworks: Purpose of This Lecture
Patterns and Frameworks: Purpose of This Lecture
1
18 - Patterns and Frameworks
Application Framework
2
18 - Patterns and Frameworks
3
18 - Patterns and Frameworks
Event-Driven Execution
program main
begin
initialise application;
while not finished do
begin
if user has done something interesting
respond to it
end;
clean up application;
end
4
18 - Patterns and Frameworks
Application frameworks
» Allows the programmer to carry whole algorithms
from one project to the next, is designed to help
solve a narrow range of problems
» High-level details are shared, while traditional
libraries only permit sharing low-level functions
» Frees the designer from much work, but narrows
the range of variation by laying out the overall
design (e.g. single window applications).
» Inheritance is the primary technique to specialise
framework
OOP - Carine Lucas 18- 9
Design Patterns
5
18 - Patterns and Frameworks
Background
A Design Pattern
6
18 - Patterns and Frameworks
7
18 - Patterns and Frameworks
Practical Experience
8
18 - Patterns and Frameworks
» Purpose
» Creational
» Structural
» Behavioural
» Scope
» Class
» Object
Bridge
» Object Structural
» Intent: Decouple an abstraction from its
implementation so that the two can vary
independently
» Motivation: Window Implementations
9
18 - Patterns and Frameworks
Bridge: Motivation
Imp
Window WindowImp
DrawText() DrawText()
DrawRect DrawRect
Bridge: Applicability
10
18 - Patterns and Frameworks
Bridge: Participants
Bridge: Structure
Client
Abstraction Implementor
imp
Operation() OperationImp()
ConcreteImpA ConcreteImpB
11
18 - Patterns and Frameworks
Bridge: Consequences
Conclusion
12