| 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
|