SlideShare a Scribd company logo
01 Introduction & Decorator PatternDesign Patterns© Prafulla Paraskar 2010
Introduction
Design Patterns - DefinitionDefinition:a general reusable solution to a commonly occurring problem in software design (Wikipedia).Not a finished design Description or template for how to solve a problem that can be used in many different situationsShows relationships and interactions between classes and/or objectsNot all software patterns are design patterns (e.g. algorithms)
Design Patterns – ClassificationStructural PatternEase the design by identifying a simple way to realize relationships between entitiesE.g. Decorator,  ProxyCreational PatternDeal with object creation mechanismE.g. Abstract Factory, SingletonBehavioral PatternDeal with common communication between objects.E.g. Chain of Responsibility, CommandConcurrency PatternDeal with multi-threaded programming paradigm.E.g. Monitor Object, Thread PoolNot covered during this series© Prafulla Paraskar 2010
Design Patterns – Classification
UML Class Diagram Notation (1/3)
UML Class Diagram Notation (2/3)© Prafulla Paraskar 2010
UML Class Diagram Notation (3/3)© Prafulla Paraskar 2010
DecoratorStructural Design Pattern
DefinitionIn object-oriented programming, the decorator pattern is a design pattern that allows new/additional behaviour to be added to an existing object dynamically.© Prafulla Paraskar 2010
Decorator Pattern – Explained (1/2)Photo+Frame+CaptionGuptas (2010)© Prafulla Paraskar 2010
Decorator Pattern – Explained (2/2)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.© Prafulla Paraskar 2010
Decorator Pattern – UML Diagram© Prafulla Paraskar 2010
Decorator Pattern – Real World SamplesGraphics world (as illustrated).I/O namespace of .NETSystem.IO.StreamSystem.IO.BufferedStreamSystem.IO.FileStreamSystem.IO.MemoryStreamCross platform applications (Mobile/Desktop)Actual decorator classes in .NET 3.0System.Windows.Controls (Base Class)Border (Decorator)Viewbox (Decorator)© Prafulla Paraskar 2010
Decorator Pattern – Guidelines (1/2)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.© Prafulla Paraskar 2010
Decorator Pattern – Guidelines (2/2)But consider using instead:The Adapter PatternSets up an interface between different classesThe Composite PatternAggregates an object without also inheriting its interface.The Proxy PatternSpecifically controls access to objects.The Strategy PatternChanges the original object rather than wrapping it.© Prafulla Paraskar 2010
Thank you!http://geekswithblogs.net/technomadPresentation by Prafulla Paraskareprafulla@gmail.com

More Related Content

What's hot (20)

PDF
Solid Principles
NexThoughts Technologies
 
PDF
Model-Driven Software Engineering in Practice - Chapter 2 - MDSE Principles
Marco Brambilla
 
PPTX
PATTERNS03 - Behavioural Design Patterns
Michael Heron
 
PDF
Bridge pattern for Dummies
TaekSoon Jang
 
PPT
design patterns - introdução
elliando dias
 
PPT
Software Design Patterns
Satheesh Sukumaran
 
PDF
Introduction to Design Pattern
Sanae BEKKAR
 
PPT
Software Design Patterns
Pankhuree Srivastava
 
PPTX
Let us understand design pattern
Mindfire Solutions
 
PPTX
Software design patterns ppt
mkruthika
 
PPT
UML- Unified Modeling Language
Shahzad
 
PDF
Gof design pattern
naveen kumar
 
PDF
Clean Code - Formatting Code
Adam Mukharil Bachtiar
 
PDF
Software Engineering - chp4- design patterns
Lilia Sfaxi
 
PPT
C# Exceptions Handling
sharqiyem
 
PPTX
Design patterns
F(x) Data Labs Pvt Ltd
 
PPTX
Domain Driven Design(DDD) Presentation
Oğuzhan Soykan
 
PPTX
Clean code: SOLID
Indeema Software Inc.
 
PPTX
Advanced Coded UI Testing
Shai Raiten
 
PDF
Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...
Edureka!
 
Solid Principles
NexThoughts Technologies
 
Model-Driven Software Engineering in Practice - Chapter 2 - MDSE Principles
Marco Brambilla
 
PATTERNS03 - Behavioural Design Patterns
Michael Heron
 
Bridge pattern for Dummies
TaekSoon Jang
 
design patterns - introdução
elliando dias
 
Software Design Patterns
Satheesh Sukumaran
 
Introduction to Design Pattern
Sanae BEKKAR
 
Software Design Patterns
Pankhuree Srivastava
 
Let us understand design pattern
Mindfire Solutions
 
Software design patterns ppt
mkruthika
 
UML- Unified Modeling Language
Shahzad
 
Gof design pattern
naveen kumar
 
Clean Code - Formatting Code
Adam Mukharil Bachtiar
 
Software Engineering - chp4- design patterns
Lilia Sfaxi
 
C# Exceptions Handling
sharqiyem
 
