in reply to On Foreach Loops and Maintainability
For me the most important thing is the process: Do arg1, then arg2, then arg3, etc. The code needs to clearly define what the process is:
Even better:@process = qw/ arg1 arg2 arg3 arg4 arg5 /; foreach ( @process ) { if ( $object->method( $_ ) ) { # ... do stuff } }
so that the object controls what the process is and as the object changes so can the process. (ADDED: I could see distilling this down even more and in better ways.)foreach ( $object->getProcess() ) { if ( $object->method( $_ ) ) { # ... do stuff } }
I'd bet that this is the slowest way to do things, but at least for me it seems the clearest. I don't know what posts you are refering to so I could be completely talking out of my butt.
()-() \"/ `
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re:x2 On Foreach Loops and Maintainability
by grinder (Bishop) on Oct 11, 2002 at 21:45 UTC |