design patterns: elements of reusable object- orientated software gamma, helm, johnson, vlissides...

7
Design Patterns: Elements of Reusable Object-Orientated Software Gamma, Helm, Johnson, Vlissides Presented By: David Williams

Upload: elaine-davis

Post on 18-Jan-2016

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Design Patterns: Elements of Reusable Object- Orientated Software Gamma, Helm, Johnson, Vlissides Presented By: David Williams

Design Patterns: Elements of Reusable Object-

Orientated SoftwareGamma, Helm, Johnson, Vlissides

Presented By: David Williams

Page 2: Design Patterns: Elements of Reusable Object- Orientated Software Gamma, 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

Page 3: Design Patterns: Elements of Reusable Object- Orientated Software Gamma, Helm, Johnson, Vlissides Presented By: David Williams

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

Page 4: Design Patterns: Elements of Reusable Object- Orientated Software Gamma, Helm, Johnson, Vlissides Presented By: David Williams

Motivations Behind Patterns

• Classes are not types

• Class vs. interface inheritance

• Program to an interface, not an implementation

Page 5: Design Patterns: Elements of Reusable Object- Orientated Software Gamma, Helm, Johnson, Vlissides Presented By: David Williams

How do Patterns Encourage Reuse?

• Inheritance vs. composition– White-box reuse vs. black-box reuse– Open-Closed Principle

• Inheritance vs. parameterized types

• Delegation

Page 6: Design Patterns: Elements of Reusable Object- Orientated Software Gamma, Helm, Johnson, Vlissides Presented By: David Williams

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

Page 7: Design Patterns: Elements of Reusable Object- Orientated Software Gamma, Helm, Johnson, Vlissides Presented By: David Williams

Conclusion

Using design patterns can:Facilitate communication and

understanding within a development teamIncrease the reuse of softwareAllow for software to be more easily

modified