Difference between Factory and Abstract Factory Pattern

Hi All What is the difference between Factory and Abstract Factory Pattern. I often get confuse between themThanks in advanceanu
[156 byte] By [anu_montoa] at [2007-10-2 12:47:38]
# 1

The Factory pattern is meant to give you the ability to generically construct objects (rather than explicitly declare what you want to create via the "new" keyword you defer to a factory and take what it gives you) The Abstract Factory pattern is meant to give you the ability to generically construct Factories. So, for instance, say you want to create widgets with a certain look and feel. You could use the Factory pattern and ask a ButtonFactory to make buttons and a TextArea factory to make TextAreas, but since you want the same look and feel for all widgets you could just ask the WidgetFactory to give you a WidgetFactory for a given Look and Feel and then ask it to make Buttons and TextAreas and whatever else, knowing that it has handled which kind of button and whatever else you need.

Hope that made sense, good luck

Lee

tsitha at 2007-7-13 9:57:36 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
Thanks Lee, it is clear now.
anu_montoa at 2007-7-13 9:57:36 > top of Java-index,Other Topics,Patterns & OO Design...