Il-Decorator pattern iżżid dinamikament imġieba jew responsabilități għal oġġetti billi jħaqqabhom — mingħajr modifika tal-klassja oriġinali. Jipprovdi alternattiva flessibbli għas-subclassing għall-estensjoni tal-funzjonalità, u jipermettik tikkomponi imġieba.
X'hu l-Decorator pattern tagħmel
DECORATOR → WRAP an object to add behavior, keeping the same interface:
→ the decorator wraps the original, adds its behavior, and delegates to the original
→ you can STACK decorators (wrap a wrapped object) → compose multiple behaviors
→ adds functionality WITHOUT modifying the original class or using subclassing
→ "wrap to extend" — flexible, composable behavior addition
