Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: OO style question: how much information to hide?

by BrowserUk (Pope)
on Jun 11, 2003 at 01:07 UTC ( #264927=note: print w/ replies, xml ) Need Help??


in reply to OO style question: how much information to hide?

Taking the latter form to extremes, you could end up writing something like

$token->del_attr('font') if $token->is_start_tag and $token->can_have_attr('font') and $token->has_attr('font');

If the method can only be applied if certain condition(s) are true, better to have the test(s) once in the object and know that they will be performed, than to force every caller to perform the tests, and risk that they don't.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller



Comment on Re: OO style question: how much information to hide?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2014-08-28 00:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (253 votes), past polls