Design patterns
F(x) Data Labs Pvt Ltd
 
Domain Driven Design(DDD) Presentation
Oğuzhan Soykan
 
Clean code: SOLID
Indeema Software Inc.
 
Advanced Coded UI Testing
Shai Raiten
 
Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...
Edureka!
 

Viewers also liked (7)

PDF
Composite Pattern
Somenath Mukhopadhyay
 
PPT
Composite pattern
Shakil Ahmed
 
PDF
The Decorator Pattern
Akshat Vig
 
PPT
Composite Design Pattern
Ferdous Mahmud Shaon
 
PDF
Decorator design pattern (A Gift Wrapper)
Sameer Rathoud
 
PPTX
Structural Design pattern - Adapter
Manoj Kumar
 
ZIP
Adapter Design Pattern
guy_davis
 
Composite Pattern
Somenath Mukhopadhyay
 
Composite pattern
Shakil Ahmed
 
The Decorator Pattern
Akshat Vig
 
Composite Design Pattern
Ferdous Mahmud Shaon
 
Decorator design pattern (A Gift Wrapper)
Sameer Rathoud
 
Structural Design pattern - Adapter
Manoj Kumar
 
Adapter Design Pattern
guy_davis
 
Ad

Similar to Design Patterns - 01 Introduction and Decorator Pattern (20)

PPT
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
sreeja_rajesh
 
PPTX
Architecture and design
himanshu_airon
 
PPT
P Training Presentation
Gaurav Tyagi
 
PPT
Introduction To Design Patterns
sukumarraju6
 
PPTX
Software Patterns
bonej010
 
DOCX
Design patterns
Vignesh Nethaji
 
PDF
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
Anil Sharma
 
PPS
Design Patterns For 70% Of Programmers In The World
Saurabh Moody
 
PPTX
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Luis Valencia
 
PPT
Design Patterns
Rafael Coutinho
 
PPT
Design Pattern For C# Part 1
Shahzad
 
PPT
Ooad
gantib
 
PDF
Object oriented analysis and design unit- iv
Shri Shankaracharya College, Bhilai,Junwani
 
DOCX
Design Pattern Notes: Nagpur University
Shubham Narkhede
 
PPTX
Design patterns
Elyes Mejri
 
PDF
designpatterns-.pdf
ElviraSolnyshkina
 
PDF
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
iasaglobal
 
PPTX
Software design and Architecture.pptx
SHAHZAIBABBAS13
 
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
sreeja_rajesh
 
Architecture and design
himanshu_airon
 
P Training Presentation
Gaurav Tyagi
 
Introduction To Design Patterns
sukumarraju6
 
Software Patterns
bonej010
 
Design patterns
Vignesh Nethaji
 
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
Anil Sharma
 
Design Patterns For 70% Of Programmers In The World
Saurabh Moody
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Luis Valencia
 
Design Patterns
Rafael Coutinho
 
Design Pattern For C# Part 1
Shahzad
 
Ooad
gantib
 
Object oriented analysis and design unit- iv
Shri Shankaracharya College, Bhilai,Junwani
 
Design Pattern Notes: Nagpur University
Shubham Narkhede
 
Design patterns
Elyes Mejri
 
designpatterns-.pdf
ElviraSolnyshkina
 
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
iasaglobal
 
Software design and Architecture.pptx
SHAHZAIBABBAS13
 
Ad

Recently uploaded (20)

PPTX
CompanyReviewTypeOfPowerpointThatIsColor
plukleomarigpuara
 
PDF
WEEK3-Literary-Gennnnnnnnnnnnnnnnnres.pdf
MaybelynVergara
 
PDF
Empowering Artisans Through Technology Karmakar App Concept
yellowslice2
 
PDF
The Role of Logos as Identity Shapers (IFIC Logo)
Md. Mehedi Hasan Asif
 
PDF
cs603 ppts .pdf 222222222222222222222222
RabiaNazneen1
 
PDF
tdtr.pdfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
JuanCParedes
 
DOCX
Ai vehicle traffic signal detector research proposal.docx
DavidNameza
 
PDF
🔴BUKTI KEMENANGAN HARI INI SELASA 08 JULI 2025 !!!🔴
GRAB
 
PPTX
Town planning is a concept used in architectural design. It plays a very impo...
IshikaPanchal11
 
PPTX
一比一原版(HM毕业证书)慕尼黑应用技术大学毕业证如何办理
Taqyea
 
PPTX
HIGH DENSITY CONCRETE-Concrete Technology
mayurbhandari2123
 
PDF
CRAC- Adobe Photoshop CC 2016 (32 64Bit) Crack
utfefguu
 
DOCX
Redefining Master Plans for creating sustainable cities-Jharkhand Conference...
JIT KUMAR GUPTA
 
PPTX
SAMPLE FILE OF-PPT-FINAL-ORAL-DEFENSE.pptx
Yvez2
 
DOCX
CERT HERNANDEZ CHURCH PHILIPPIBNES .docx
michael patino
 
PDF
PHILGOV-QUIZ-_20250625_182551_000.pdfhehe
errollnas3
 
PDF
Plastic Foam as eco-friendly product in interiors
Disha Agrawal
 
PDF
SS27 Men's Fashion Trend Book Peclers Paris
Peclers Paris
 
PDF
Design Social Change Creating Social Change
Eduardo Corrêa
 
PPTX
condylar pptx.in relation to dental seurgery
abishekgowtham586
 
CompanyReviewTypeOfPowerpointThatIsColor
plukleomarigpuara
 
WEEK3-Literary-Gennnnnnnnnnnnnnnnnres.pdf
MaybelynVergara
 
Empowering Artisans Through Technology Karmakar App Concept
yellowslice2
 
The Role of Logos as Identity Shapers (IFIC Logo)
Md. Mehedi Hasan Asif
 
cs603 ppts .pdf 222222222222222222222222
RabiaNazneen1
 
tdtr.pdfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
JuanCParedes
 
Ai vehicle traffic signal detector research proposal.docx
DavidNameza
 
🔴BUKTI KEMENANGAN HARI INI SELASA 08 JULI 2025 !!!🔴
GRAB
 
Town planning is a concept used in architectural design. It plays a very impo...
IshikaPanchal11
 
一比一原版(HM毕业证书)慕尼黑应用技术大学毕业证如何办理
Taqyea
 
HIGH DENSITY CONCRETE-Concrete Technology
mayurbhandari2123
 
CRAC- Adobe Photoshop CC 2016 (32 64Bit) Crack
utfefguu
 
Redefining Master Plans for creating sustainable cities-Jharkhand Conference...
JIT KUMAR GUPTA
 
SAMPLE FILE OF-PPT-FINAL-ORAL-DEFENSE.pptx
Yvez2
 
CERT HERNANDEZ CHURCH PHILIPPIBNES .docx
michael patino
 
PHILGOV-QUIZ-_20250625_182551_000.pdfhehe
errollnas3
 
Plastic Foam as eco-friendly product in interiors
Disha Agrawal
 
SS27 Men's Fashion Trend Book Peclers Paris
Peclers Paris
 
Design Social Change Creating Social Change
Eduardo Corrêa
 
condylar pptx.in relation to dental seurgery
abishekgowtham586
 

Design Patterns - 01 Introduction and Decorator Pattern

  • 1. 01 Introduction & Decorator PatternDesign Patterns© Prafulla Paraskar 2010
  • 3. Design Patterns - DefinitionDefinition:a general reusable solution to a commonly occurring problem in software design (Wikipedia).Not a finished design Description or template for how to solve a problem that can be used in many different situationsShows relationships and interactions between classes and/or objectsNot all software patterns are design patterns (e.g. algorithms)
  • 4. Design Patterns – ClassificationStructural PatternEase the design by identifying a simple way to realize relationships between entitiesE.g. Decorator, ProxyCreational PatternDeal with object creation mechanismE.g. Abstract Factory, SingletonBehavioral PatternDeal with common communication between objects.E.g. Chain of Responsibility, CommandConcurrency PatternDeal with multi-threaded programming paradigm.E.g. Monitor Object, Thread PoolNot covered during this series© Prafulla Paraskar 2010
  • 5. Design Patterns – Classification
  • 6. UML Class Diagram Notation (1/3)
  • 7. UML Class Diagram Notation (2/3)© Prafulla Paraskar 2010
  • 8. UML Class Diagram Notation (3/3)© Prafulla Paraskar 2010
  • 10. DefinitionIn object-oriented programming, the decorator pattern is a design pattern that allows new/additional behaviour to be added to an existing object dynamically.© Prafulla Paraskar 2010
  • 11. Decorator Pattern – Explained (1/2)Photo+Frame+CaptionGuptas (2010)© Prafulla Paraskar 2010
  • 12. Decorator Pattern – Explained (2/2)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.© Prafulla Paraskar 2010
  • 13. Decorator Pattern – UML Diagram© Prafulla Paraskar 2010
  • 14. Decorator Pattern – Real World SamplesGraphics world (as illustrated).I/O namespace of .NETSystem.IO.StreamSystem.IO.BufferedStreamSystem.IO.FileStreamSystem.IO.MemoryStreamCross platform applications (Mobile/Desktop)Actual decorator classes in .NET 3.0System.Windows.Controls (Base Class)Border (Decorator)Viewbox (Decorator)© Prafulla Paraskar 2010
  • 15. Decorator Pattern – Guidelines (1/2)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.© Prafulla Paraskar 2010
  • 16. Decorator Pattern – Guidelines (2/2)But consider using instead:The Adapter PatternSets up an interface between different classesThe Composite PatternAggregates an object without also inheriting its interface.The Proxy PatternSpecifically controls access to objects.The Strategy PatternChanges the original object rather than wrapping it.© Prafulla Paraskar 2010