55
JANUARY 2012
and loops must be viewed with great suspicion. Compli-
cated control flows confuse programmers. Messy code
often hides bugs.
Consider a real example (taken from Sean Parent): in
many user interfaces, an item of a sequence can be moved
to a different position in the sequence by dragging its
screen representation over a screen representation of the
sequence. The original solution (after cleanup and simplifi-
cation) involved 25 lines of code with one loop, three tests,
and 14 function calls. Its author considered it messy and
an attempt to simplify the code was made. The result was
Do'stlaringiz bilan baham: