Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Object creation

by rir (Vicar)
on Jun 03, 2009 at 14:06 UTC ( #768020=note: print w/ replies, xml ) Need Help??


in reply to Object creation

It depends.

If there is no state maintained in package variables, the motives to use an object are weakened. If you are maintaining state, you should do a bit of research on the singleton pattern.

Using an object allows an easier transition away from the singleton pattern if usage situations change.

The missteps that I've seen have involved not anticipating singleton breaking situations: adding extended info on objects by keying into another database, by industry standard codes, and by administrative matters where having the power of internal routines would have helped.

If in doubt, I'd present an object to client code just to stabilize the client interface.

Be well,
rir

Update: comma-fied list of "breaking situations"


Comment on Re: Object creation

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2014-07-12 18:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (240 votes), past polls