The Ideal Code

I found a light at the end of the tunnel of my portion of the cone of learning tonight. It involves resolution of the conflict behind comments, whitespace, prototyping, and optimized (reading, running) code.

Ideal code is atomic. It is divided into separate coherent blocks,
each with one and only one purpose. There are no comments, and each
block is atomic; it cannot be divided any further. Each block fits
into a grand and dynamic scheme of how it can be used, almost like a
tree. The leaves of the tree are the most frequently used blocks of
code, and as you follow each branch inward toward the trunk the code
is used less often, but uses a higher total number of aggregate
functions, and so becomes “higher level” code. At the trunk, starting
just below the lowest branch is the application, which cannot be
reused. It is an executable script, or a compiled program that defines
the end user.

Now, how can you imagine code without comments, or no newline
whitespace, or with that 300-line drawPerson() member method? I find
that all of these are used in intermediate steps toward that perfect
peice of code. You absolutely *must* write code that has gaps and
holes and yes, bugs, in order to massage the solution out of the
problem. My comments are # optimize for anti-aliasing?, or # ugly! My
methods that have double newlines or comments like ## PUBLIC ACCESS
really should be delegated to another, more specific method.

Learning how to write code to assist your understanding of the
problem is 100% of the battle. Leaving yourself notes in places where
you and only you know you’ll find them is critical to the evolution of
your solutions. Jumping the technological hurdles for your problem
first and staying out of the write-the-app the solve-the-problem
metality will save you time and sanity when you are put under that
hammer of a deadline, personal or professional.

These are the reasons that highlevel languages that encourage
prototyping are essential to approaching time-comsuming and
energy-sucking problems, and why a language that looks as nice on the
inside as on the outside is just as important. This is also why I
choose python. I guarantee that I can optimize any Qt app written in
python using C++ with minimal effort, having fully understood the
problem by writing the python code.

By | 2006-05-15T08:03:00+00:00 May 15th, 2006|Uncategorized|0 Comments

Leave A Comment

28 − 27 =