Acknowledgment class/device  
Author Message
.:[NeMo]:.





PostPosted: 2003-12-26 8:03:00 Top

java-programmer, Acknowledgment class/device We assume of having a device that generically we model with the Device
class and that will be best specified with the class VCR extension of
Device.
Moreover we assume of having an application (class) Host that knows the
class Device but not VCR;
I would to make so that the device recognizes himeself (based on its
property/features) and that the class Host make an istance of VCR.
Something like
Device dev = new VCR(... pars ...);

In practical on different devices I'll have the same classes Device and
Host and moreover for everyone device I'll have a specific class
extension of Device (is VCR, PC, Freezer etc.).
The class extension could be in one specific folder.

How to make?
Also ideas, suggestions, link
thanks
 
.:[NeMo]:.





PostPosted: 2003-12-26 18:05:00 Top

java-programmer >> Acknowledgment class/device Somebody tell me Abstract Factory ....
any suggestion ?
 
Andrew Thompson





PostPosted: 2003-12-27 0:49:00 Top

java-programmer >> Acknowledgment class/device ".:[NeMo]:." <email***@***.com> wrote in message
news:UITGb.7888$email***@***.com...
> Somebody tell me Abstract Factory ....

(shrugs) 'Abstract Factory' ..does that do it?

> any suggestion ?

If not, maybe you should explain your
question further.


 
 
.:[NeMo]:.





PostPosted: 2003-12-27 1:31:00 Top

java-programmer >> Acknowledgment class/device The idea of Abstract Factory :

http://www.castle-cadenza.demon.co.uk/abfact.htm

http://www.developer.com/java/other/article.php/626001

(nothing special)

In a class, that I call Node, I need of a way in order to obtain a
reference to one class (DeviceX) specific for host X.
(DeviceX is extension of AbstractDevice).

ex.
class Node { /* the same class on all host */
.....
AbstractDevice dev = AbstractFactory.getDevice();
^----reference to a specific class DeviceX
/* depending from host */
.....
}

On every host there will be a class (FactoryX) that it will be taken
care to assign the opportune values to the fields of DeviceX.
(FactoryX is extension of AbstractFactory).

The class Node is common to all hosts, the classes DeviceX and FactoryX
depend to the specific host:
Node (on host X) must generate an istance for DeviceX without to notice
that it uses a different class depending host.

thanks