2/10/15 1
1
Design Patterns
Composite, Visitor, Template Method, Façade, Adapter Examples from Eclipse
cs361
Today’s goals
❚ What are Design Patterns? ❚ Announcements:
❙ Thank you for your Early Informal Feedback ❙ HW3 – Phase 2, peer reviews due this Thu at 5pm
cs361 2 cs361 3
How to Design
❚ Problem
❙ Model the problem, analysis, requirements
❚ Patterns
❙ Remember similar solutions
❚ Patch
❙ Test and fix, repair
Defining Patterns
Design Patterns – expert solutions to recurring problems in a certain domain Description usually involves problem definition, driving forces, solution, benefits, difficulties, related patterns. Pattern Language - a collection of patterns, guiding the users through the decision process in building a system Patterns are related (high level-low level)
4
Definition
- we get hungry every lunch hour.
- usually around 11:30am – 1:00pm.
- must resolve hunger.
Driving Forces
- appetite, intensity of hunger,
nearby restaurants Solution
- eat at nearest restaurant that satisfies
minimum appetite requirement. Benefits
- hunger is resolved
Difficulties
- must not fall asleep afterwards.
Related Patterns
- dinner, breakfast, brunch, and snack
Example Design Space
“Lunch” Pattern “Eat” Pattern Language
Wake-Up Breakfast Lunch Dinner Brunch
5 cs361 6