02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School

Decorator Design Pattern

The decorator enables us to add functionality to an existing object without needing to create a new inheritance chain or update the prototype. The idea is to add functionality to items based on need instead of adding them to the object from the get-go. This can become very useful when you have multiple objects with partially shared functionality.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!

Abstraction

- Abstraction is key to making flexible designs. - Not everything needs to be planed in advance. - Modularly updating components to fit changes.

09:22

Adapter Design Pattern

- You need to keep an object with the same interface. - But, a library component demands a different interface. - or the object is missing a methods in it's API.

06:17

Composite Design Pattern

- Multiple objects with the same API. - When you need to control all at the same time. - Ideal in recursive elements that are %u201Cchained%u201D to each other.

12:15

Decorator Design Pattern

- Adding features to specific items. - Without creating a subclass. - Or changing the original interface/constructor.

04:30