in reply to efficient use of subroutines
I just stick to what my Uni professors used to tell me about subs/functions - "Functions should do one thing, and do it well."
When it comes to clarity/readability/maintainablity, I stick to my 'C' roots and make everything possible a sub/function - that way when you have a list of calls to subs/functions, and any parameters passed to them, you can see clearly in what order things are working. IMHO anyway ;)
EDIT: And of course, appropriate naming conventions of subs/functions never hurt anybody! IMHO Try and avoid lengthy names, even as a relatively new professional programmer, all too often do I come across somebody elses subs like this this -> thisSubRoutineWorksOutThisNumberFromThatNumber - and I just think that becomes more of a hinderance then a help!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: efficient use of subroutines
by jeri_rl (Initiate) on Feb 05, 2015 at 18:54 UTC | |
by 5plit_func (Beadle) on Feb 05, 2015 at 23:19 UTC |