"be consistent" | |
PerlMonks |
Re^4: Why programming is so much more than writing codeby Rhandom (Curate) |
on May 08, 2007 at 20:39 UTC ( [id://614245]=note: print w/replies, xml ) | Need Help?? |
That is a nicely contrived example.
The user would have to be familiar with the refuse_to_cooperate sub to know that it exits or dies. If they weren't familiar - they'd have to go and read the code for refuse_to_cooperate. A simple comment of # dies placed after the refuse_to_cooperate line, or a comment of # throw error placed before help to explain that you don't intend for any further action in this current section of code and that you'll be returning up the call stack. As much as I've observed "self-documenting" code, as it is called, is usually only self documenting to the person who wrote it. And - most code isn't contrived and easy to make self documenting.
my @a=qw(random brilliant braindead); print $a[rand(@a)];
In Section
Meditations
|
|