in reply to A matter of style

I say your subroutines are way too big. I almost never validate parameters to subroutines. Instead I validate the input. After that any other validation is redundant. How do I debug my subroutines? I write them small and incrementally test them as I build (I did mention your subroutines are too big).

As for the doublespeak of the “Code Purists,” this is stuff you regurgitated to get a good marks in college. “Subroutines should have only one entrance and only one exit” is part of their “goto”-less coding. They insist on using state variables, whose contents must be examined to determine what to do next, rather than making the routing explicit. But using state variables is obfuscation. When you are walking-through the code, you have to remember what state each is in and scan the code that isn’t active until you find some that is. With “goto” statements like return, last, next, redo, and die; you can skip the intervening code and get on with your walkthrough.

I never put in “end of” comments; I use Vim which automatically matches parentheses as I type. It also automatically indents every time I type ‘{’ and outdents when I type ‘}’. I can easily find the beginning of every end.