Next | Program Repair Shop | 50 |
sub CreateOutputDir { my $dir = shift; mkdir $dir, 0777 or die "Couldn't make dir $dir: $!"; }
Now the function is three lines long
Two of the lines are structural
This means they don't do anything useful
Structural code doesn't accomplish the real goal ("I need to create a directory")
It is only there to accomplish a secondary goal ("I need to use a subroutine")
Only one line is functional
Minimize Structure
Next | Copyright © 2002 M. J. Dominus |