Looking for some the thoughts and opinions from my esteemed and seasoned Monks on using subroutines to make code more readable/maintainable/testable. Inevitably, I find my code starts out nice and clean but then edge cases start cropping up that were hard to anticipate and I have to pepper my subroutines with additional checks and statements to account for these edge cases which end up turning my subroutines into a mess. So I find myself very tempted to dump out some of these edge cases to subroutines even if they will probably never be used by another bit of code. Speed is generally not an important factor for my purposes.
I'm curious to know what others think about doing this and what problems it might create even if the practice is used judiciously.
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks
In reply to Thoughts on using subroutines to clean up code? by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |