SlideShare una empresa de Scribd logo
1 de 21
Decorator Pattern
Design Patterns
Tharuka Dilani Siriwardena.
M.A.N.Shahitha Nazrin.
S.P Dimuthu Anuraj.
INTRODUCTION
DESIGN PATTERNS - DEFINITION
• A general reusable solution to a commonly occurring
problem in software design (Wikipedia).
• It is not a finished design.
• It is a description or template for how to solve a problem
that can be used in many different situations.
• Shows relationship and interactions between classes
and/or objects.
DESIGN PATTERNS - CLASSIFICATION
• Creational pattern
• Deal with object creation mechanism
• E.g. Abstract Factory, Singleton
• Structural pattern
• Ease the design by identifying a simple way to realize relationships
between entities
• E.g. Decorator, Proxy
• Behavioral pattern
• Deal with common communication between objects.
• E.g. Chain of Responsibility, Command
DESIGN PATTERNS – CLASSIFICATION
Structural Patterns
• 1. Decorator
• 2. Proxy
• 3. Bridge
• 4. Composite
• 5. Flyweight
• 6. Adapter
• 7. Facade
Creational Patterns
• 1. Prototype
• 2. Factory Method
• 3. Singleton
• 4. Abstract Factory
• 5. Builder
Behavioral Patterns
• 1. Strategy
• 2. State
• 3. TemplateMethod
• 4. Chain of
Responsibility
• 5. Command
• 6. Iterator
• 7. Mediator
• 8. Observer
• 9. Visitor
• 10. Interpreter
• 11. Memento
Decorator
Structural Design Pattern
CONCEPT OF DECORATING IN REAL
WORLD
Before Decorating
After Decorating
DEFINITION
• In object-oriented programming, the decorator
pattern is a design pattern that allows new/additional
behaviour to be added to an existing object dynamically.
Photo
+
Frame
+
Caption
RAD Family
DECORATOR PATTERN - EXPLAINED
• Adds functionality at Runtime.
• The object does not know it is being “decorated”.
• Three is no one big feature-laden class with all the
options in it.
• The decorations are independent of each other.
• The decorations can be composed together in a mix-
and-match fashion.
DECORATOR PATTERN - EXPLAINED
IMPLEMENTATION
• We're going to create a Shape interface and concrete classes
implementing the Shape interface. We will then create an
abstract decorator class ShapeDecorator implementing the
Shape interface and having Shape object as its instance
variable.
• RedShapeDecorator is concrete class implementing
ShapeDecorator.
• DecoratorPatternDemo, our demo class will use
RedShapeDecorator to decorate Shape objects.
DECORATOR PATTERN - UML
DIAGRAM
DEMO
Builder Pattern Decorator Pattern
• Graphics world (as illustrated).
• I/O namespace of .NET
• System.IO.Stream
• System.IO.BufferedStream
• System.IO.FileStream
• System.IO.MemoryStream
• Cross platform applications (Mobile/Desktop)
• Actual decorator classes in .NET 3.0
• System.Windows.Controls (Base Class)
• Border (Decorator)
• Viewbox (Decorator)
DECORATOR PATTERN – REAL WORLD
SAMPLE
• You have:
• An existing component class that may be unavailable for
subclassing.
• You want to:
• Attach additional state or behavior to an object dynamically.
• Make Changes to some objects of a class without affecting
others.
• Avoid subclassing because too many classes could result.
DECORATOR PATTERN – GUIDELINES(1)
• But consider using instead:
• The Adapter Pattern
• Sets up an interface between different classes
• The Composite Pattern
• Aggregates an object without also inheriting its interface.
• The Proxy Pattern
• Specifically controls access to objects.
• The Strategy Pattern
• Changes the original object rather than wrapping it.
DECORATOR PATTERN – GUIDELINES(2)
BUILDER VS DECORATOR
• Builder patterns makes it easy
to construct an object which
is extensible in independent
directions at construction
time
• Decorator pattern lets you
add extensions to
functionality to an object after
construction time
BUILDER VS DECORATOR
• Builder
Elements are must
This acts as a base on top other work
if this fails the object will be incomplete or inconsistent
• Decorator
Elements are optional
This is to add/attach more responsibility to existing
object
This is bonus or extra functionality is won’t affect the
basic behavior
Thank You !
ANY QUESTIONS?
Decorator Pattern

Más contenido relacionado

La actualidad más candente

Design patterns ppt
Design patterns pptDesign patterns ppt
Design patterns ppt
Aman Jain
 
Singleton design pattern
Singleton design patternSingleton design pattern
Singleton design pattern
11prasoon
 

La actualidad más candente (20)

Design Pattern - Singleton Pattern
Design Pattern - Singleton PatternDesign Pattern - Singleton Pattern
Design Pattern - Singleton Pattern
 
