Re: Why instantiate a class, all of whose methods, properties, and events are static?
- From: "Jon Skeet [C# MVP]" <skeet@xxxxxxxxx>
- Date: 5 Oct 2006 05:09:34 -0700
Laurent Bugnion wrote:
sherifffruitfly wrote:
Hi,
I'm learning the .net Bloomberg api, and it's main class has all of its
stuff static. The help then goes on to say that the class is
implemented as a singleton. It's cool I guess to make sure not more
than one instance can be made, but with everything in the class static,
I don't actually understand why even *one* instance is required.
What's the design rationale for this?
If all the methods and properties in the class are static, the correct
denomination is "facade". In the facade pattern, the class acts as a
"wall" to "hide" the calls to objects. Facade classes are at the limit
between OOP and procedural programming, and should IMHO be used with
reason. To ensure that instantiation is impossible, facade classes have
a private default constructor.
That's not my understanding of the facade pattern. To me, the facade
pattern just presents a simpler interface, quite possibly still
involving creating an instance.
See http://en.wikipedia.org/wiki/Fa%C3%A7ade_pattern
(Unfortunately I don't have my GoF book here to check with...)
Jon
.
- Follow-Ups:
- Re: Why instantiate a class, all of whose methods, properties, and events are static?
- From: Tom Porterfield
- Re: Why instantiate a class, all of whose methods, properties, and events are static?
- References:
- Why instantiate a class, all of whose methods, properties, and events are static?
- From: sherifffruitfly
- Re: Why instantiate a class, all of whose methods, properties, and events are static?
- From: Laurent Bugnion
- Why instantiate a class, all of whose methods, properties, and events are static?
- Prev by Date: Re: Eventhandlers, C#, VS2005
- Next by Date: Re: UrlDecode
- Previous by thread: Re: Why instantiate a class, all of whose methods, properties, and events are static?
- Next by thread: Re: Why instantiate a class, all of whose methods, properties, and events are static?
- Index(es):
Relevant Pages
|