Preface
This book is devoted to practical C++ programming. It teaches you not
only the mechanics of the language, but also style and debugging. The
entire life cycle of a program is discussed, including conception,
design, writing, debugging, release, documentation, maintenance, and
revision.
Style is emphasized. Creating a good program involves more than just
typing code. It is an art in which writing and programming skills
blend to form a masterpiece. A well-written program not only
functions correctly, but also is simple and easy to understand.
Comments allow programmers to include descriptive text in their
programs. Clearly written, well-commented programs are highly prized.
A program should be as simple as possible. Avoid the use of clever
tricks. Cleverness and complexity can kill programs. This book
stresses simple, practical rules. For example, the 15
operator-precedence rules in C++ can be simplified to 2:
Multiply and divide before you add and subtract.
Put parentheses around everything else.
Consider two programs. One was written by a clever programmer, using
all the tricks. The program contains no comments, but it works. The
other is nicely commented and well structured, but
doesn't work. Which program is more useful? In the
long run, the "broken" one is more
useful because it can be fixed and maintained easily. Although the
clever one works now, sooner or later it will have to be modified.
The hardest work you will ever have to do is modifying a cleverly
written program.
|