Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I found this tiny article a few days ago: Session Object considered Harmful

When I read the conclusion, it immediately reminded me of the assertion about the common Perl object orientation pattern (using an anonymous hash to store instance data) that Abigail strived to correct by inside out objects.

Which reminds me I have seen this antipattern elsewhere: Singletons are likely to lead to the same problem.

I’m talking about global variables – a master shape shifter concept that seems to crop up in every paradigm sooner or later, and is seldomly easy to identify for what it is at first glance – even when in retrospect, it is perfectly obvious.

The lesson I’m taking home from seeing the same concept identified so many times in so many different shapes is to constantly be on the lookout for it. It is everywhere.

(Obviously, session objects are still useful. So are singletons. So can hash based Perl objects be. Since obviously, so can globals be. But you have to be very careful and discriminating when employing them; it is easy to get them wrong.)

Update: fixed some really braindead grammar screw ups.

Makeshifts last the longest.


In reply to Falling for the same trap – since 1942 by Aristotle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-23 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found