Decorator Intent Also known as Wrapper Example: a Text Window

Slides:



Advertisements
Similar presentations
Matt Klein. Decorator Pattern  Intent  Attach Additional responsibilities to an object by dynamically. Decorators provide a flexible alternative to.
Advertisements

AP 04/02 Structural Patterns Describe how classes and objects are composed to form larger structures Structural class patterns use inheritance to compose.
1 Structural Design Patterns - Neeraj Ray. 2 Structural Patterns - Overview n Adapter n Bridge n Composite n Decorator.
02 - Structural Design Patterns – 1 Moshe Fresko Bar-Ilan University תשס"ח 2008.
Flyweight: Structural Pattern Prepared by Galina Walters.
DECORATOR by Ramani Natarajan Also known as ‘Wrapper.’ Also known as ‘Wrapper.’ According to ‘gang of four’(sounds like an Akira Kurosawa movie): A Decorator.
Plab – Tirgul 12 Design Patterns
Imagine that you need to create a system to represent all of the cars in a city. You need to store the details about each car ( model, and year) and the.
Flyweight An Object Structural Design Pattern JM Imbrescia.
Design Patterns David Talby. This Lecture n Patterns for a User Interface u Representing a Document F Composite, Flyweight, Decorator u Writing Portable.
Design Patterns. CS351 - Software Engineering (AY2007)Slide 2 Behavioral patterns Suppose we have an aggregate data structure and we wish to access the.
Algorithm Programming Structural Design Patterns Bar-Ilan University תשס " ו by Moshe Fresko.
Software Design and Documentation Individual Presentation: Composite Pattern 9/11/03.
The Composite Pattern.. Composite Pattern Intent –Compose objects into tree structures to represent part-whole hierarchies. –Composite lets clients treat.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
Prototype Creational Design Pattern By Brian Cavanaugh September 22, 2003 Software, Design and Documentation.
The Decorator Design Pattern (also known as the Wrapper) By Gordon Friedman Software Design and Documentation September 22, 2003.
Design Patterns.
Department of Computer Science, York University Object Oriented Software Construction 16/09/ :52 PM 0 COSC3311 – Software Design Decorator Pattern.
Structural Pattern: Decorator There are times when the use of subclasses to modify the behavior of individual objects is problematic. C h a p t e r 4.
Design Pattern. The Observer Pattern The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all.
BUILDER, MEDIATOR, AND DECORATOR Team 2 (Eli.SE).
Strategy Design Patterns CS 590L - Sushil Puradkar.
18 April 2005CSci 210 Spring Design Patterns 1 CSci 210.
Decorator Explained. Intent Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to sub-classing for.
GoF: Document Editor Example Rebecca Miller-Webster.
Decorator Design Pattern Rick Mercer CSC 335: Object-Oriented Programming and Design.
Structural Design Patterns
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns IV Structural Patterns.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns V More Structural Patterns.
02 - Structural Design Patterns – 2 Moshe Fresko Bar-Ilan University תשס"ח 2008.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VIII Chain of Responsibility, Strategy, State.
Prototype pattern Participants Prototype (Graphic) – declared an interface for cloning itself ConcretePrototype (EditBox, Slider) – implements an operation.
08 - StructuralCSC4071 Structural Patterns concerned with how classes and objects are composed to form larger structures –Adapter interface converter Bridge.
Structural Patterns1 Nour El Kadri SEG 3202 Software Design and Architecture Notes based on U of T Design Patterns class.
Linzhang Wang Dept. of Computer Sci&Tech, Nanjing University The Strategy Pattern.
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.
1 Advanced Object-oriented Design – Principles and Patterns Structural Design Patterns.
Bridge Bridge is used when we need to decouple an abstraction from its implementation so that the two can vary independently. This type of design pattern.
The Strategy Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
Decorator Design Pattern Rick Mercer CSC 335: Object-Oriented Programming and Design.
S.Ducasse Stéphane Ducasse 1 Decorator.
The Decorator Pattern (Structural) ©SoftMoore ConsultingSlide 1.
Decorator Design Pattern Phillip Shin. Overview Problem Solution Example Key points.
The Flyweight Pattern (Structural) ©SoftMoore ConsultingSlide 1.
S.Ducasse Stéphane Ducasse 1 Adapter.
CS 350 – Software Design The Decorator Pattern – Chapter 17 In this chapter we expand our e-commerce case study and learn how to use the Decorator Pattern.
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Design Patterns: MORE Examples
Strategy Design Pattern
Structural Patterns Structural patterns control the relationships between large portions of your applications. Structural patterns affect applications.
Linzhang Wang Dept. of Computer Sci&Tech, Nanjing University
Software Design and Architecture
Flyweight Design Pattern
Decorator Design Pattern
More Design Patterns 1.
More Design Patterns 1.
Decorator Pattern Intent
Jim Fawcett CSE776 – Design Patterns Summer 2003
“The Trouble with Observer” and “Visitor Revisited”
Informatics 122 Software Design II
Object Oriented Design Patterns - Structural Patterns
Decorator Pattern Richard Gesick.
UNIT-III Structural Design Patterns
Flyweight Pattern 1.
Design Patterns Imran Rashid CTO at ManiWeber Technologies.
Informatics 122 Software Design II
Decorator Pattern.
Software Design Lecture 10.
Presentation transcript:

Decorator Intent Also known as Wrapper Example: a Text Window Add additional responsibilities and functionality to objects dynamically Also known as Wrapper Example: a Text Window

Decorator: Motivation & Application Subclassing can only add functionality at runtime Avoid enumerating all possible sub classes Such as adding a border function to text window. Use with optional functionality

Decorator: Structure Participants: Component, ConcreteComponent, Decorator, ConcreteDecorator

Decorator: Consequences Positives More flexibility than static inheritance Avoids feature laden classes high in hierarchy Negatives Lots of little objects Interface conformance

Flyweight Intent: Use sharing to support large numbers of fine-grained objects efficiently Origin: A boxing class which includes fighters weighing less than 112 lb (50 kg) but above 108 lb. Example: Character in a word processor

Flyweight: Motivation & Application Applications that could benefit from using objects But the objects are very small and numerous

Flyweight: Structure Participants: Flyweight, ConcreteFlyweight, UnsharedConcreteFlyweight, FlyweightFactory, Client

Flyweight: Consequences Positives Space saving by using shared objects Adds functionality to the application Negatives Adding processing time of computing extrinsic state Time can be reduced

Any Questions?