Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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 CGI.pm. (yes i know CGI.pm just auto-creates an object instance for you if you use the non-OO interface, but hey, encapsulation isn't just for OO).

-stvn


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2014-10-26 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (151 votes), past polls