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

Difference between asp and asp.net, How would ASP and ASP.NET apps run at t...

How would ASP and ASP.NET apps run at the same time on the same server? Both ASP and ASP.net can be run at similar server, becuase IIS has the capability to respond/serve both

Experienced outlook developer, About us in a nutshell: We are a young start...

About us in a nutshell: We are a young start-up that trade a refreshing product in the field of enterprise software and develops with the latest technologies. We love to partner wi

Why project needed xml?, Explain why your project needed XML. Remember ...

Explain why your project needed XML. Remember XML was meant to exchange data between the two entities as you can define your user friendly tags with ease. In the real world sce

Accepting a list of 5 items - c# program, Accepting a List of 5 Items - C# ...

Accepting a List of 5 Items - C# Program Hello, I've been trying so many codes for this but those codes didn't work well. Please write the code for Accepting a List of 5 Items

Explain the concept of possible validation errors, Introduction to .NET Tec...

Introduction to .NET Technology 1. Explain the following with respect to .NET Technologies: a. Web Applications b. Web Server Connections 2. Write a sample program using AS

Explain the postback process as use with web forms, Question: (a) Expla...

Question: (a) Explain the Postback process as use with Web Forms. (b) Write extract codes to demonstrate how to store and retrieve values in: (i) a Session Object (ii)

Illustrate the basic process in an asp.net architecture, Problem: (a) ...

Problem: (a) (i) Using a diagram, illustrate the basic process in an ASP.NET Architecture involving at least five objects. (ii) List two methods and two collections

Bug prediction and correction, Bug Prediction and Correction Project Des...

Bug Prediction and Correction Project Description: The project is about the prediction of bugs and fixes the bug in the sample program using costriage algorithm. All the requ

Asynchronous one-way calls, What is Asynchronous One-Way Calls The One-...

What is Asynchronous One-Way Calls The One-way calls are a different from the asynchronous calls by the execution angle that the .NET Framework does not assure their execution.

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