in reply to Refactoring technique?
Hello BrowserUk,
I look at the subroutine as providing a specific function, so I would name the input parameters as how they relate to the specific function. It really doesn't matter where the input values come from, but what is the purpose of the subroutine. So if the sub is going to build a box, then I would design the sub as:
To the maintainer, it should be obvious what the subroutine does and not how it gets called! YMMV.# my $graphic = buildbox( $x, $y, $z ); sub buildbox { my $length = shift; my $height = shift; my width = shift; ... }
Regards...Ed
"Well done is better than well said." - Benjamin Franklin
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Refactoring technique?
by BrowserUk (Patriarch) on Apr 24, 2015 at 16:05 UTC | |
by MidLifeXis (Monsignor) on Apr 24, 2015 at 17:24 UTC | |
by BrowserUk (Patriarch) on Apr 24, 2015 at 18:12 UTC | |
by flexvault (Monsignor) on Apr 24, 2015 at 19:50 UTC |