Reference – Object Oriented Software Development Using Java - Jia COP 3331 Object Oriented Analysis and Design Chapter 10 – Patterns Jean Muhammad.

Slides:



Advertisements
Similar presentations
Creational Patterns, Abstract Factory, Builder Billy Bennett June 11, 2009.
Advertisements

Copyright © Active Frameworks Inc. - All Rights Reserved - V2.0Creational Patterns - Page L4-1 PS95&96-MEF-L11-1 Dr. M.E. Fayad Creationa l Paradigm.
1 Structural Design Patterns - Neeraj Ray. 2 Structural Patterns - Overview n Adapter n Bridge n Composite n Decorator.
DESIGN PATTERNS OZGUR RAHMI DONMEZ.
More Interfaces, Dynamic Binding, and Polymorphism Kirk Scott.
Plab – Tirgul 12 Design Patterns
Fall 2009ACS-3913 Ron McFadyen Composite Pattern Problem: How do we treat a composition structure of objects the same way as a non-composite object? Arises.
Prototype Pattern Creational Pattern Specify the kinds of objects to create using a prototypical instance, and create new objects by copy this prototype.
Nov, 1, Design Patterns PROBLEM CONTEXT SOLUTION A design pattern documents a proven solution to a recurring problem in a specific context and its.
Software Design & Documentation – Design Pattern: Command Design Pattern: Command Christopher Lacey September 15, 2003.
Design Pattern Course Builder Pattern 1 Mahdieh Monzavi AmirKabir University of Technology, Department of Computer Engineering & Information Technology.
1 CS 501 Spring 2008 CS 501: Software Engineering Lectures 17 & 18 Object Oriented Design 3 & 4.
Oct, 16, Design Patterns PROBLEM CONTEXT SOLUTION A design pattern documents a proven solution to a recurring problem in a specific context and.
Design Patterns Based on Design Patterns. Elements of Reusable Object-Oriented Software. by E.Gamma, R. Helm, R. Johnson,J. Vlissides.
The Composite Pattern.. Composite Pattern Intent –Compose objects into tree structures to represent part-whole hierarchies. –Composite lets clients treat.
1 Creational Patterns CS : Software Design Winter /T8.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
1 CS 501 Spring 2007 CS 501: Software Engineering Lectures 17 & 18 Object Oriented Design 3 & 4.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VI Composite, Iterator, and Visitor Patterns.
Linzhang Wang Dept. of Computer Sci&Tech, Nanjing University The Abstract Factory Pattern.
Pattern Abstract Factory
Creational Patterns Making Objects The Smart Way Brent Ramerth Abstract Factory, Builder.
Composite Design Pattern. Motivation – Dynamic Structure.
Design Patterns.
© Spiros Mancoridis 27/09/ Software Design Topics in Object-Oriented Design Patterns Material drawn from [Gamma95] and [Coplien95] Revised and augmented.
Software Components Creational Patterns.
18 April 2005CSci 210 Spring Design Patterns 1 CSci 210.
Object Oriented Software Engineering Chapter 16 and 17 review 2014/06/03.
Unit 4 Object-Oriented Design Patterns NameStudent Number CAI XIANGHT082182A KYAW THU LINHT082238Y LI PENGFEIHT082220L NAUNG NAUNG LATTHT082195L PLATHOTTAM.
CDP-1 9. Creational Pattern. CDP-2 Creational Patterns Abstracts instantiation process Makes system independent of how its objects are –created –composed.
DESIGN PATTERNS Sanjeeb Kumar Nanda 30-Aug What is a pattern? Pattern is a recurring solution to a standard problem Each Pattern describes a problem.
Prototype pattern Participants Prototype (Graphic) – declared an interface for cloning itself ConcretePrototype (EditBox, Slider) – implements an operation.
Builder An Object Creational Pattern Tim Rice CSPP51023 March 2, 2010.
DESIGN PATTERNS COMMONLY USED PATTERNS What is a design pattern ? Defining certain rules to tackle a particular kind of problem in software development.
Billy Bennett June 22,  Intent Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
BEHAVIORAL PATTERNS 13-Sep-2012 Presenters Sanjeeb Kumar Nanda & Shankar Gogada.
Advanced Object-oriented Design Patterns Creational Design Patterns.
Chapter 8 Object Design Reuse and Patterns. More Patterns Abstract Factory: Provide manufacturer independence Builder: Hide a complex creation process.
CS 5150 Software Engineering Lecture 16 Program Design 3.
Overview of Creational Patterns ©SoftMoore ConsultingSlide 1.
The Abstract Factory Pattern (Creational) ©SoftMoore ConsultingSlide 1.
STRATEGY PATTERN By Michelle Johnson. BACKGROUND Behavioral Pattern Allow you to define a family of algorithms, encapsulate each one, and make them interchangeable.
S.Ducasse Stéphane Ducasse 1 Abstract Factory.
Design Patterns Creational Patterns. Abstract the instantiation process Help make the system independent of how its objects are created, composed and.
Abstract Factory pattern Intent Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
Command Pattern. Intent encapsulate a request as an object  can parameterize clients with different requests, queue or log requests, support undoable.
Abstract Factory Pattern
Strategy Design Pattern
Chapter 10 Design Patterns.
Design Patterns Lecture part 2.
Factory Patterns 1.
Software Design and Architecture
More Interfaces, Dynamic Binding, and Polymorphism
Design Patterns with C# (and Food!)
object oriented Principles of software design
Abstract Factory Pattern
Intent (Thanks to Jim Fawcett for the slides)
Object-Oriented Design
Design Patterns - A few examples
Jim Fawcett CSE776 – Design Patterns Summer 2003
CSC 480 Software Engineering
Prototype Pattern 1.
PH Chapter 3 Thanks for the Memory Leaks Pushme-Pullyu (pp
Ms Munawar Khatoon IV Year I Sem Computer Science Engineering
Structural Patterns: Adapter and Bridge
Strategy Design Pattern
Lesson 5: More on Creational Patterns
Creational Patterns.
CSC 480 Software Engineering
Composite Design Pattern By Aravind Reddy Patlola.
Presentation transcript:

Reference – Object Oriented Software Development Using Java - Jia COP 3331 Object Oriented Analysis and Design Chapter 10 – Patterns Jean Muhammad

Reference – Object Oriented Software Development Using Java - Jia Overview Abstract Factory Pattern Prototype Pattern Builder Pattern Command Pattern Adapter Pattern Composite Pattern(8.3.2)

Reference – Object Oriented Software Development Using Java - Jia Abstract Factory Category: Creational Design Pattern Intent: Provide an interface for creating a family of related or dependent objects without specifying their concrete classes Applicability: Use this pattern when – a system should be created independent of its components or products. – a system should be configurable with one of multiple interchangeable families of products. – a family of related products should not be mixed with similar products from different families. – only the interfaces of the products are exposed, while the implementation of the products is not revealed.

Reference – Object Oriented Software Development Using Java - Jia Abstract Factory Participants in the Abstract Factory Pattern: – AbstractFactory – Defines methods that create abstract products. – ConcreteFactory – Implements methods that create concrete methods – AbstractProduct – Defines the interface for a type of product and may provide default implementation – ConcreteProduct – Defines a product to be created by the corresponding concrete factory and implements the AbstractProduct interface. – Client – Uses only AbstractFactory and AbstractProduct

Reference – Object Oriented Software Development Using Java - Jia AbstractFactory makeProductA() makeProductB() Client ConcreteFactory1 makeProductA() makeProductB() ConcreteFactory2 makeProductA() makeProductB() AbstractProductA ConcreteProductA1ConcreteProductA2 AbstractProductB ConcreteProductB1ConcreteProductB2

Reference – Object Oriented Software Development Using Java - Jia Prototype Category: Creational Design Pattern Intent: To specify the kinds of objects to create using prototypical instance and create new instances by cloning this prototype Applicability: Use this pattern when – a system should be independent of how its components or products are created – the classes to instantiate are specified at run-time – you want to avoid building a class hierarchy of factories that parallels the class hierarchy of products.

Reference – Object Oriented Software Development Using Java - Jia Prototype Design Pattern Participants in the Prototype Pattern: – Prototype:which defines interfaces of objects to be created – ConcretePrototype: Implements prototype interface – Client: Creates instances by cloning the prototype.

Reference – Object Oriented Software Development Using Java - Jia Client prototype aMethod() Cloneable Prototype clone() ConcretePrototype1 clone() ConcreteProtype2 clone() p = prototype.clone()

Reference – Object Oriented Software Development Using Java - Jia Builder Design Pattern Category: Creational Design Pattern Intent: To separate the construction of a complex object from the implementation of its parts so that the same construction process can create complex objects from different implementation of parts Applicability: Use this pattern when – Creating complex objects should be independent of the parts. – the construction process should allow various implementations of the parts used for construction.

Reference – Object Oriented Software Development Using Java - Jia Building Pattern Participants in the Builder Pattern: – Builder – Defines interface for creating parts. – ConcreteBiulder – Constructs and assemble parts. – Director – Constructs a product using the Builder interface – Product – Represents the complex object under construction.

Reference – Object Oriented Software Development Using Java - Jia Director Product buildProduct() ConcreteBuilder1 buildPart() ConcreteBuilder2 buildPart() Product Builder buildPart()

Reference – Object Oriented Software Development Using Java - Jia Command Design Pattern Category: Behavioral Pattern Intent: Encapsulate the action of an object, so that action can be passed as parameters, queued, and possibly undone. Also known as: Action Applicability: Use this pattern when – Actions need to be passed as parameters. – Actions need to be queued and then executed later – Actions may need to be undone

Reference – Object Oriented Software Development Using Java - Jia Command Design Pattern Participants in the Command Design Pattern: – Command: Defines an interface to perform or undo an action – Receiver: Knows how to perform the action – ConcreteCommand: Delegates the execution of the action to the Receiver – Client: Creates the concrete commands and binds the concrete commands to their receivers – Invoker: Ask the command to carry out the action

Reference – Object Oriented Software Development Using Java - Jia Client Invoker Command execute() ConcreteCommand execute() receiver.action() Receiver action()

Reference – Object Oriented Software Development Using Java - Jia Adapter Pattern Category: Structural Design Pattern Intent: Convert the interface of a class into another interface that clients expect Also known as: Wrapper and confused with a bridge Applicability: Use this pattern when – To use an existing class with an interface different from the desired interface

Reference – Object Oriented Software Development Using Java - Jia Adapter Pattern Participants in the Adapter Pattern: – Target: Defines the interface used by the client – Client: Uses objects conforming to the Target interface – Adaptee: the existing class to be re-used – Adapter: Which adapts the interface of the Adaptee to Target.

Reference – Object Oriented Software Development Using Java - Jia Client Target doTask() Adaptee performTask() Adapter doTask() performTask()

Reference – Object Oriented Software Development Using Java - Jia Design Composite Category: Structural Design Pattern Intent: Compose objects into tree structures to represent a part-whole hierarchy. Composite lets clients treat individual objects and composite objects. Applicability: Use this pattern when – you want to represent a part-whole hierarchy of objects. – When you want clients to be able to ignore the difference between composite objects and individual objects.

Reference – Object Oriented Software Development Using Java - Jia Composite Design Pattern Participants in the Composite Design Pattern: – Component which declares the common interface for all classes in the composite; implements default behavior common to all classes, as appropriate; and (optionally) defines an interface for accessing a component’s parent in hierarchy. – Leave which defines a behavior for primitive objects. – Composite, which declares an interface for accessing and managing its child compoonents, defines behavior for components having children, stores child components, and implements child- related operations in the Component interface. – Client, which manipulates objects in the composition through the Component interface

Reference – Object Oriented Software Development Using Java - Jia Component operation() add(Component) remove(Component) getChild(int) Leaf Operation() Composite operation() add(Component) remove(Component) getChild(int) Client *