Click here to Skip to main content
15,891,597 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: Microsoft Application Architecture Guide Pin
GenJerDan3-Aug-11 6:13
GenJerDan3-Aug-11 6:13 
GeneralRe: Microsoft Application Architecture Guide Pin
V.3-Aug-11 19:54
professionalV.3-Aug-11 19:54 
QuestionData Fusion Pin
TorstenH.18-May-11 3:44
TorstenH.18-May-11 3:44 
AnswerRe: Data Fusion Pin
thatraja11-Jun-11 14:31
professionalthatraja11-Jun-11 14:31 
GeneralRe: Data Fusion Pin
TorstenH.13-Jun-11 21:06
TorstenH.13-Jun-11 21:06 
QuestionAbstract factory Pin
Phil00515-May-11 1:37
Phil00515-May-11 1:37 
AnswerRe: Abstract factory Pin
Phil00516-May-11 23:58
Phil00516-May-11 23:58 
AnswerRe: Abstract factory PinPopular
David Skelly17-May-11 2:14
David Skelly17-May-11 2:14 
The abstract factory pattern is explained fairly well here:

http://en.wikipedia.org/wiki/Abstract_factory_pattern[^]

It returns Base as the object type because different factories will return different types of object, but those objects must have something in common.

Imagine a VehicleFactory interface with a method GetVehicle that returns a Vehicle. One type of VehicleFactory might be a PetrolVehicleFactory, that returns vehicles that run on petrol. Another might be an ElectricVehicleFactory that returns electric-powered vehicles. Both of these return type Vehicle, so I can use the factories interchangeably without having to worry about whether it is an ElectricVehicle or a PetrolVehicle that is being handed to me.

VehicleFactory myFactory = new PetrolVehicleFactory();
Vehicle myVehicle = myFactory.GetVehicle();
myVehicle.Start();
myVehicle.DriveOffIntoTheSunset();


I can swap PetrolVehicleFactory for ElectricVehicleFactory, and nothing else in my application needs to be changed:

VehicleFactory myFactory = new ElectricVehicleFactory();
Vehicle myVehicle = myFactory.GetVehicle();
myVehicle.Start();
myVehicle.DriveOffIntoTheSunset();


As long as ElectricVehicle and PetrolVehicle both do what a Vehicle is supposed to do, I don't care what exact type of Vehicle the factory gives me. I just want a Vehicle so that I can drive off into the sunset. It's the factory's responsibility to know what type of Vehicle to make and how to make it.
GeneralRe: Abstract factory Pin
Richard MacCutchan17-May-11 2:36
mveRichard MacCutchan17-May-11 2:36 
GeneralRe: Abstract factory Pin
Phil00517-May-11 3:06
Phil00517-May-11 3:06 
GeneralRe: Abstract factory Pin
Shameel17-May-11 4:21
professionalShameel17-May-11 4:21 
GeneralRe: Abstract factory Pin
Phil00520-May-11 22:09
Phil00520-May-11 22:09 
QuestionUML state diagrams Pin
Phil00510-May-11 7:39
Phil00510-May-11 7:39 
AnswerRe: UML state diagrams Pin
Gerben Jongerius10-May-11 21:19
Gerben Jongerius10-May-11 21:19 
GeneralRe: UML state diagrams Pin
Phil00515-May-11 1:22
Phil00515-May-11 1:22 
AnswerRe: UML state diagrams Pin
Keld Ølykke24-May-11 3:16
Keld Ølykke24-May-11 3:16 
GeneralRe: UML state diagrams Pin
Phil00527-May-11 1:04
Phil00527-May-11 1:04 
QuestionStored Procedures Pin
Leslie Sanford9-May-11 17:38
Leslie Sanford9-May-11 17:38 
AnswerRe: Stored Procedures Pin
Gerben Jongerius10-May-11 21:27
Gerben Jongerius10-May-11 21:27 
AnswerRe: Stored Procedures Pin
jschell24-May-11 8:43
jschell24-May-11 8:43 
QuestionThinking about the Future Pin
John D. Sanders6-May-11 8:53
John D. Sanders6-May-11 8:53 
AnswerRe: Thinking about the Future Pin
Pete O'Hanlon6-May-11 9:26
mvePete O'Hanlon6-May-11 9:26 
GeneralRe: Thinking about the Future Pin
Sandeep Mewara6-May-11 17:41
mveSandeep Mewara6-May-11 17:41 
GeneralRe: Thinking about the Future Pin
Pete O'Hanlon6-May-11 22:39
mvePete O'Hanlon6-May-11 22:39 
GeneralRe: Thinking about the Future Pin
Paul Michalik14-May-11 22:56
Paul Michalik14-May-11 22:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.