DEV Community

Discussion on: Advanced JavaScript Design Patterns

Collapse
 
daw_alberto profile image
Alberto GarcĂ­a

Hi Ravi đź‘‹

A post very interesting! I enjoyed reading it, but I have a little doubt
In the second design patter(Abstract Factory) you create the class DrinkFactory with the method prepare, and this method is never used why do you created it then?

Many thanks =)

Collapse
 
ravisojitra profile image
ravi

Thanks Alberto for this observation.
But it's kind of an extension of functionality if you want to use. Though i have not used it in example, but it can give you an idea that how you can customize the behaviour with base methods which can be applied to all the factories that extends base class.