SlideShare a Scribd company logo
1 of 17
01 Introduction & Decorator Pattern Design Patterns © Prafulla Paraskar 2010
Introduction
Design Patterns - Definition Definition: 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 situations Shows relationships and interactions between classes and/or objects Not all software patterns are design patterns (e.g. algorithms)
Design Patterns – Classification Structural Pattern Ease the design by identifying a simple way to realize relationships between entities E.g. Decorator,  Proxy Creational Pattern Deal with object creation mechanism E.g. Abstract Factory, Singleton Behavioral Pattern Deal with common communication between objects. E.g. Chain of Responsibility, Command Concurrency Pattern Deal with multi-threaded programming paradigm. E.g. Monitor Object, Thread Pool Not 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
Decorator Structural Design Pattern
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. © Prafulla Paraskar 2010
Decorator Pattern – Explained (1/2) Photo + Frame + Caption Guptas (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 Samples 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) © 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 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. © Prafulla Paraskar 2010
Thank you! http://geekswithblogs.net/technomad Presentation by Prafulla Paraskareprafulla@gmail.com

More Related Content

What's hot

Design patterns ppt
Design patterns pptDesign patterns ppt
Design patterns ppt
Aman Jain
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
soms_1
 

What's hot (20)

Facade pattern
Facade patternFacade pattern
Facade pattern
 
Gof design pattern
Gof design patternGof design pattern
Gof design pattern
 
Introduction to design patterns
Introduction to design patternsIntroduction to design patterns
Introduction to design patterns
 
Bridge pattern
Bridge patternBridge pattern
Bridge pattern
 
Design patterns ppt
Design patterns pptDesign patterns ppt
Design patterns ppt
 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design pattern
 
Design pattern-presentation
Design pattern-presentationDesign pattern-presentation
Design pattern-presentation
 
Creational pattern
Creational patternCreational pattern
Creational pattern
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Decorator design pattern
Decorator design patternDecorator design pattern
Decorator design pattern
 
Prototype pattern
Prototype patternPrototype pattern
Prototype pattern
 
Flyweight pattern
Flyweight patternFlyweight pattern
Flyweight pattern
 
Software design patterns ppt
Software design patterns pptSoftware design patterns ppt
Software design patterns ppt
 
Builder pattern
Builder patternBuilder pattern
Builder pattern
 
Design pattern
Design patternDesign pattern
Design pattern
 
Bridge Design Pattern
Bridge Design PatternBridge Design Pattern
Bridge Design Pattern
 
Introduction to Design Pattern
Introduction to Design  PatternIntroduction to Design  Pattern
Introduction to Design Pattern
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Decorator design pattern
Decorator design patternDecorator design pattern
Decorator design pattern
 

Viewers also liked (7)

Composite Pattern
Composite PatternComposite Pattern
Composite Pattern
 
Composite pattern
Composite patternComposite pattern
Composite pattern
 
The Decorator Pattern
The Decorator PatternThe Decorator Pattern
The Decorator Pattern
 
Composite Design Pattern
Composite Design PatternComposite Design Pattern
Composite Design Pattern
 
Decorator design pattern (A Gift Wrapper)
Decorator design pattern (A Gift Wrapper)Decorator design pattern (A Gift Wrapper)
Decorator design pattern (A Gift Wrapper)
 
Structural Design pattern - Adapter
Structural Design pattern - AdapterStructural Design pattern - Adapter
Structural Design pattern - Adapter
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 

Similar to Design Patterns - 01 Introduction and Decorator Pattern

Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISESoftware Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
sreeja_rajesh
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
Gaurav Tyagi
 

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

Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISESoftware Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
 
Architecture and design
Architecture and designArchitecture and design
Architecture and design
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
 
Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patterns
 
Software Patterns
Software PatternsSoftware Patterns
Software Patterns
 
Design patterns
Design patternsDesign patterns
Design patterns
 
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
 
Design Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The WorldDesign Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The World
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1
 
Ooad
OoadOoad
Ooad
 
Object oriented analysis and design unit- iv
Object oriented analysis and design unit- ivObject oriented analysis and design unit- iv
Object oriented analysis and design unit- iv
 
Design Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityDesign Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur University
 
What is design pattern
What is design patternWhat is design pattern
What is design pattern
 
DDD
DDDDDD
DDD
 
Design patterns
Design patternsDesign patterns
Design patterns
 
designpatterns-.pdf
designpatterns-.pdfdesignpatterns-.pdf
designpatterns-.pdf
 
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
Nina Grantcharova - Approach to Separation of Concerns via Design PatternsNina Grantcharova - Approach to Separation of Concerns via Design Patterns
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
 
