Download presentation
Presentation is loading. Please wait.
Published byLesley Mills Modified over 9 years ago
1
Design Patterns
2
1 Paradigm4 Concepts 9 Principles23 Patterns
3
1 Paradigm Object-Orientation is good! Not every- body agrees…
4
4 Concepts The foundations of Object- Orientation Abstraction Encapsulation Inheritance Polymorphism
5
9 Principles Just knowing the four concepts does not make you a good software designer… Provide no guidance to design decisions Concepts are made operational through a set of of principles for good Object- Oriented design
6
9 Principles Isolate the aspects of your application that vary Program to an interface, not an implementation Favor composition over inheritance Strive for loosely coupled designs between interacting objects Classes should be open for extension, but closed for modification Depend upon abstractions, not upon concrete classes Principle of Least Knowledge – only talk to your closest friends The Hollywood principle – don’t call us, we’ll call you A class should only have one reason to change
7
9 Principles Where do the principles come from…? Accumulated wisdom, learned from solving real- life design problems Some obvious… Some not-so-obvious… Some overlapping…
8
9 Principles Principles can be used operationally when designing; as guidelines and sanity check What problems are we solving when designing software…? Examined by the ”Gang of Four” in the 90’es Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides
10
23 Patterns Authors examined a large base of high- quality code, to identify how common software design problems were solved No theoretical work; pattens are discovered, not invented 23 common strategies for solving design problems were identified, and dubbed design patterns
11
23 Patterns Design patterns fall in three categories – Creational: How are objects created – Structural: How are objects combined – Behavioral: How do objects interact
12
23 Patterns Creational patterns – Singleton – Prototype – Builder – Factory Method – Abstract Factory
13
23 Patterns Structural patterns – Adapter – Bridge – Composite – Decorator – Facade – Flyweight – Proxy
14
23 Patterns Behavioral patterns – Chain of responsibility – Command – Interpreter – Iterator – Mediator – Memento – Observer – State – Strategy – Template Method – Visitor
15
Design Patterns Are distilled knowledge Learned from practical experience Solve a problem in a given context Provides a common vocabulary Is not the solution to all SW design issues… …but almost
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.