introduction
DESCRIPTION
Object-oriented analysis and design(OOAD) and Design Pattern Slides UML Slides. for more slides refer www.scmGalaxy.comTRANSCRIPT
Design Patterns
Introduction to GOF - Design Patterns
Main Objective
• Motivation
• Design patterns
• Classification
• Selected Patterns
• Selecting and Using Design Patterns
Introduction to GOF - Design Patterns
Motivation
To develop reusable software
To reduce the depth of Class hierarchy
To develop high cohesive classes
Introduction to GOF - Design Patterns
Patterns Background
• What is a Pattern ?– A pattern is an abstract concrete form which keeps
recurring in specific contexts
“Patterns = Problem/solution pairs in a context”– Patterns capture the static and dynamic structure and
collaboration among key participants in software designs
– Patterns facilitate reuse of successful software architectures and designs
Introduction to GOF - Design Patterns
Qualities of Software Pattern
• Encapsulation and Abstraction
• Inheritance & composability
Introduction to GOF - Design Patterns
Reuse Types
• Source code
• Executables
• Object code
• Personnel
• Design
Introduction to GOF - Design Patterns
Approaches of Reusability
• Library routines• Overloading• Generic code / structures• Black box reuse ( composition )• White box reuse ( inheritance )• Toolkits: architecture independence• Frameworks: rigid architecture• Patterns: Problem, context & solution
Introduction to GOF - Design Patterns
Toolkits
• Often an application will incorporate classes from one or more libraries of predefined classes called toolkits.
• Set of related and reusable classes,Designed to provide useful general purpose functionality– E.g.: Set of classes for Lists, associative tables, stacks.
Introduction to GOF - Design Patterns
Framework
• Frameworks provide domain specific functionality- e.g. business application, telecommunication application, window system, distributed applications etc.
• It is semi-complete applications
// complete applications are developed by inheriting form and instantiating parameterized framework components
• Set of co-operating classes that make up a reusable design for a specific class of software systems
– Graphical editors for Multimedia domains like artistic drawing , music composition and CAD
– Compilers for different programming language and target machines
Introduction to GOF - Design Patterns
Framework
• Dictates architecture
• Captures design decisions common to application domain
• Emphasizes design reuse over code reuse
Introduction to GOF - Design Patterns
OO Frameworks
Introduction to GOF - Design Patterns
Frameworks v/s Design Patterns
Design patterns are more abstract than frameworks.- frameworks can be embodied in code but examples of patterns can be embodied in code
Design patterns are smaller architectural elements
than frameworks.
- a typical framework contains several design patterns, but the reverse is never true
Design patterns are less specialized than frameworks. – patterns are independent of application
Introduction to GOF - Design Patterns
Introduction to GOF - Design Patterns
Design Patterns Description• Description of communicating objects and classes,
their roles and collaborations, and the distribution of responsibilities.
• customized to solve a general design problem in a particular context
• names, abstracts and identifies key aspects of a common design structure– useful for creating reusable object oriented design
• Focuses on a particular object oriented design problem or issue
Introduction to GOF - Design Patterns
Essential Element• Name• Problem• Solution• ConsequencesDocumentation & illustration Purpose
– Intent– Motivation– applicability– structure– Consequences– Sample Code
Introduction to GOF - Design Patterns
Classification
Purpose– Creational- concern process of object creation– Structural- deal with composition of classes or object– Behavioral- characterize ways in which classes or
objects interact and distribute responsibility
Scope– class– object
Introduction to GOF - Design Patterns
Design Pattern space
Introduction to GOF - Design Patterns
Session No Name Type
Session 1Factory MethodCreational
Session 2StrategyBehavioral
Session 3DecoratorStructural
Session 4CompositeStructural
Session 5IteratorBehavioral
Session 6Template MethodBehavioral
Session 7Abstract FactoryCreational
Introduction to GOF - Design Patterns
Session No Name Type
Session 8BuilderCreational
Session 9SingletonCreational
Session 10 Proxy Structural
Session 11 Adapter Structural
Session 12 Bridge Structural
Session 13 Mediator Behavioral
Session 14 Observer Behavioral
Introduction to GOF - Design Patterns
Session No Name Type
Session 15 Chain of Responsibility Behavioral
Session 16 Memento Behavioral
Session 17 Command Behavioral
Session 18 Prototype Creational
Session 19 State Behavioral
Session 20 Visitor Behavioral
Session 21 Facade Structural
Session 22 Flyweight Structural
Introduction to GOF - Design Patterns
Patterns concluding
I am top of the world!!
Introduction to GOF - Design Patterns
Introduction to GOF - Design Patterns
Introduction to GOF - Design Patterns
Selecting a Design Patterns
• Consider how design patterns solve design problem
• Scan intent section• Study how patterns interrelate• Study patterns of like purpose• Consider what should be variable in your
design• Examine a case of Redesign
Introduction to GOF - Design Patterns
Summary
• Reusable elements in a design
• Recurring similarity
• Increase representational power
• Favour object composition over class inheritance
• Delegation of an underlying principle
• Use Design Patterns whenever possible