Re: Why instantiate a class, all of whose methods, properties, and events are static?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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

.



Relevant Pages

  • Re: Why instantiate a class, all of whose methods, properties, and events are static?
    ... Jon Skeet wrote: ... denomination is "facade". ... Facade pattern and whether or not methods are static are not related. ... An example would be if you have a fairly common operation to perform that requires some complex coordination among other objects. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Why instantiate a class, all of whose methods, properties, and events are static?
    ... The Facade pattern is a way to create a simple interface on top of a complex system. ... An example would be if you have a fairly common operation to perform that requires some complex coordination among other objects. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Facade
    ... I've been thinking about the facade pattern lately, and it seems to me that ... one very good use for it is to implement one facade in every subsystem, ... from that namespace, simplifying things for 90% of clients in other ... the Facade can be a collection of abstract classes providing access to ...
    (comp.object)