7. Factory Method Pattern
Define an interface for creating an object, but let
subclasses decide which class to instantiate.
Factory Method lets a class defer instantiation to
subclasses.
8. When To Use . . .
Useful when there is some generic processing in a class
but the required sub-class is dynamically decided at
runtime.
when the client doesn't know what exact sub-class it
might need.
10. Builder Pattern
Allows you to create different flavors of an object while
avoiding constructor pollution
Useful when there could be several flavors of an object.
Or when there are a lot of steps involved in creation of an
object
11. When to Use . . .
When there could be several flavors of an object and to
avoid the constructor telescoping.
builder pattern is to be used when the creation is a multi
step process