Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Testing for existence of subroutine ref?

by feanor_269 (Beadle)
on Feb 19, 2003 at 03:10 UTC ( [id://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.)

feanor_269
  • 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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-25 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found