Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 2.37 KB

File metadata and controls

37 lines (27 loc) · 2.37 KB

Structural Patterns - Decorator

In order to attach additional responsibilities to an object dynamically, the Decorator Pattern provides a technique to extend the functionality as a Wrapper:

Without the Pattern

Design Patterns - Class Diagram - Without - Decorator Pattern.png

With the Pattern

Design Patterns - Class Diagram - With - Decorator Pattern.png


CKJM Metrics Analysis of using Decorator Pattern:

The following summary shows us how CKJM Metrics have been affected in this project after having applied the Decorator Pattern:

CKJM Metric Without the Pattern With the Pattern
WMC: Weighted methods per class 2.6 2.6
DIT: Depth of Inheritance Tree 1 1
NOC: Number of Children 0 0
CBO: Coupling between object classes 3.4 3.8
RFC: Response for a Class 4.9 4.7
LCOM: Lack of cohesion in methods 0.4 0.4
Ca: Afferent coupling (not a C&K metric) 1.6 1.8
NPM: Number of Public Methods for a class (not a C&K metric) 2.3 1.9

Design Patterns - CKJM Metrics- Decorator Pattern.png


Related Patterns

  1. Adapter
  2. Composite
  3. Strategy