---
# System prepended metadata

title: Head first design pattern easy (Chapter 3)
tags: [OOP, Design pattern]

---

Head first design pattern easy (Chapter 3)
===
###### tags: `OOP` `Design pattern`
1. Design Principle Classes should be open for extension, but closed for modification.
1. Apply Open-closed principle EVERYWHERE is unnecessary and wasteful
1. The type Observable is deprecated since version 9
1. The decorator adds its own behaviour either before and/or after delegating to the object it decorates to do the rest of the job
1. The Decorator Pattern attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality
1. In decorator pattern we’re subclassing the abstract class in order to have the correct type, not to inherit its behavior. The behavior comes in through the composition of decorators with the base components as well as other decorators
1. Traditionally the Decorator Pattern does specify an abstract component, but in Java, obviously, we could use an interface. But we always try to avoid altering existing code, so don’t “fix” it if the abstract class will work just fine