Design patterns ppt
Design patterns pptDesign patterns ppt
Design patterns ppt
 
Introduction to design patterns
Introduction to design patternsIntroduction to design patterns
Introduction to design patterns
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design Pattern
 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design pattern
 
Decorator design pattern
Decorator design patternDecorator design pattern
Decorator design pattern
 
Design Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator PatternDesign Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator Pattern
 
Decorator Design Pattern
Decorator Design PatternDecorator Design Pattern
Decorator Design Pattern
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Facade pattern
Facade patternFacade pattern
Facade pattern
 
Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)
 
Software Engineering - chp4- design patterns
Software Engineering - chp4- design patternsSoftware Engineering - chp4- design patterns
Software Engineering - chp4- design patterns
 
Design pattern-presentation
Design pattern-presentationDesign pattern-presentation
Design pattern-presentation
 
Builder pattern
Builder patternBuilder pattern
Builder pattern
 
Creational pattern
Creational patternCreational pattern
Creational pattern
 
Singleton design pattern
Singleton design patternSingleton design pattern
Singleton design pattern
 
Composite pattern
Composite patternComposite pattern
Composite pattern
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design Pattern
 
Software Architecture and Design
Software Architecture and DesignSoftware Architecture and Design
Software Architecture and Design
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 

Destacado

Design Patterns
Design PatternsDesign Patterns
Design Patterns
soms_1
 
внутрішні води євразії
внутрішні води  євразіївнутрішні води  євразії
внутрішні води євразії
vyglinska
 

Destacado (19)

Markerless inspection of ar using fingertip tracking
Markerless inspection of ar using fingertip trackingMarkerless inspection of ar using fingertip tracking
Markerless inspection of ar using fingertip tracking
 
Implementation of composite design pattern in android view and widgets
Implementation of composite design pattern in android view and widgetsImplementation of composite design pattern in android view and widgets
Implementation of composite design pattern in android view and widgets
 
The Decorator Pattern
The Decorator PatternThe Decorator Pattern
The Decorator Pattern
 
Design pattern
Design patternDesign pattern
Design pattern
 
Observer and Decorator Pattern
Observer and Decorator PatternObserver and Decorator Pattern
Observer and Decorator Pattern
 
Composite Design Pattern
Composite Design PatternComposite Design Pattern
Composite Design Pattern
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Design Patterns - 04 Adapter and Facade Pattern
Design Patterns - 04 Adapter and Facade PatternDesign Patterns - 04 Adapter and Facade Pattern
Design Patterns - 04 Adapter and Facade Pattern
 
Testamen
TestamenTestamen
Testamen
 
Apostila usinagem
Apostila usinagemApostila usinagem
Apostila usinagem
 
урок 51 річки
урок 51 річкиурок 51 річки
урок 51 річки
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Adobe Illustrator - Урок 2
Adobe Illustrator - Урок 2Adobe Illustrator - Урок 2
Adobe Illustrator - Урок 2
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
 
Architectural Design Pattern: Android
Architectural Design Pattern: AndroidArchitectural Design Pattern: Android
Architectural Design Pattern: Android
 
Ghanshyam avenue
Ghanshyam avenueGhanshyam avenue
Ghanshyam avenue
 
внутрішні води євразії
внутрішні води  євразіївнутрішні води  євразії
внутрішні води євразії
 
Monografia final Sistema Controle de Estoque
Monografia final Sistema Controle de EstoqueMonografia final Sistema Controle de Estoque
Monografia final Sistema Controle de Estoque
 

Similar a Decorator Pattern

Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)
stanbridge
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
Gaurav Tyagi
 
Code Like a Ninja Session 8 - Structural Design Patterns
Code Like a Ninja Session 8 - Structural Design PatternsCode Like a Ninja Session 8 - Structural Design Patterns
Code Like a Ninja Session 8 - Structural Design Patterns
Deon Meyer
 

Similar a Decorator Pattern (20)

Design Pattern lecture 2
Design Pattern lecture 2Design Pattern lecture 2
Design Pattern lecture 2
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
 
the Modeling is a way of thinking about the
the Modeling is a way of thinking about thethe Modeling is a way of thinking about the
the Modeling is a way of thinking about the
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Creational Design Patterns.pptx
Creational Design Patterns.pptxCreational Design Patterns.pptx
Creational Design Patterns.pptx
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
 
Solid Principles Of Design (Design Series 01)
Solid Principles Of Design (Design Series 01)Solid Principles Of Design (Design Series 01)
Solid Principles Of Design (Design Series 01)
 
Code Like a Ninja Session 8 - Structural Design Patterns
Code Like a Ninja Session 8 - Structural Design PatternsCode Like a Ninja Session 8 - Structural Design Patterns
Code Like a Ninja Session 8 - Structural Design Patterns
 
Design pattern
Design patternDesign pattern
Design pattern
 
