From: Clifton Oliver
> Execution should flow top to bottom, not left to right, from a
comprehension viewpoint.
Comprehension contributes to Maintainability, the premiere attribute of
software quality.
Along same lines, each case block should test the same sort of thing.
Don't get sneaky for efficiency's sake.
(Note: Efficiency & Maintainability are often in tension.)
E.g.: You are sorting cobras, bugs, garter snakes, lizards, &
rattlesnakes.
The 2nd method below increases your chances of giving this to a junior
programmer, an important consideration when sorting vermin.
Don't do this:
begin case
case legs = 6 ; bug
case legs = 4 ; lizard
case red stripe ; garter snake
case hood ; cobra
case rattles ; rattlesnake
end case
Do this instead:
begin case
case legs = 6 ; bug
case legs = 4 ; lizard
case legs = 0 ; * (snake)
begin case
case red-stripe ; garter snake
case hood ; cobra
case rattles ; rattlesnake
end case
end case
cds
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/