On Thu, 2005-10-20 at 18:52 +0100, Jules Richardson wrote:
Variable names were human-readable (not just
'i' or
whatever), but only valid contextually once within the several thousand
lines of code (and not necessarily the first time they were used,
either). Various statements never even got reached for all possible
valid inputs, *and* the function was recursive for certain input states.
Picking that apart was something of a challenge...
Yeah it's funny... they give you a hard time in school, and people have
gotten fired/reprimanded for use of goto but no one ever got fired for
using recursion. Recursive algorithm variants are usually the first
thing they teach you in school. But recursion makes for much harder to
understand code, and also for code that is usually not appropriate for
resource constrained platforms because of limited stack space.
A recursive algorithm can be quite elegant and easier to understand in a
limited, useless educational example. But once you start adding all the
little bells and whistles (like, say, exception handling) it quickly
becomes a hairy mess.
True story, nightmare comment:
/* all descriptor processing converges here */
Converges!!???
That's when I threw in the towel. There were bugs there that would never
be fixed short of a rewrite. Believe it or not, it was for an aircraft,
but apparently the in-flight entertainment subsytem doesn't get the same
scrutiny as the code that will make the aircraft flip upside down.
-- John.