Alex Theedom Java ee revisits design patterns
Alex Theedom	Java ee revisits design patternsAlex Theedom	Java ee revisits design patterns
Alex Theedom Java ee revisits design patterns
 
SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"
 
Design Patterns In Scala
Design Patterns In ScalaDesign Patterns In Scala
Design Patterns In Scala
 
Design patterns Structural
Design patterns StructuralDesign patterns Structural
Design patterns Structural
 
Introduction to Design Patterns
Introduction to Design PatternsIntroduction to Design Patterns
Introduction to Design Patterns
 
Software enginering.group-no-11 (1)
Software enginering.group-no-11 (1)Software enginering.group-no-11 (1)
Software enginering.group-no-11 (1)
 
Decorator pattern
Decorator patternDecorator pattern
Decorator pattern
 
Gang of Four in Java
Gang of Four in Java Gang of Four in Java
Gang of Four in Java
 

Último

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Último (20)

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 

Decorator Pattern

  • 1. Decorator Pattern Design Patterns Tharuka Dilani Siriwardena. M.A.N.Shahitha Nazrin. S.P Dimuthu Anuraj.
  • 3. DESIGN PATTERNS - DEFINITION • A general reusable solution to a commonly occurring problem in software design (Wikipedia). • It is not a finished design. • It is a description or template for how to solve a problem that can be used in many different situations. • Shows relationship and interactions between classes and/or objects.
  • 4. DESIGN PATTERNS - CLASSIFICATION • Creational pattern • Deal with object creation mechanism • E.g. Abstract Factory, Singleton • Structural pattern • Ease the design by identifying a simple way to realize relationships between entities • E.g. Decorator, Proxy • Behavioral pattern • Deal with common communication between objects. • E.g. Chain of Responsibility, Command
  • 5. DESIGN PATTERNS – CLASSIFICATION Structural Patterns • 1. Decorator • 2. Proxy • 3. Bridge • 4. Composite • 5. Flyweight • 6. Adapter • 7. Facade Creational Patterns • 1. Prototype • 2. Factory Method • 3. Singleton • 4. Abstract Factory • 5. Builder Behavioral Patterns • 1. Strategy • 2. State • 3. TemplateMethod • 4. Chain of Responsibility • 5. Command • 6. Iterator • 7. Mediator • 8. Observer • 9. Visitor • 10. Interpreter • 11. Memento
  • 7. CONCEPT OF DECORATING IN REAL WORLD Before Decorating After Decorating
  • 8. DEFINITION • In object-oriented programming, the decorator pattern is a design pattern that allows new/additional behaviour to be added to an existing object dynamically.
  • 10. • Adds functionality at Runtime. • The object does not know it is being “decorated”. • Three is no one big feature-laden class with all the options in it. • The decorations are independent of each other. • The decorations can be composed together in a mix- and-match fashion. DECORATOR PATTERN - EXPLAINED
  • 12. • We're going to create a Shape interface and concrete classes implementing the Shape interface. We will then create an abstract decorator class ShapeDecorator implementing the Shape interface and having Shape object as its instance variable. • RedShapeDecorator is concrete class implementing ShapeDecorator. • DecoratorPatternDemo, our demo class will use RedShapeDecorator to decorate Shape objects.
  • 13. DECORATOR PATTERN - UML DIAGRAM
  • 15. • Graphics world (as illustrated). • I/O namespace of .NET • System.IO.Stream • System.IO.BufferedStream • System.IO.FileStream • System.IO.MemoryStream • Cross platform applications (Mobile/Desktop) • Actual decorator classes in .NET 3.0 • System.Windows.Controls (Base Class) • Border (Decorator) • Viewbox (Decorator) DECORATOR PATTERN – REAL WORLD SAMPLE
  • 16. • You have: • An existing component class that may be unavailable for subclassing. • You want to: • Attach additional state or behavior to an object dynamically. • Make Changes to some objects of a class without affecting others. • Avoid subclassing because too many classes could result. DECORATOR PATTERN – GUIDELINES(1)
  • 17. • But consider using instead: • The Adapter Pattern • Sets up an interface between different classes • The Composite Pattern • Aggregates an object without also inheriting its interface. • The Proxy Pattern • Specifically controls access to objects. • The Strategy Pattern • Changes the original object rather than wrapping it. DECORATOR PATTERN – GUIDELINES(2)
  • 18. BUILDER VS DECORATOR • Builder patterns makes it easy to construct an object which is extensible in independent directions at construction time • Decorator pattern lets you add extensions to functionality to an object after construction time
  • 19. BUILDER VS DECORATOR • Builder Elements are must This acts as a base on top other work if this fails the object will be incomplete or inconsistent • Decorator Elements are optional This is to add/attach more responsibility to existing object This is bonus or extra functionality is won’t affect the basic behavior
  • 20. Thank You ! ANY QUESTIONS?