Wednesday, May 14, 2014

Simple Factory Pattern in Java

Simple Note

Simple Factory Pattern:
A method that can return different hardcoded subtypes.


BreadFactory that produce WonderfulBread at 3rd day of a week and produce CommonBread in other days

Can rely on the abstract class "Bread" in program, do not need to know whether it is a WonderfulBread or CommonBread


Factory (object-oriented programming)

Simple Factory vs. Factory Method vs. Abstract Factory

No comments:

Post a Comment