473,394 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 ConcreteFactory1(); - 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 1554
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.CreateWidget(). 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.CreateWidget() it return an
instance of MyWidget.
-- bruce (sqlwork.com)

"max" <ma*@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.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 ConcreteFactory1(); - 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
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...
8
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...
4
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...
11
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....
2
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...
2
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...
1
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
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. ...
1
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.