SlideShare a Scribd company logo
6
Most read
8
Most read
12
Most read
Decorator Design Pattern
CSC305GC RAPID APPLICATION DEVELOPMENT
GROUP 13
What is the software design pattern?
• Introduction
In software engineering, a design pattern is a general
reusable solution to a commonly occurring problem within a given
context in software design. A design pattern is not a finished design
that can be transformed directly into source or machine code.
2
Creational
Behavioral Structural
Deal with object
creation
mechanism
Deal with common
communication
between objects
Ease the design
by identifying a
simple way to
realize
relationships
between entities.
• Classification
3
Decorator
Proxy
CompositeFlyweight
Adapter
Façade
Bridge
4
Structural
Decorator
pattern
5
What Is Decorator Pattern?
The decorator pattern is a design pattern that
allows behavior to be added to an individual object,
either statically or dynamically, without affecting the
behavior of other objects from the same class.
Before Decorating After Decorating
6
UML class diagram
7
Uses of 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 application(Mobile/Desktop)
8
Advantages and Disadvantages
• Advantages
• fewer classes than with static inheritance
• dynamic addition/removal of decorators
• keeps root classes simple
• Disadvantages
• proliferation of run-time instances
• abstract Decorator must provide common interface
• Inheritance solution has an explosion of classes
• If another view were added such as Streamed Video View, double
the number of Borders/Scrollbar classes
9
Related Patterns
• Adapter: A decorator is different from an adapter
in that a decorator only changes an object‘s
responsibilities, not its interface; an adapter will
give an object a completely new interface.
• Strategy : A decorator lets you change the skin of
an object; a strategy lets you change the guts.
10
Demo
11
12
13
Thank You
K. L. Pushpika prasad
K. A. H. M. Karunathilake
W. A. M. D. M. Bandara
P. P. U. A. Peries
14

More Related Content

PPT
Introduction to design patterns
PPT
Software Design Patterns
PPT
Structural patterns
PPT
Unified Modeling Language
PDF
Gof design pattern
PDF
Introduction to Design Pattern
PPTX
Proxy Design Pattern
PPT
Builder pattern
Introduction to design patterns
Software Design Patterns
Structural patterns
Unified Modeling Language
Gof design pattern
Introduction to Design Pattern
Proxy Design Pattern
Builder pattern

What's hot (20)

PPTX
Decorator Pattern
PDF
Design patterns
PPTX
Design Patterns - 01 Introduction and Decorator Pattern
PDF
Design patterns tutorials
PDF
Design Patterns Presentation - Chetan Gole
PPTX
Introduction to Spring Framework
PPTX
Ch1 introduction
PPTX
Let us understand design pattern
PPT
Design patterns ppt
PDF
Why Laravel?
PPTX
Sequence diagram
PDF
Sequence diagram- UML diagram
PPT
Bridge Design Pattern
PPTX
Design pattern (Abstract Factory & Singleton)
PPTX
Design Patterns - General Introduction
PPTX
System models of sdlc- v model
PPTX
서비스 지향 아키텍쳐 (SOA)
PPT
Introduction to Eclipse IDE
PDF
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
PDF
Software Architecture and Design Introduction
Decorator Pattern
Design patterns
Design Patterns - 01 Introduction and Decorator Pattern
Design patterns tutorials
Design Patterns Presentation - Chetan Gole
Introduction to Spring Framework
Ch1 introduction
Let us understand design pattern
Design patterns ppt
Why Laravel?
Sequence diagram
Sequence diagram- UML diagram
Bridge Design Pattern
Design pattern (Abstract Factory & Singleton)
Design Patterns - General Introduction
System models of sdlc- v model
서비스 지향 아키텍쳐 (SOA)
Introduction to Eclipse IDE
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Software Architecture and Design Introduction
Ad

Viewers also liked (8)

PPTX
Acrhitecture deisign pattern_MVC_MVP_MVVM
PPT
Command and Adapter Pattern
PPTX
Design pattern - Software Engineering
ZIP
Adapter Design Pattern
PPTX
Gof design patterns
PDF
Software Design Patterns - Selecting the right design pattern
PPTX
Adapter Design Pattern
PPTX
Implementing the Adapter Design Pattern
Acrhitecture deisign pattern_MVC_MVP_MVVM
Command and Adapter Pattern
Design pattern - Software Engineering
Adapter Design Pattern
Gof design patterns
Software Design Patterns - Selecting the right design pattern
Adapter Design Pattern
Implementing the Adapter Design Pattern
Ad

