Hi,
I am a fairly seasoned developer and have recently started looking at
software design patterns. I am starting with the Abstract Factory Pattern
and was wondering if someone could help me understand where I might use this
Pattern. I get the general concept but I am having a hard time converting
that concept into where I might use that in a real world scenerio for a
business application or web development project.
I appreciate the fact that this is a conceptual question, and I appreciate
your time.
Thank you!
Ron
May 15 '07
16 2647
So correct me if Im wrong....
The Abstract Factory is really like a runtime switch that instntiates the
appropriate class based on the conditions at run time. It encapsulates not
only the classes but the logic associated with selecting the appropriate
class to create the object.
The use of an interface further promotes loose coupling between the factory
and the underlying classes.
I can see the usefullness in this for sure.
Ron
"RSH" <wa************ *@yahoo.comwrot e in message
news:eB******** ******@TK2MSFTN GP03.phx.gbl...
Hi,
I am a fairly seasoned developer and have recently started looking at
software design patterns. I am starting with the Abstract Factory Pattern
and was wondering if someone could help me understand where I might use
this Pattern. I get the general concept but I am having a hard time
converting that concept into where I might use that in a real world
scenerio for a business application or web development project.
I appreciate the fact that this is a conceptual question, and I appreciate
your time.
Thank you!
Ron
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comwrote in
message news:Od******** ******@TK2MSFTN GP04.phx.gbl...
>What happens when you add a provider that's not part of the "standard" .NET Framework, e.g. MySQL or SqlCe...?
If your DAL factory includes SqlClient, Oracle *and* MySQL and you try to run it on a machine which doesn't have the MySQL .NET native data provider, won't your app fall over due to missing references etc...?
Yes, it will fail at runtime. It will fail when you first try to use it
Just to clarify, does that mean the app will fail the first time it tries to
use any part of the DAL...?
E.g. if your DAL supports both SqlClient and SqlCe, can you still use the
SqlClient "bits" even if the SqlCe runtime isn't installed...?
-- http://www.markrae.net
Hi,
"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comwrote in
message news:Od******** ******@TK2MSFTN GP04.phx.gbl...
>>What happens when you add a provider that's not part of the "standard" .NET Framework, e.g. MySQL or SqlCe...?
If your DAL factory includes SqlClient, Oracle *and* MySQL and you try to run it on a machine which doesn't have the MySQL .NET native data provider, won't your app fall over due to missing references etc...?
Yes, it will fail at runtime. It will fail when you first try to use it
Just to clarify, does that mean the app will fail the first time it tries
to use any part of the DAL...?
The application will fail when you first try to use any feature not
currently present in the machine.
In my example if I have no registered the OleDB provider for VFP
(vfpoledb.dll) the application throw an exception when I try to create it
:OleDbConnectio n conn = new OleDbConnection ("......");
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comwrote in
message news:ed******** *****@TK2MSFTNG P03.phx.gbl...
"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comwrote in message news:Od******** ******@TK2MSFTN GP04.phx.gbl...
>>>What happens when you add a provider that's not part of the "standard" .NET Framework, e.g. MySQL or SqlCe...?
If your DAL factory includes SqlClient, Oracle *and* MySQL and you try to run it on a machine which doesn't have the MySQL .NET native data provider, won't your app fall over due to missing references etc...?
Yes, it will fail at runtime. It will fail when you first try to use it
Just to clarify, does that mean the app will fail the first time it tries to use any part of the DAL...?
The application will fail when you first try to use any feature not
currently present in the machine.
In my example if I have no registered the OleDB provider for VFP
(vfpoledb.dll) the application throw an exception when I try to create it
:OleDbConnectio n conn = new OleDbConnection ("......");
OK - thanks very much...
-- http://www.markrae.net
Mark Rae <ma**@markNOSPA Mrae.netwrote:
I'm sure with suitable levels of indirection it should be okay.
All my work tends to be targeted at one specific RDBMS - I've never been
asked to write anything which supported multiple providers...
I've only done one project which really needed it, but then we used
Hibernate so we didn't have our own abstract factory anyway. We only
needed two types of servers for production - Oracle and SQL server -
but we developed and ran unit tests against HSQLDB as well, which was
blindingly fast and therefore great for unit tests.
It's certainly interesting writing multi-backend solutions.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
There is a difference between the Simple Factory Pattern
and the Abstract Factory Pattern.
I'm very good with the Simple (of course, its simple) pattern.
The Abstract one illudes you for a while, but you can get it. http://www.dofactory.com/Patterns/PatternAbstract.aspx
but the example is a not so crystal clear.
I have a java book at home ... that gave me an example that I could finally
figure it out.
Let me know if you're interested in the ISBN.
"RSH" <wa************ *@yahoo.comwrot e in message
news:Om******** ******@TK2MSFTN GP06.phx.gbl...
So correct me if Im wrong....
The Abstract Factory is really like a runtime switch that instntiates the
appropriate class based on the conditions at run time. It encapsulates
not
only the classes but the logic associated with selecting the appropriate
class to create the object.
The use of an interface further promotes loose coupling between the
factory
and the underlying classes.
I can see the usefullness in this for sure.
Ron
"RSH" <wa************ *@yahoo.comwrot e in message
news:eB******** ******@TK2MSFTN GP03.phx.gbl...
Hi,
I am a fairly seasoned developer and have recently started looking at
software design patterns. I am starting with the Abstract Factory
Pattern
and was wondering if someone could help me understand where I might use
this Pattern. I get the general concept but I am having a hard time
converting that concept into where I might use that in a real world
scenerio for a business application or web development project.
I appreciate the fact that this is a conceptual question, and I
appreciate
your time.
Thank you!
Ron
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Medi Montaseri |
last post by:
Hi,
Given a collection of similar but not exact entities (or products)
Toyota, Ford, Buick, etc; I am contemplating using the Abstraction pattern
to provide a common interface to these products. So I shall have an
Abstract Base called 'Car' implemented by Toyota, Ford, and Buick.
Further I'd like to enable to client to say
Car *factory;
|
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
|
by: Chris Capel |
last post by:
What is the rationale behind the decision not to allow abstract static class
members? It doesn't seem like it's a logically contradictory concept, or
that the implementation would be difficult or near-impossible. It seems like
it would be useful. In fact, there's a place in my code that I could make
good use of it. So why not?
Chris
|
by: Julia |
last post by:
Hi,
I have an application composed from layers like the following
A
--B
---C
A is the top layer
C uses an Abstract Factory to Create Concrete classes
|
by: Christer |
last post by:
Hi all!
We're creating an administration for a web application. This includes
severeal aspx pages.
Our key entity in the web application is "Profile", which can have a
certain type.
Based on the profile type, the administration pages will have some
small changes, such as displaying a few extra tabs, or maybe change
the available choices in a dropdown.
| |
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...
|
by: suresh_rai |
last post by:
Hello
I am hoping someone can give me very needed help. I am wanting some C+
+ code for 'C++ Abstract Factory'. I need code to be free. I am been
learning Design patterns.
I found some code on web but dont know which is one is ok.
http://programmerjoe.com/2007/03/18/the-abstract-factory-pattern-in-c/
http://www.codeproject.com/KB/architecture/DesignPattern.aspx
Loki :in text book
http://sourceforge.net/projects/papafactory
|
by: C# |
last post by:
http://www.questpond.com/FreeDesign1.htm
I was going through the above videos. Can i conclude Abstract factory
patterns are extensions of factory patterns. I have made the
conclusion after viewing the video and reading GOF books. I am
confused by these two patterns.
|
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...
|
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,...
|
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...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |