473,802 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Design Pattern - Abstract Factory

max
Hello,

I analyze this design pattern for a long time but I do not understand how
this pattern work and what the purpose is? (I looked a this site
http://www.dofactory.com/Patterns/PatternAbstract.aspx).

Could anybody try to explain me in his own words how this pattern work and
what the purpose is?

thanks in advance

max

PS: Generally I do not understand why they use (also in Adapter) for example
AbstractFactory factory1 = new ConcreteFactory 1(); - Means they define a
object from an abstract class and create in this object a object from a
concrete class. What is the sense of that? :(
Nov 19 '05 #1
2 1585
the standard Factory pattern is to have a method that creates the object
rather tan using the new operator. but what happens if you waat to add a new
object creation type to the factory?

the case for this is when you create a class that inherits from the classes
the factory generates. say you have a class Widget, and a factory method
Widget.CreateWi dget(). now you create a new class MyWidget that inherits
from Widget. simple enough, but how do you get the Factory to create a
MyWidget, rather than a Widget.

this is what the abstract factory pattern is for, a way to replace the
factory code so that when a class calls Widget.CreateWi dget() it return an
instance of MyWidget.
-- bruce (sqlwork.com)

"max" <ma*@discussion s.microsoft.com > wrote in message
news:26******** *************** ***********@mic rosoft.com...
Hello,

I analyze this design pattern for a long time but I do not understand how
this pattern work and what the purpose is? (I looked a this site
http://www.dofactory.com/Patterns/PatternAbstract.aspx).

Could anybody try to explain me in his own words how this pattern work and
what the purpose is?

thanks in advance

max

PS: Generally I do not understand why they use (also in Adapter) for
example
AbstractFactory factory1 = new ConcreteFactory 1(); - Means they define a
object from an abstract class and create in this object a object from a
concrete class. What is the sense of that? :(

Nov 19 '05 #2
You usually use a configuration file together with the Abstract Factory
Pattern to get the most flexibility. You would use .NET Reflection to
create the MyWidget object at runtime by passing in the classname
string. There are several articles on this you can do the research on
this. I hopes this points you to the right direction.

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3152
by: Omer van Kloeten | last post by:
The Top Level Design: The class Base is a factory class with a twist. It uses the Assembly/Type classes to extract all types that inherit from it and add them to the list of types that inherit from it. During run time, using a static method, the class creates an instance of the derived class using the Activator class and returns it. This design pattern is very similar to the design pattern applied by the Assembly class. The twist is...
8
1693
by: Alex Vinokur | last post by:
Any links to get started with Design Patterns, including samples? Thanks in advance. Alex Vinokur email: alex DOT vinokur AT gmail DOT com http://mathforum.org/library/view/10978.html http://sourceforge.net/users/alexvn
4
2528
by: max | last post by:
Hello, I analyze this design pattern for a long time but I do not understand how this pattern work and what the purpose is? (I looked a this site http://www.dofactory.com/Patterns/PatternAbstract.aspx). Could anybody try to explain me in his own words how this pattern work and what the purpose is? thanks in advance
11
4312
by: FluffyCat | last post by:
In Febraury - April of 2002 I put together in Java examples of all 23 of the classic "Gang Of Four" design patterns for my website. Partly I wanted to get a better understanding of those patterns. They are still online at http://www.fluffycat.com/java/patterns.html Since September 2003 I've mainly been using PHP, and now that PHP 5 is becoming more available I am going to try the same thing I did in Java with PHP.
2
2303
by: Mike | last post by:
Hello NG, i am just learning various Design Patterns and now i am not sure, if this design is correct (Builder) or if i should use an other pattern. I have various classes (here ChildA and ChildB) derived from class Base. Now i want to create an object, but i don't want to know which class to instantiate.
2
1396
by: Chris | last post by:
Hi, I have been stuck trying to come up with a design for days. I am working on a small project regarding barcode and I want to implement a factory design. I am now confused. I decided factory pattern since I am dealing with EAN13, UPCA12 UPC8 etc. Can someone provide a small sample on how to start. I have looked at the factory implementation online but still can't figure it out. Can someone provide a sample jsut to start with.
1
1365
by: sunny | last post by:
Hai, can anyone provide me with documents related to factory desing pattern and Abstract factory pattern.where i can gain good understanding on the thesee design patterns. Regards, Sunny
10
2354
by: sunny | last post by:
Does this following program implement the factory design.if not what are things that i have to change in order to make this following program to be designed to factory design pattern. #include<iostream>
1
1758
by: =?Utf-8?B?RXJpYw==?= | last post by:
I am using the factory method to solve a problem where a factory can produce product. I have a base factory class and a base product class. The problem that I am having is that for every product subclass type I am having to create a factory subclass to handle differences in logic. They are becoming one to one. Is this ok? Should I look at another pattern to solve the problem? abstract Product Product1: inherits Product Product2:...
2
2567
by: Duy Lam | last post by:
Hi everyone, Sorry, I don't know what group to post this problem, I think may be this group is suitable. I'm styduing DAO (Data Access Object) pattern in this link http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html. While I've read about implementing Data Access Objects by Factory Method Pattern (http://java.sun.com/blueprints/corej2eepatterns/Patterns/images09/figure09_07.gif) and Abstract Factory Pattern...
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10536
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10063
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.