|
|
|
|
|
|
|
Figure 1-2
One Algorithm Can Have Many Different Implementations |
|
|
|
|
|
|
|
|
says. Once you have some programming experience, you develop a style of your own. Throughout this book, we offer tips on good programming style. |
|
|
|
|
|
|
|
|
Some people try to speed up the programming process by going directly from the problem definition to coding the program (see Figure 1-3). A shortcut here is very tempting and at first seems to save a lot of time. However, for many reasons that will become obvious to you as you read this book, this kind of shortcut actually takes more time and effort. Developing a general solution before you write a program helps you manage the problem, keep your thoughts straight, and avoid mistakes. If you don't take the time at the beginning to think out and polish your algorithm, you'll spend a lot of extra time debugging and revising your program. So think first and code later! The sooner you start coding, the longer it takes to write a program that works. |
|
|
|
|
|
|
|
|
In addition to solving the problem, implementing the algorithm, and maintaining the program, documentation is an important part of the programming process. Documentation includes written explanations of the problem being solved and the organization of the solution; comments embedded within the program itself; and user manuals that describe how to use the program. Most programs are worked on by many different people over a long period of time. Each of those people must be able to read and understand your code. |
|
|
|
|
|