Skip to content

frkn2076/Decorator-Pattern

Repository files navigation

Decorator Pattern

A Simple Implementation Of Decorator Pattern Usage

Prerequisites

Have the knowledge of object-oriented programming.

Main Idea of the Decorator Pattern

It allows to add new functionality to an existing object without altering its structure.

What is the Problem Require the Decorator Pattern

Consider a case of a coffee shop. In the coffee shop they will sell decaf and espresso with extra choices like sugar, milk etc. Now imagine a situation wherein if the coffee shop has to provide prices for each combination of coffees and toppings. A customer can order an espresso with double sugar or a decaf with sugar and milk. Maybe coffee shop will decide to add other extra choices for its toppings in the future.

There is a best practice solution for these problems and this one called as Decorator Pattern :)

Have a look at my project for more detailed review.

I've tried to explain as short as possible. I hope everything is clear :)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages