in reply to What is code readability?
I think one of the most important concepts to take from programming is replacing abstract code with a function name that describe the work it is supposed to do. For example, I came across this code,
$fee = ($tfee / 100 + $sfee/100 + 0.0000001) * 100 $mfee = 200 if ($fee >= 100); $fee = $mfee if $mfee;
I don't even know what this does or why it is doing it. If they had done something like this, I would have a basic understanding of the what they are trying to accomplish.
$fee = determine_maximum_fee(); sub determine_maximum_fee { $fee = ($tfee / 100 + $sfee/100 + 0.0000001) * 100 $mfee = 200 if ($fee >= 100); $fee = $mfee if $mfee; return $fee; }
To me, the difference between a good developer and a bad developer is being able to break code into functions that explain what the program is supposed to be doing. Something most beginning programmers do not understand.
Update: Changed sub determine_total_fee to sub determine_maximum_fee(), thanks to the Anonymous Monk for pointing out the error
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: What is code readability?
by Anonymous Monk on Jan 03, 2007 at 04:13 UTC | |
by Herkum (Parson) on Jan 03, 2007 at 06:21 UTC | |
by Anonymous Monk on Jan 03, 2007 at 16:10 UTC | |
Re^2: What is code readability?
by Moron (Curate) on Apr 17, 2007 at 18:03 UTC |