In The Trenches
by Gerard Fonte
The Business of Electronics Through Practical Design and Lessons Learned
In The Trenches
From time to time, most engineers
are required to develop software.
Some have training for this and
others don’t. Sometimes the training is
inappropriate for the task at hand. This
month, we’ll look at approaches and
considerations that are important in
developing good software.
Top Down, Bottom
Up, or Gestalt
There are three general approaches for writing a computer program. The
most general is the gestalt or all-in-one
approach. This is typically used for very
short programs or by inexperienced
programmers. With this technique, the
program is written as a block. It is then
compiled and debugged as a whole.
The Holy Grail for this approach is to
have a perfect program the very first
time. (It’s never happened to me.)
The big problem with this
approach is that there are many ways
that a program can fail. Worse, the
same failure can have several different causes. If there is a problem with
an output value, for example, it could
be that the calculations are incorrect,
the wrong table data is being read, or
the output columns are reversed.
Trying to figure out the source of
the error can be extremely difficult,
frustrating, and time-consuming, which
is why this approach is rarely used for
serious software. (Of course, when you
were graded on how many times you
submitted the program for compilation,
this approach had its merits. But that
was way, way back then. This is now.)
The top-down approach is often used
for large software projects where there
are a number of members working on it
simultaneously. In this case, the logic
core of the program is created and test-
NUTS & VOLTS
NEW! HIDmaker FS for Full Speed FLASH PIC18F4550
Creates complete PC and Peripheral
programs that talk to each other over
USB. Ready to compile and run!
• Large data Reports
• 64,000 bytes/sec per Interface
• Easily creates devices with multiple
Interfaces, even multiple Identities!
• Automatically does MULTITASKING
• Makes standard or special USB HID
NEW! “Developers Guide for USB HID
Peripherals” shows you how to make
devices for special requirements.
Both PC and Peripheral programs
understand your data items (even odd
sized ones), and give you convenient
variables to handle them.
PIC18F Compilers: PICBASIC Pro,
MPASM, C18, Hi-Tech C.
PIC16C Compilers: PICBASIC Pro,
MPASM, Hi-Tech C, CCS C.
PC Compilers: Delphi, C++ Builder,
Visual Basic 6.
HIDmaker FS Combo: Only $599.95
DOWNLOAD the HIDmaker FS Test Drive today!
ed first. Then the individual sub-programs, often written by different people,
are plugged into the core and tested.
Clearly, this approach is better
than the gestalt method. The software
is developed piece-wise, with each
piece developed and debugged in isolation. The result is a series of modules
that are moderately independent of
one another, which allows individual
modules to be modified fairly easily
when needed. This approach is usually
applied with “real” computers (
desktops, networks, and mainframes) that
provide ample tools for examining how
the code operates internally. High-level
languages are typically utilized.
The bottom-up method is usually
employed for embedded computer
and microcomputer (uC) applications. In this approach, the subroutines are written and tested first. After
these modules are completed, they
are then assembled into a program
with the appropriate logic.
Again, this approach is clearly
superior to the gestalt approach. It is
similar to the top-down method, in that
separate modules are created. This
simplifies debugging and changing the
code. Typically, a single person writes
the software. The tools for examining
the code internally are usually more
limited, and low-level languages are
employed more often. The choice
between top-down and bottom-up development can be somewhat arbitrary. If
there are several people working on
a software project, then top-down is
probably a better approach. But if it’s
just you, choose whichever method you
feel most comfortable with.
The choice of a programming lan-