When request reaches code responsible for creating objects, It will call the creator. Then the creator will call appropriate concrete creator (here sedan Creator). Then the concrete creator will creates the car and if required it is connects to database for each units then return it to the original requester.
Notes:
It is similar to abstract factory pattern, but there are few difference
- In abstract factory pattern, original requester was requesting for more than one type of related objects(car and cycle). Here only single object (only car) even though it is not mandatory.
- In abstract factory pattern, more level of abstraction is there and it is helping us to change the factory itself. Here only the product we are able change not the factory.
No comments:
Post a Comment