Software design and Architecture.pptx
Software design and Architecture.pptxSoftware design and Architecture.pptx
Software design and Architecture.pptx
 

Recently uploaded

Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...
Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...
Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...
drmarathore
 
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
eeanqy
 
ab-initio-training basics and architecture
ab-initio-training basics and architectureab-initio-training basics and architecture
ab-initio-training basics and architecture
saipriyacoool
 
Jual Obat Aborsi Bandung ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan ...
Jual Obat Aborsi Bandung ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan ...Jual Obat Aborsi Bandung ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan ...
Jual Obat Aborsi Bandung ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan ...
ZurliaSoop
 
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
nirzagarg
 
Minimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptxMinimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptx
balqisyamutia
 
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
eqaqen
 
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
gajnagarg
 
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Nitya salvi
 
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
CristineGraceAcuyan
 
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
gajnagarg
 
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
wpkuukw
 

Recently uploaded (20)

Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...
Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...
Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...
 
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
怎样办理伯明翰大学学院毕业证(Birmingham毕业证书)成绩单留信认证
 
The hottest UI and UX Design Trends 2024
The hottest UI and UX Design Trends 2024The hottest UI and UX Design Trends 2024
The hottest UI and UX Design Trends 2024
 
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEKLANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
 
ab-initio-training basics and architecture
ab-initio-training basics and architectureab-initio-training basics and architecture
ab-initio-training basics and architecture
 
Jual Obat Aborsi Bandung ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan ...
Jual Obat Aborsi Bandung ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan ...Jual Obat Aborsi Bandung ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan ...
Jual Obat Aborsi Bandung ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan ...
 
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
 
Minimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptxMinimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptx
 
TRose UXPA Experience Design Concord .pptx
TRose UXPA Experience Design Concord .pptxTRose UXPA Experience Design Concord .pptx
TRose UXPA Experience Design Concord .pptx
 
Call Girls Jalaun Just Call 8617370543 Top Class Call Girl Service Available
Call Girls Jalaun Just Call 8617370543 Top Class Call Girl Service AvailableCall Girls Jalaun Just Call 8617370543 Top Class Call Girl Service Available
Call Girls Jalaun Just Call 8617370543 Top Class Call Girl Service Available
 
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
 
Essential UI/UX Design Principles: A Comprehensive Guide
Essential UI/UX Design Principles: A Comprehensive GuideEssential UI/UX Design Principles: A Comprehensive Guide
Essential UI/UX Design Principles: A Comprehensive Guide
 
High Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
High Profile Escorts Nerul WhatsApp +91-9930687706, Best ServiceHigh Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
High Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
 
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
 
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
 
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
 
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
 
Raebareli Girl Whatsapp Number 📞 8617370543 | Girls Number for Friendship
Raebareli Girl Whatsapp Number 📞 8617370543 | Girls Number for FriendshipRaebareli Girl Whatsapp Number 📞 8617370543 | Girls Number for Friendship
Raebareli Girl Whatsapp Number 📞 8617370543 | Girls Number for Friendship
 
Sweety Planet Packaging Design Process Book.pptx
Sweety Planet Packaging Design Process Book.pptxSweety Planet Packaging Design Process Book.pptx
Sweety Planet Packaging Design Process Book.pptx
 
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
 

Design Patterns - 01 Introduction and Decorator Pattern

  • 1. 01 Introduction & Decorator Pattern Design Patterns © Prafulla Paraskar 2010
  • 3. Design Patterns - Definition Definition: 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 situations Shows relationships and interactions between classes and/or objects Not all software patterns are design patterns (e.g. algorithms)
  • 4. Design Patterns – Classification Structural Pattern Ease the design by identifying a simple way to realize relationships between entities E.g. Decorator, Proxy Creational Pattern Deal with object creation mechanism E.g. Abstract Factory, Singleton Behavioral Pattern Deal with common communication between objects. E.g. Chain of Responsibility, Command Concurrency Pattern Deal with multi-threaded programming paradigm. E.g. Monitor Object, Thread Pool Not 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. 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. © Prafulla Paraskar 2010
  • 11. Decorator Pattern – Explained (1/2) Photo + Frame + Caption Guptas (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 Samples 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) © 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 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. © Prafulla Paraskar 2010
  • 17. Thank you! http://geekswithblogs.net/technomad Presentation by Prafulla Paraskareprafulla@gmail.com