Views: 15.9K
Replies: 1
Archived
|
What is the difference between Abstract Factory Pattern And Builder PatternHİ, I think that you discussed this quesiton before. But I couldnot find is there topic like this question on here I wrote a car factory with abstract factory pattern. I have 2 factory ( MercedesFactory,HondaFactory) and i have 4 concrete class (MercedesFamilyCar,MercedesSportCar,HondaFamilyCar,HondaSportCar ) .I have a abstract classess Family and Sport which includes below methods. public abstract void Speed(); public abstract void Wheel(); public abstract void Door(); public abstract void Price(); public abstract void Display(); So my question is i can do this with builder pattern. Assume that its name is CarBuilder instead of CarFactory. What is the main difference between Builder and Abstract Factory Pattern. Thanks. Best Regards. Volkan Genç, Feb 01, 2012
|
|
Reply 1Hi,
The main difference between Abstract and Builder pattern is Abstract will return the instance directly while in Builder there will be one Director class which will instruct Builder class to build the different parts/properties of your object and finally retrieve the object. Also, Abstract does not keep the track of it's created object while Builder will have reference to the created object. Regards, Ankit Parikh Ankit Parikh, Feb 02, 2012
|