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