|
Help Preserve Programmer Sanity
Only You Can Prevent Assembly Language Brain-Fry
"... Once a proud programmer of Apple II computers, he now
spends his days and nights in cheap dives fraternizing with exotic dancers ...."
I know what you're saying, "That could never happen to me." But every year,
many potentially great programmers fall prey to demands made by the
uninformed-but-authority-driven corporate management or the bureaucratic
incompetence and jurassic computer facilities of many "educational" institutions.
If you or someone you know has a job involving computer information systems or
application development, or has a recreational interest in such matters, please
read the following brochure.
And remember, if you don't get help at the N.C. Home for Deranged Programmers
... well, at least we tried to warn you.
Quick Brain-Saving Tips
- Use Comments ! (Damn It.)
Even though you know what your code does now, it may not be so clear later. And
if you're not going to add comments for yourself, add them for the others who may
be reading the source later. Plus, comments add a sense of style and sophistication
to any program.
- Don't Reinvent the Wheel
Present-day compilers provide very good function libraries. If your compiler does
not, then spend the money to get something which is more in line with current
technology. If copying short code samples seems unethical, consider this, many
algorithms only have one "correct" implementation. True, there may be variations,
but the basic processes are the same and simplicity is often the best key to
optimization.
As an example, Quicksort is Quicksort. The only place where modifications are
significant is in key selection. Although selecting a good key is important, using
complex methods to select the "perfect" key tend to result in nominal improvements
or worse performance, because the "improved" key selection takes 15 times longer
than the simple selection.
- ... Reinvent the Wheel (Damn Copyright Laws.)
The truth is: Someone has done it already, at least for most programming problems.
Unfortunately, it's not likely that they'll give you a copy on a silver platter.
Copyrights will bust your ass. For example, you would think that Dictionaries
should be in the public domain. However, the 1913 Edition of Webster's
Dictionary is about the only one in the Public Domain.
Disney ©®$£¥(etc.)
is not the only corporate entity which procecutes copyright infringements. In
fact, some of you may remember Lawsuits over the "Look and Feel" of software
packages.
Even if the techniques and algorithms are not restricted by copyright laws, it
may still be near impossible to get the information without having to pay someone.
Usually, this is because Publishers and Universities rake in a lot of money for
providing access to information. (A course in Literature Appreciation ? Get
real you either like it or you don't.... Go figure.)
Then again, Hey, you needed the practice rewriting code fragments anyway,
Right ?
- Become a Master of the Search Engine
Everybody knows: "No one gives it away for free." Fortunately for you, the world
is very chaotic and perverse. In simple terms, if It exists, and people
have It, then given more and more people, it is likely that are more
people with more of It; hence, the more likely that you can get It
for Free.
Okay, so it's not so simple, but there are "millions" of Web Pages out there.
As an example, Search for "Computer": 10630 Matching Categories ... 157109
Matching Sites. If 1% of the Sites Listed have what you're looking for,
and 1% of those sites "Give It Away for Free", then there are 15 Sites
that will give you what you want for free .
Knowing how your Search Engine works can allow you to weed out 157000 of those
unwanted sites, leaving just over a hundred for you to read.
Now, just because you've found the site with what you want, you might
have plenty of work left to do. Several files are Megabytes in size. Maybe a
Text Editor can Find what you want ... but, let's say it can't. Unix
systems have utilities such as grep and sed. If you understand
the "regular expressions" that these programs use, chances are that you
can get the computer to find anything for you (as a background process no less).
- Design Programs on Paper
Although many of you may be shocked when I say this, and respond with something
like "but I'm saving so many trees!" Well, staring at a computer screen for hours
trying to figure out where you screwed up isn't very good for your eyes, the
electricity used adds to the coal or nuclear fuel spent to produce power, and
finally, you're probably going to make several print-outs of your program anyway,
because that's the only way you're going to find where you screwed up at.
If you still feel that a Loblolly Pine planted and grown for the sole purpose of
providing pulp for the manufacture writing materials is more important than
your brain, then you are probably right and you should immediately have your
brain turned into a fibrous paste and converted to newsprint.
Alternatively, you may choose to make all programming notes on newsprint paper,
and recycle your notes when the project is finished. This would give you even
greater reasons to document your program with clear, concise comments.
- Avoid COBOL Like the Plague That It Is
I don't believe this needs any explanation. Any language which tries to pass
itself off as "High Level," but uses the reserved word "MOVE" as a command, just
isn't worth losing sleep over. COBOL has the ease of use of Early 1980's Assembly
Language (look at the Data Division with stuff like "PIC 999V99.") and strips
85% of the power that you get from using Assembly Language.
Saving Your Brain Through Work
- Don't Just Emulate, Understand
Knowing how a System works is (or should be) 95% of Trouble Shooting.
Although you can use trial and error to solve a problem, you can get much better
results in less time when you only have to deal with one fifth of the possible
sources of a problem.
It is generally accepted that most programs spend 90% of their time executing
10% of the executable code. If you optimize by trial and error alone, chances
are 9 times out of 10 that you won't be making much of a difference.
Learn common mathematical properties and how they affect programming. For example,
the loop beginning at "n" and ending at "n+10" has 11 iterations, not
10.
- Get to Know Some Higher Mathematics
Yes, Calculus is more than an esoteric set of rituals to derive obscure meanings
from convoluted functions and assorted numbers. Although Calculus is not required
for programming, it will give you insight into such matters as why Bubble Sort
sucks and why there are limits on algorithm performance.
Statistics is the study of how to analyze data to produce misleading results.
Typically you begin with a conclusion, and arrange the available data to give
the appearance of validity. In its defense, it can be used for good, in addition
to its more common evil applications.
- System Design by the Life Cycle Method
Make a Damn Good Plan, then stick with it.
This method can be good when multiple teams will be working on a Project.
Goals and Project Definitions are established, and strictly adhered to until
completion of the work. The primary advantage of this method is that teams
working separately should have no compatibility problems between modules,
because all modules should behave as originally designed.
The downside of this method is that a great deal of time is required to produce
a Beta version for testing, and any change to the original Project Definitions
can require numerous changes in existing Project Modules.
- System Design by Prototyping
Make a Plan, make Something with it, Debug and Improve until results are Damn
Good. Among the best advantages of this method is that a Beta version of the
Project is ready in almost no time at all. The result is that you can evaluate
the Project Definitions very quickly and correct or enhance modules as needed,
resulting in a new Prototype for testing. In addition, the Project Design can
be modified much more easily than with the Life Cycle Method.
Programming Tools are very important when using the Prototyping method. Object
Oriented Libraries and large quantities of Reusable Code should be available
so that the first Project Prototype can be developed as soon as possible.
Without these tools, you might as well use the Life Cycle Method because it's
going to take a while to make the first working version of the Project, and
making changes in the modules will suck.
A Glimpse Into the Heart of Darkness
Warning: The following material may be harmful to sensitive minds
which have not developed the necessary psychological defenses for viewing
COBOL source code. If you feel sudden dizziness or nausea, please rush to the
refrigerator for cold beer, or a television where you can begin viewing a
program with large quantities of gratuitous nudity and mindless sight gags.
|