Download - Using Design Patterns in Real Projects
![Page 1: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/1.jpg)
Using Design Patterns in
Real Projects
-Andy Bulka
2002
http://www.andypatterns.com
![Page 2: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/2.jpg)
Using Patterns in Real Projects
• What is it like to use design pattern in real
life programming?
• Do the sometimes academic patterns
translate into the real world?
• The answer is yes – I will back this up with
three examples of where I have used
patterns in real world projects.
![Page 3: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/3.jpg)
Overview
• Patterns - Definitions
• Patterns Example
• My personal definition and approach to
patterns
• Commercial Projects using patterns
• Patterns I have written
• Links, Patterns Groups in Australia
![Page 4: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/4.jpg)
What are Patterns?
• Patterns are conventions for describing and
documenting recurring design decisions
within a given context, in software design &
engineering.
• A problem/solution pair given a standard
name.
• A pattern is documented using a standard
format which includes a sample UML
diagram of a typical solution.
![Page 5: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/5.jpg)
Example - Adapter Pattern
• Convert the interface of a class into another
interface clients expect.
• Adapter lets classes work together that
couldn't otherwise because of incompatible
interfaces.
![Page 6: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/6.jpg)
Adapter - two solutions
and one based on multiple inheritance
Adapter comes in two variants; one
making use of delegation:
![Page 7: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/7.jpg)
Design Patterns Book
The
"Bible" of
Design
Patterns
![Page 8: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/8.jpg)
Pattern Format
• Pattern templates typically contain:
• Name
• Intent / Motivation
• Problem
• Context & Forces
• Solution
• Consequences
![Page 9: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/9.jpg)
To Record Experience...
Anecdote
- working
alone...
![Page 10: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/10.jpg)
To Share Experience...
![Page 11: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/11.jpg)
Personally I think Patterns are
• Share and document experience
• Great as a vocabulary between
programmers and design tool
• Like problem / solution pairs
• Just a name for a new „thick/non-obvious‟
concept? A „distinction‟.
• Later patterns become common terms.
![Page 12: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/12.jpg)
Commercial Projects
Educational Reasoning Software
Payroll System
War Game
![Page 13: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/13.jpg)
Reason 2 - Melb University
• Mentor in Delphi & OO
• Patterns where possible
• Model - „cauldron of creation‟. Composite.
• Command, Template, Strategy for
persistence, Adaptor incl. delegation via a
pointer “this is an important idiom”
• Model View Controller variation MGM.
Hooking up a standard Windows GUI
treeview to model.
![Page 14: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/14.jpg)
Reason 2 - UML
There are
several
design
patterns in
this UML
diagram.
P.S. In
later years
I became
interested
in how to
explicitly
represent
patterns in
UML
diagrams..
![Page 15: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/15.jpg)
Reason!Able www.goreason.com
![Page 16: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/16.jpg)
Game - 2D wargame
• Python
• SDL graphics (pyGame)
• Single and Multiplayer over internet
• Game AI
• Lots of pieces Moving
• Scrolling map
![Page 17: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/17.jpg)
Game - Preparation
• Starting a new project in a new domain - I
wanted to know what best practices were.
• “Game patterns” on the web documented
best practices, tips and tricks and useful
rules of thumb and mini designs.
• Melb Patterns Group presentation
• Patterns used so far - MVC, Façade,
Singleton, MGM, Mediator, RM, TI, Null
Object, Adaptor, Strategy, Observer, State.
![Page 18: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/18.jpg)
Game Patterns as UML
![Page 19: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/19.jpg)
Game so far
![Page 20: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/20.jpg)
Game Gems & AI Wisdom book
• Patterns vs. “Gems”
• Patterns vs. “Problem / Solution pairs”
• Still talk about forces and consequences and
trade-offs, though not as formal section
headings.
• Some sections not strictly suited to being a
pattern, instead they talk about
optimisations or more specific issues.
![Page 21: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/21.jpg)
Payroll System
• Delphi project
• Experienced content expert
• Was a payroll patterns paper at KoalaPlop
2002
• See also “Business Modelling in UML” by
Eriksson & Penker - “Business Patterns at
Work”.
• Transformation Interface Pattern (Gui and
DB versions)
![Page 22: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/22.jpg)
Australian Patterns Conference
![Page 23: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/23.jpg)
Venue
The Country Place Conference
Centre
Location: The Dandenongs
International visitors
![Page 24: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/24.jpg)
Patterns I have written for the conference
• Model Gui Mediator
• Relationship Manager
• Transformation Interface
See www.andypatterns.com
![Page 25: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/25.jpg)
Plop Conference Proceedings
![Page 26: Using Design Patterns in Real Projects](https://reader034.vdocuments.net/reader034/viewer/2022042623/55283e19550346eb6e8b4723/html5/thumbnails/26.jpg)
Links
• KoalaPLoP is hosted in Melbourne
http://www.mcs.vuw.ac.nz/~kplop
• Melbourne Patterns Group
http://www.melbournepatterns.org