Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Using closures to achieve data hiding in OO Perl

by demerphq (Chancellor)
on Jun 13, 2009 at 11:09 UTC ( #771216=note: print w/ replies, xml ) Need Help??


in reply to Using closures to achieve data hiding in OO Perl

IMO people that obsess over data hiding in perl have missed the point of perl and should probably be using a different language entirely.

All code is visible in perl. If I encountered your code I'd rip the closure crap out, convert it to a standard hash based object and use Perls strengths (code analysis and data introspection) to deal with the very minimal level of problems that come from Perl's relatively weak data hiding facilities.

Data hiding makes sense when you can not see or inspect the code that you are interoperating with, and is particularly important when the language lacks decent data introspection tools. However Perl does not satisfy either of these points, you ALWAYS have access to the code, and you ALWAYS have access to data introspection tools. Thus hiding data is actually counterproductive, as it means that the standard debugging techniques are useless. This in turn means that your data hiding code is a liability, not an advantage.

---
$world=~s/war/peace/g


Comment on Re: Using closures to achieve data hiding in OO Perl

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2014-09-22 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (202 votes), past polls