For Programmers: Free Programming Magazines  


Home > Archive > Software Engineering > May 2006 > Abstract Factory or Factory?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Abstract Factory or Factory?
Saurabh Aggrawal

2006-05-26, 4:02 am

I have application called "Client" whose function is to monitor the
status of application "Server". Client is polling Server every 2
seconds for its current status. Server's status could be X, Y, Z, XX
,YY ,ZZ. Depending on the state of the Server the Client will popup a
dialog box that will be different for all the state's of Server. i.e
for the status X in Server the Client has dialog box DiaX in it.
Similarly DiaY, DiaZ and so on.....
-------------
| |
| Status |
----|---------
|
|
|--------|-------|--------|--------|---------|
X Y Z XX YY ZZ
------------
| |
| Dialog |
----|---------
|
|
|--------|-------|--------|--------|---------|
DiaX DiaY DiaZ DiaXX DiaYY DiaZZ


and the code goes like this:----

if(Status == iX)
{
X = new X();
DiaX = new DiaX();
}
else if(Status == iY)
{
Y = new Y();
DiaY = new DiaY();
}
.........
........
........
.......so on

Could you please suggest me which pattern to use, Fatory Pattern or
Abstract Factory Pattern. I think i am having problems understanding
them.

Thanks,
Saurabh Aggrawal

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com