> Yes indeed, the singleton pattern is the way to go for this.

I don't think singleton is suitable but who cares.. Seems to me, in general
for patterns, at the time of their final write-up (95?) single language and
environment were the norm. But if I recall correctly Gamma and IBM friends
mention different frameworks, templates and more. Lots of local insight,
old and good work referenced sure..

All of this I think was in abstract factory, factory method, facade,
prototype, template method patterns and who knows what other hatch-pattern.

But most are creational and one each for structural and behavioural. Did
time do its work?

> these instances are restricted to a single instance on a per-process
> basis.

I believe I see your point though, and my thoughts are that taking
interfaces closer to  'outside-world-interest' structural-typing rathen
than creation, behaviour, or internal representation of the structure helps.

And you are just hitting on a detail that I believe breaks most patterns in
network environment or new stacks.

One poor man singleton was probably a factory method returning a local
static, then a factory method allows you to template or grow and introduce
policies and schemas while retaining performance, compile-time checks and
to develop adaptive features, retaining interfaces etc. With it you
probably get a chance to assert or decouple from identities, and have an
initial analogue 'static' with identical constraints.

Thus for creation, perhaps you could instead of static decoration on a
class introduce a new type (just a class, no static) with factory method
and interface definition, place it with the implementation in a shared
assembly and check out attributes:

- on Assembly ( nomachine, noprocess, noappdomain; would have thought it
was removed, did not bother more than to check that ECMA still has it in
the grammar)

- and for object-to-data glue check out ideas behind [ServiceContract] and
what WS does on message-level.

What I was aiming at is that plenty of services out there require
no 'class' instance to have an interface (think of an empty slot on a PC :-
) to an operation or to the entire system. The idea behind it is that you
do not need to know the class or a particular one (or even whether it is
class-based 'solution'). And introducing a 'static class' muds the waters a
lot.

Theoretically it is abstract but it isn't and all out of reason it is
sealed at the same time (great, means to an end or preventing location-
dependent assumptions).

COM, Remoting were in with similar problems, with activation, singletons,
identities.. First iteration of WebServices support/ASPX had its own share
and the cost to nail it or not, even to date, is MBs in runtime penalty.

Something compiler with(out) an environment help should ideally be able to
figure out with minimal or no overhead whatsoever. And it does in this
example but for quite a while the focus was not on network interaction, but
grouping methods and classes and lifetime, ie. local work, local
composition, creation, instead of messages, their grouping  and message
patterns.

Not saying that OO design patterns are useless for local implementation.

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to