Similar to Decorator design pattern (20)

PPTX
Decorator Pattern 2.pptxdsadsadsadsadasdasdsa
PPTX
Design pattern reading group – decorator pattern
PPTX
Decorator Pattern presentation theory and examples
PPTX
Decorator design pattern
PDF
Decorator Pattern | Object Oriented Design Pattern
PPTX
Decorator Design Pattern
PDF
DECORATOR PATTERN IN WEB APPLICATION Design
PDF
DECORATOR PATTERN IN WEB APPLICATION
PPTX
Decorator pattern
PPT
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
PPTX
Design Pattern(decorator design pattern) and anti pattern
PPT
10-DesignPatterns.ppt
PPT
Design patterns represent the best practices used by experienced object-orien...
PPT
Design Patterns
PDF
Presentation on design pattern software project lll
PDF
Design patterns 1july
DOCX
Patterns (contd)Software Development ProcessDesign patte.docx
PDF
Decorator & Presenter Design Pattern
PPT
Design patterns structuralpatterns(thedecoratorpattern)
 
Decorator Pattern 2.pptxdsadsadsadsadasdasdsa
Design pattern reading group – decorator pattern
Decorator Pattern presentation theory and examples
Decorator design pattern
Decorator Pattern | Object Oriented Design Pattern
Decorator Design Pattern
DECORATOR PATTERN IN WEB APPLICATION Design
DECORATOR PATTERN IN WEB APPLICATION
Decorator pattern
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
Design Pattern(decorator design pattern) and anti pattern
10-DesignPatterns.ppt
Design patterns represent the best practices used by experienced object-orien...
Design Patterns
Presentation on design pattern software project lll
Design patterns 1july
Patterns (contd)Software Development ProcessDesign patte.docx
Decorator & Presenter Design Pattern
Design patterns structuralpatterns(thedecoratorpattern)
 

Recently uploaded (20)

PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Classroom Observation Tools for Teachers
PDF
Computing-Curriculum for Schools in Ghana
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Complications of Minimal Access Surgery at WLH
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
master seminar digital applications in india
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
01-Introduction-to-Information-Management.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Insiders guide to clinical Medicine.pdf
Cell Types and Its function , kingdom of life
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
GDM (1) (1).pptx small presentation for students
Classroom Observation Tools for Teachers
Computing-Curriculum for Schools in Ghana
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
TR - Agricultural Crops Production NC III.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Complications of Minimal Access Surgery at WLH
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
master seminar digital applications in india
Microbial diseases, their pathogenesis and prophylaxis
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
01-Introduction-to-Information-Management.pdf
Supply Chain Operations Speaking Notes -ICLT Program
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf

Decorator design pattern

  • 1. Decorator Design Pattern CSC305GC RAPID APPLICATION DEVELOPMENT GROUP 13
  • 2. What is the software design pattern? • Introduction In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into source or machine code. 2
  • 3. Creational Behavioral Structural Deal with object creation mechanism Deal with common communication between objects Ease the design by identifying a simple way to realize relationships between entities. • Classification 3
  • 6. What Is Decorator Pattern? The decorator pattern is a design pattern that allows behavior to be added to an individual object, either statically or dynamically, without affecting the behavior of other objects from the same class. Before Decorating After Decorating 6
  • 8. Uses of 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 application(Mobile/Desktop) 8
  • 9. Advantages and Disadvantages • Advantages • fewer classes than with static inheritance • dynamic addition/removal of decorators • keeps root classes simple • Disadvantages • proliferation of run-time instances • abstract Decorator must provide common interface • Inheritance solution has an explosion of classes • If another view were added such as Streamed Video View, double the number of Borders/Scrollbar classes 9
  • 10. Related Patterns • Adapter: A decorator is different from an adapter in that a decorator only changes an object‘s responsibilities, not its interface; an adapter will give an object a completely new interface. • Strategy : A decorator lets you change the skin of an object; a strategy lets you change the guts. 10
  • 12. 12
  • 13. 13
  • 14. Thank You K. L. Pushpika prasad K. A. H. M. Karunathilake W. A. M. D. M. Bandara P. P. U. A. Peries 14