Hi Nikhil
good examples. I have something to add.
You know I have endedup using something which I would like to explain using your code samples. You have the, interface AbstractComponents ...now,
instead of that I created abstract class AbstractComponents like,
you see what I am doing? In actual code I use, I read the "componentName" classname from a configuration file. So as a result my code is completely independent of the actual classes
and I we change one entry in the config file the "whole" factories/objects returned from factory changes
The only issue is I am following logical convention to have "getInstance" method name in each of the child AbstractComponent factory but I thought it was reasonable given the flexibility it gives me..
Please provide your thoughts on this.
Here, my confusion while designing this was "what is AbstractFactory and what is Factory Method"...But I have come to the following conclusion,
1. My AbstractComponent is AF
2. AF's impl - MotifAbstractComponent is FM but I force it to impl methods of returning specified objects via parent AF...
People, please feel free to provide your thoughts here..
Regards,
Maulin