Design Patterns
Download
Report
Transcript Design Patterns
Design Patterns
Introduction
What is a Design Pattern?
Why were they developed?
Why should we use them?
How important are they?
How easy are they to use?
Resources
[email protected]
Design Patterns
What is a Design Pattern?
When programming complex systems, some
problems arise again and again.
Programmers build up expertise and
experience of solving these problems.
A design pattern can be thought of as an
encapsulation of programming “best practice”.
Languages like Java already incorporate
some design patterns into their structure.
[email protected]
Design Patterns
What is a Design Pattern?
A design pattern is not necessarily a single
chunk of code (detailed implementation).
It may be a style, an approach to solving a
problem (architecture).
It may be the “best” approach - one that
experience has shown to be efficient, reliable,
scalable and so on.
Many patterns come with UML documentation.
[email protected]
Design Patterns
What is a Design Pattern?
“Design patterns constitute a set of rules
describing how to accomplish certain tasks in
the realm of software development.” (Pree,
1994)
“Design patterns focus more on reuse of
recurring architectural design themes, while
frameworks focus on detailed design… and
implementation.” (Coplien & Schmidt, 1995).
[email protected]
Design Patterns
What is a Design Pattern?
“A pattern addresses a recurring design
problem that arises in specific design
situations and presents a solution to it”
(Buschmann, et. al. 1996)
“Patterns identify and specify abstractions that
are above the level of single classes and
instances, or of components.” (Gamma, et al.,
1993)
[email protected]
Design Patterns
Why were they developed?
Attempts to make programming into an
engineering discipline rather than an art form.
Can help to keep costs low.
Brings reliability through good design.
Speeds development cycles since no need to
“reinvent the wheel”.
Helps with maintenance (patterns may get
updated).
[email protected]
Design Patterns
Why should we use them?
Design Patterns should help us achieve our
development goals with less effort.
Communities of programmers will have
familiarity with common patterns.
Modern languages incorporate some patterns
at the API level, for example the Java media
loading and event handling systems.
[email protected]
Design Patterns
How important are they?
In some areas (finance, engineering, user
interface design) they are very useful and
widely used.
For some small, ad-hoc, single-developer
projects, most of the more complex and
specialised design patterns may not have
much impact.
[email protected]
Design Patterns
How easy are they to use?
Some design patterns are very simple to use,
others are complex solutions to specific,
complex problems.
You probably use some already – the Swing
graphics framework is based in part on wellknown design patterns.
They are well documented and explained.
Books of patterns exist – a limited number of
patterns have been found
[email protected]
Design Patterns
Resources
Design Patterns Java Companion (free book in PDF format):
http://www.patterndepot.com/put/8/JavaPatterns.htm
Example patterns with explanatory text, Antonio García:
http://www.exciton.cs.rice.edu/JavaResources/DesignPatterns/defa
ult.htm
Sun J2EE Patterns: http://java.sun.com/blueprints/patterns/
Java Design Patterns 201: http://www106.ibm.com/developerworks/edu/j-dw-javapatt2-i.html
Core J2EE Patterns (book on Amazon)
Important book: Design Patterns by Gamma, Helm, Johnson and
Vlissides (Addison Wesley Longman, 1995. ISBN 0-201-63361-2)
Interesting review of the above book here.
[email protected]
Design Patterns
Conclusion
Design patterns are worth using in many
circumstances.
You will have to invest some time in order to
understand them and absorb the implications
of this style of programming.
For corporate developers, design patterns
represent a resource of expertise that cannot
be ignored.
[email protected]