9.7 Real-World Programming
Over the years I've used a lot of different
programming techniques. The one I use depends on the problem
I'm trying to solve. I've
discovered a few things about what it take to create a successful
program.
The first step is to think about what you are doing before you do it.
Resist the urge to start coding, and sit down and do some design.
Make things as simple as possible. The simpler your code, the less
that can go wrong with it.
Also try to make your design as flexible as possible. After all, you
may know things tomorrow that you don't know today.
Next, organize the information you need for your program in a way
that makes it as clear as possible. Depending on what you are doing,
this may involve documentation, charts, diagrams, or something else.
It all depends on the problem you're trying to solve
and how you think. Do whatever works for you.
When you code, make sure that you are able to test your code at every
step of the way. A bunch of small, correct steps will get you there
much faster than one great leap in the wrong direction.
Finally, realize that there's not one
"right" coding technique. Different
systems work for different problems. Use whatever works best for you.
Traditional coding techniques describe how coding should ideally be
done. But when you enter the real world, you quickly learn the
difference between the way things should be done and the way they
really are done. In real life, a number of nontraditional coding
techniques are frequently employed:
- Programming by creative copying
-
This is where the programmer finds a program that does most of what
he wants and copies and adapts it to his purposes.
There's a lot of free code out there and
"borrowing" is allowed in most
cases.
- Programming by successive experimentation
-
Frequently you will find systems that are poorly or incorrectly
documented. This programming technique involves creating a set of
experiments to see how the system really works. As you learn more
about the system, your refine your research efforts. When you finally
figure out how the system functions, your remove the debug code and
put the system into production.
- Continual editing
-
You start with a small, simple program and then edit it over and over
again, several hundred times—maybe several thousand times. Each
time, you make small edits, adding features and improving the
program. There are programs out there that have had several hundred
thousand edits made to them. And they work!
|
|