design pattern

From: Hugo Batista (hlbatistaATgmail_at_nospam.com)
Date: 02/25/05


Date: Fri, 25 Feb 2005 12:04:44 -0000

Hi everybody,

I would like to have your opinion...

Imagine i have a pattern that defines:

- abstract factory : my consumer always handle with a interface and not with
direct implementation, and calls a factory to get an object instance;
- the kind of object returned in that instance varies according to some
settings and, in runtime, the factory reads settings and return the
configured object type that implements interface;
-Singleton/singlecall: the returned object can be singleton or singlecall
and that can be changed in settings at any time. The consumer should not
care about this and the factory handles this to know if he should mantain a
singleton instance or not;
- inproc/outproc : the object can be a remote one or a local one. the
consumer does not know this and the factory handles it all. that is also
defined in settings;

a settings example:

   <PatternProviderSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ObjectMode>SingleCall</ObjectMode>
    <AllowWeakReferenceOnSingleton>false</AllowWeakReferenceOnSingleton>
    <ProcessModel>InProc</ProcessModel>
    <RemotingUrl>tcp://localhost:9999/LocalPatternsProvider</RemotingUrl>
    <Provider>DotNetX.CodeGeneration.Patterns.LocalPatternsProvider,
DotNetX.CodeGeneration</Provider>
   </PatternProviderSettings>

- Objectmode allows singleton or singlecall
- AllowWeakReferenceOnSingleton indicates to the factory if he should keep a
weakreference or a reference, so the GC can handle it if needed
- ProcessModel indicates inproc or outproc
- RemotingUrl indicates the object remote url if outproc
- Provider indicates the final implementation (the type of object to be
created)

my question is:
between existing enterprise patterns, which do you think that apply to this
? i already know that abstract factory applys, but i wonder if other also
apply ... what about strategy design pattern ? do you think it applies ?

regards!
and thanks for your contribution..
HB

www.dotnetx.org



Relevant Pages

  • Re: Abstract public member variales?
    ... The relationship is instantiated in the factory and remains ... Serializable.saveItwhen using the Serializer pattern. ... Context upon any one particular algorithm of a class of related ... responsibilities of Context; ...
    (comp.object)
  • Re: design pattern
    ... don't you think it's something more closer from Strategy Pattern? ... > Aspect Oriented Programming. ... and calls a factory to get an object ... >> settings and, in runtime, the factory reads settings and return the ...
    (microsoft.public.dotnet.framework)
  • Re: Which pattern does this conform to?
    ... Andrew McDonagh wrote: ... concrete factory class; but I usually do allow the user to switch ... implementations behind the factory's interface. ... factory pattern offers the advantage that, if the user is careful, he ...
    (comp.object)
  • Re: design pattern
    ... > The pattern is called Inversion of Control. ... > Aspect Oriented Programming. ... >> settings and, in runtime, the factory reads settings and return the ...
    (microsoft.public.dotnet.framework)
  • Re: design pattern
    ... The pattern is called Inversion of Control. ... and calls a factory to get an object instance; ... > settings and, in runtime, the factory reads settings and return the ... > -Singleton/singlecall: the returned object can be singleton or singlecall ...
    (microsoft.public.dotnet.framework)