Upload
abraham-hugh-horton
View
215
Download
0
Embed Size (px)
DESCRIPTION
KeyPoints Interface(implements) – abstract class(extends) Inheritance Concrete class Wrapper Number class wraps string variable Now variable S has number characteristics. It acts like a number
Citation preview
By,Sanjay Krishna Anbalagan
Decorator Pattern(Structural)
IntroductionDecorator Design pattern – adds features to core
objects without having to fundamentally change those objects.
Christmas tree - core object (component class)Ornaments – features(decorator class)
KeyPointsInterface(implements) – abstract class(extends)InheritanceConcrete classWrapper
Number class wraps string variable
Now variable S has number characteristics.It acts like a number
Component
Operation()
Concrete Component
Operation()
Decorator
Operation()
Concrete Decorator - A
Operation()
Concrete Decorator - B
Operation()
Algorithm
•Instantiate a concrete component
•Wrap the Instantiated concrete component in the desired decorator instance.
•Apply the getterMethod to the concrete component instance initiated to get the fully wrapped values
ACmodel
getDressed()
CCdoll
constructor
ADdresser
getDressed()
CDpinkdress
getDressesd()constructor
CDcap
constructorgetDressed()
CDyellowdress
getDressesd()constructor
v
v
v
v
v
Points to RememberThe developer has to be judicous in selctionAre the concrete components and
decorators going to grow?Are they going to be fairly static?
ReferencesActionScript 3.0 Design Patterns William Sanders & Chandima
CumaranatungeAdvanced ActionScript 3 with Design
Patterns Joey Lott & Danny Patterson