|Perl Monk, Perl Meditation|
Falling for the same trap – since 1942by Aristotle (Chancellor)
|on Jul 13, 2003 at 21:16 UTC||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.