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

Re^3: Strict isn't strict enough (stop it)

by tye (Cardinal)
on Dec 31, 2011 at 18:02 UTC ( #945758=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Strict isn't strict enough (stop it)
in thread Strict isn't strict enough

"Don't poke yourself in the eye."
"Doctor, it hurts when I slice through my eye with a chainsaw."

Although the docs you linked to are a bit over-the-top (quite an unfortunate thing in such a core module), they make a good point:

To provide the capability to set/get class-wide settings, it is best instead to provide accessors as subroutines or class methods instead.

The docs said, "Don't do X, do Y instead" and you used them to justify, "Since I can't do X, I'll do W" where "W" is a much worse idea than "X".

What you are doing is equivalent to having public attributes in a class. That makes for pretty bad class design (of course, some people have a hard time even conceiving of class design without the equivalent of public attributes; for example, take a critical look at Moose ;).

I'll let you struggle with whether you should abandon exposing global variables for your interface and replace them with global subroutines instead. There can certainly be advantages to that. But I won't try to scare you into such a decision with over-the-top proclamations. "Trust me". (:

- tye        


Comment on Re^3: Strict isn't strict enough (stop it)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2015-07-29 05:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls