ant elder wrote:
On 10/1/07, Jean-Sebastien Delfino <[EMAIL PROTECTED]> wrote:
ant elder wrote:
On 9/27/07, Jean-Sebastien Delfino <[EMAIL PROTECTED]> wrote:

<snip>


Why all the static and abstract methods? Is there a reason SCADomain

couldn't just be an interface with a separate SCADomainFactory for
creating
instances?


 I don't know. A factory works for me.

+1 for making SCADomain an interface

+1 for having a factory

So instead of:
SCADomain domain = SCADomain.newInstance(...)

We'll have:
SCADomainFactory domainFactory;
SCADomain domain = domainFactory.createSCADomain(domainURI)

Now how do people would like to the get factory? a pretty common
pattern
is:
SCADomainFactory domainFactory = SCADomainFactory.newInstance(...)

Is there a better pattern?

Does that answer the question about "why the static and abstract
methods"? :)

The question wasn't so much about why use static and abstract methods
but
why they were all munged into the one SCADomain class, now that its
accepted
that is better to have a separate SCADomain interface i think  its fine
to
keep the static and abstract methods on the SCADomainFactory as that
keeps
the API simple to use. So this code:

SCADomainFactory domainFactory = SCADomainFactory.newInstance();
SCADomain domain = domainFactory.createSCADomain("
http://mydomain:7890/asmalldomain";);

could be simplified to:

SCADomain domain = SCADomainFactory.createSCADomain("
http://mydomain:7890/asmalldomain";);

   ...ant


Can you help me understand:
- how people will be able to plug-in different factories?
- how to pass the factory to use? I'm not sure I understand how it'll be
possible with createSCADomain() being a static method.

Thanks

--
Jean-Sebastien


Um, it would just work similarly to the current SCADomain class, the impl of
any other static methods can still call newInstance so can still plug in
different factories.

   ...ant


Sorry I still don't understand how

SCADomain domain = 
SCADomainFactory.createSCADomain("http://mydomain:7890/asmalldomain";);

will allow to plug-in different factories. I'm guessing how it'll allow to 
plug-in different Domain implementations (like SCADomain did) but I'm confused 
by the factory proposal.

What will the factory look like to allow for pluggability? and once a factory 
has been selected how will it be passed around?

--
Jean-Sebastien


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to