Difference between factory and abstract factory patterns, DOT NET Programming

Assignment Help:

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


Related Discussions:- Difference between factory and abstract factory patterns

Webpage builder windows application, Webpage builder windows application + ...

Webpage builder windows application + source code + installer + user friendly interface. Project Description: Website Builder As its name suggests, the site builder should

What is the difference between int and int32, What is the difference betwee...

What is the difference between int and int32. There is no difference among int and int32. System.Int32 is a .NET Class and int is an alias name for System.Int32.

What is semantic gap, What is semantic gap? Defining a useful channel i...

What is semantic gap? Defining a useful channel includes both understanding the applications requirements and recognizing the limitations of the underlying technology. The gap

Define an event, Define an event. Whenever an action takes place in a c...

Define an event. Whenever an action takes place in a class, that class gives a notification to other classes or objects that are assigned to perform certain tasks. These notifi

Grid view, to design a grid view and edit and delete the data

to design a grid view and edit and delete the data

We need long term kentico developer, We need Long term Kentico developer ne...

We need Long term Kentico developer needed I want a solid Kentico developer that I can rely on to handle overflow work. Usually this will include about 5 hours of work each week

I need cell phone pinging for fugitive tracking, I need CELL PHONE PINGING ...

I need CELL PHONE PINGING for fugitive tracking Project Description: I want an application like the following: it provides cell phone pinging(location information via gps) wi

Converting $ into rs. - c# program, Converting $ into Rs.  - C# Program ...

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?

Codedom, What is CodeDom The "CodeDom" is an object model that represen...

What is CodeDom The "CodeDom" is an object model that represents actually a source code. It is designed for language independent - once you create a "CodeDom" hierarchy for a p

Disco, What is DISCO? The Web Service Description Language (WSDL) is a ...

What is DISCO? The Web Service Description Language (WSDL) is a W3C specification which defines the XML grammar for describing the Web Services.XML grammar describes details li

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd