Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Re: The world is not object oriented

by stvn (Monsignor)
on Jan 03, 2004 at 06:21 UTC ( #318473=note: print w/ replies, xml ) Need Help??

in reply to Re: The world is not object oriented
in thread The world is not object oriented

I agree with you, alot of Singleton classes are mearly modules shoe-horned into classes. But i disagree that this is reason not to use OO and instead use a plain ole module. It is largely dependent upon the context. While I always advocate mixed paradigm programming within the larger application, I think that on a smaller scale, paradigms should be reasonably seperated.

If my application is largely OO, then a Singleton approach/syntax makes sense. A Singleton's singular instance can be passed around and treated like any other object, the other objects blind to its Singleton-ness. In this case the module approach/syntax would be awkward and clumsy.

Now if my application is largely procedural/imperitive/functional style, then the module approach/syntax makes much more sense. It fits the context here. Where an Singleton object would be akward and clumsy.

Ideally a module should provide both interfaces (if appropriate), much like (yes i know just auto-creates an object instance for you if you use the non-OO interface, but hey, encapsulation isn't just for OO).


Comment on Re: Re: The world is not object oriented

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://318473]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2015-12-01 14:44 GMT
Find Nodes?
    Voting Booth?

    My keyboard shows this many letters:

    Results (12 votes), past polls