Difference between factory and abstract factory patterns, DOT NET Programming

What is the difference between Factory and Abstract Factory Patterns?

The main basic difference between factory and Abstract factory is factory method uses the  inheritance to decide which object has to be instantiated while the abstract factory uses the delegation to decide the instantiation of the object. We can say that Abstract factory uses factory method to done  the architecture. The Abstract Factory is one level greater  in abstraction over the Factory.

The 2  class figure  below will provide the overview of what is the actual difference. First figure shows a sample  of the implementation of the Factory Patterns. In this figure there are2  basic sections:-

1)The actual product section that  is  Class "Product" it inherits from an abstract class "AbstractProduct".

2)The creational aspect part that is . "ConcreteCreator" class which inherits from class "Creator".

3)Now there are various rules that the client will have to follow who will require the "Product" object. He will never suggest directly to the actual "Product" object he will suggest  the "Product" object by using the "AbstractProduct".

4)The Second client will never use the "New" keyword to create the "Product" object but will use "Creator" class which in turn will use "ConcreteCreator" class to create a  actual "Product" object.

502_factory pattern.png

Figure: - Class diagram of a factory Pattern

Now let's look at the second class diagram that provides an overview of what actually the "Abstract factory" pattern is. It creates objects for families of the classes. In brief it describes the collection of factor methods from different families. In brief it groups related to factory methods. For e.g.  in this the class "Creator" is implemented by using the "Abstract" factory pattern. It then  creates objects from the multiple families rather than one product.

2080_factory pattern1.png

Figure:-Class Diagram of Abstract Factory

Posted Date: 9/22/2012 6:16:04 AM | Location : United States







Related Discussions:- Difference between factory and abstract factory patterns, Assignment Help, Ask Question on Difference between factory and abstract factory patterns, Get Answer, Expert's Help, Difference between factory and abstract factory patterns Discussions

Write discussion on Difference between factory and abstract factory patterns
Your posts are moderated
Related Questions
Hardware Monitor Tool in Visual Basic Project Description: Hi, seeking a developer who is experienced in Visual Basic 10 Or Visual Basic 13 and will develop an application li

What is the use of data adapter? The Data adapter are the objects that connect one or more Command objects to a Dataset object. They give logic that would get data from the dat

Project Description: I have various C# support projects and no time, so I'm seeking for a junior programmer to help out. This intro project is a C# module to develop the UI a

Project Description: Overview: Prepare Windows program that runs in the background and on start up on the client's computer that grabs CERTAIN data from a.SDF file (SQL Serve

I am seeking someone (person or company) who already has been developing some ASP.NET MVC 4 application with the subsequent requirements (so there is no need to spend extra time to

What is scavenging? When server running your ASP.NET application runs low on the memory resources, items are discarded from the cache depending on cache item priority. The Cach

how can i construct er diagram for payroll managment

How inheritance is achieved in VB.NET? The Inheritance is achieved by using "Inherits" keyword in the VB.NET (& For C# it is ":"). Easy Sample is provided in CD for understandi

Converting $ into Rs.  - C# Program I am a learner of C# language and i am struggling with how to convert $ into Rs. in C#. Can you have any code examples for this?

C# coding to include user specified screen recording to app Project Description: Reposting as selected coder didn't read brief and accepted job to do then tell me would be in