Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2018-06-19 10:38 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (113 votes). Check out past polls.