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

I need the itunes producer gui reproduced in asp.net, I want the iTunes pro...

I want the iTunes producer GUI reproduced in ASP.NET MVC using c# / html / js. The part involved deals with creating album / track metadata. The data entered on the website form

Code for the file dependency in cache, Show the code for the file dependenc...

Show the code for the file dependency in cache? Partial Class Default_aspx Public Sub displayAnnouncement() Dim announcement As String If Cache("announcement") Is Noth

Various types of transactions in com + .net, Types of Transactions in COM +...

Types of Transactions in COM + .NET There are 5 types of transactions that can be used with COM+.   An object is whenever registered with the COM+ it has to abide either to any

Web based program prepared with net c# and sql server, Project Description:...

Project Description: We have a web based program prepared with .NET C# and Microsoft SQL Server. There are some reports needs to be created. Required Skills. - High Pro

Wp7 get data from public api with xml or json, WP7 get data from public API...

WP7 get data from public API with XML or JSON Project Description: Hello, I'm seeking someone who knows his way around using an API with XML or JSON output in a windows phone

Construct a .net wrapper for a c++ dll, Project Description: We have a c...

Project Description: We have a classic VC++ Dll (source code of DLL not available) that requires a .NET wrapper built by you. Use latest Visual Studio and.Net framework should b

Use a checkbox in a datagrid, How to use a checkbox in a datagrid? The ...

How to use a checkbox in a datagrid? The steps to be done are as follows:- 1)    In the ASPX page you have to add Itemtemplate tag in datagrid. 2) I

Explain application start and session start subroutines, Can you give an ex...

Can you give an example of what might be best suited to place in the application_Start and Session_Start subroutines? Application Start - We can place code to initialize

Customer management project, This is a Customer Management project. Custome...

This is a Customer Management project. Customer data is offered in a text file. The program may load this text data into its database columns. The data mapping is user definable. U

MVC, how can we use entity framework in ASP.Net MVC

how can we use entity framework in ASP.Net MVC

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