Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Re: Testing for existence of subroutine ref?

by feanor_269 (Beadle)
on Feb 19, 2003 at 03:10 UTC ( #236507=note: print w/replies, xml ) Need Help??

in reply to •Re: Testing for existence of subroutine ref?
in thread Testing for existence of subroutine ref?

Why do you hate code that uses ref? Am I missing something?
Am I posting alot today, or is it just me? (the last bit is just rhetorical, for those who would think to actually answer this, I know it's subjective.)

  • Comment on Re: Re: Testing for existence of subroutine ref?

Replies are listed 'Best First'.
Re: Re: Re: Testing for existence of subroutine ref?
by djantzen (Priest) on Feb 19, 2003 at 03:43 UTC

    It's often a symptom of poorly organized code if you have to check explicitly what something is in order to determine what to do with it. Ideally you'd want the structure of your code to shape the flow of data/entities such that at any given point you can reliably expect a certain type of thing.

    Imagine walking around with a single instruction "doIt" along with a collection of minor instructions that you had to follow according to what the thingy was to which you were to "doIt". You don't want to have to decide to "drink" from a coffee cup and "drive" a car; rather, you want to be able to rely on the thing you attempt to drink from being a coffee cup, and the thing you hotwire being a car.

    Another way of thinking about it is that it's better to offload decision-making onto the surrounding structure as opposed to navigating an open-ended environment according to a complex rulebook.

    "The dead do not recognize context" -- Kai, Lexx

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2020-12-01 00:18 GMT
Find Nodes?
    Voting Booth?

    No recent polls found