design patterns: elements of reusable object- orientated software gamma, helm, johnson, vlissides...
TRANSCRIPT
Design Patterns: Elements of Reusable Object-
Orientated SoftwareGamma, Helm, Johnson, Vlissides
Presented By: David Williams
What is a Design Pattern?
• Created by Christopher Alexander
• Abstracts the key aspects of a common design structure
• MVC is an early example of design pattern use
Why Use Design Patterns?
• Gives developers a common language to use to discuss software design
• Helps:– Determine object granularity– Specify object interfaces– Specify object implementation– Encourage reuse
Motivations Behind Patterns
• Classes are not types
• Class vs. interface inheritance
• Program to an interface, not an implementation
How do Patterns Encourage Reuse?
• Inheritance vs. composition– White-box reuse vs. black-box reuse– Open-Closed Principle
• Inheritance vs. parameterized types
• Delegation
Designing For Change
Don’t: Create an object by specifying its
class Depend on specific operations Depend on object implementations Depend on a specific algorithm Extend functionality by subclassing
Conclusion
Using design patterns can:Facilitate communication and
understanding within a development teamIncrease the reuse of softwareAllow for software to be more easily
modified