Analyzing the CodeWith a fairly simple program such as Decryptix!, my first goal is to get a version up and running--and tokeep it running. After it is working, I'll add features, redesigning on-the-fly as I go.On a large project, this can be a fatally inefficient process. As features are added, the complexity of theoverall project grows, and without a good design you end up with code that is hard to maintain.With a smaller project such as Decryptix!, however, the risk is minimal. If a new feature requires acomplete redesign and rewrite of the program, no problem: It only takes a couple of days to write it inthe first place.
How Big Is a Small Project?
How small must a program be to design it as you go? I'd argue that any program that takes one personmore than a few weeks to program ought to be subject to a more rigorous design process. Here's why:Programs that evolve organically, rather than by design, often have to be rewritten at least once. If doingso is painful, it is worth working out the design up front. If rewriting is trivial, however, nothing was lostby diving right in.
Why Teach a Process that Is Only Good for Smaller Projects?
"Why," I hear you ask, "show an example of organic design if all large projects require formal design?"The answer is fairly straightforward: There's a lot to learn in both programming and design. This book aims to teach programming; you'll find lots of books (including a few I wrote) on object-orientedanalysis and design. You can't learn everything at once.Nothing I teach in this book is inconsistent with good design; we just won't take the time to designeverything up front. I don't know about you, but I'm eager to dive into some code.
Bootstrapping Your Knowledge
In a classic C++ primer, I'd start with the structure of the program, introduce statements and expressions,add variables and constants, and then turn to classes. I'd build skill upon skill, and I'd be about 600 pagesinto the book before you could even begin to write your Decryptix! program.This book is different. You're going to jump right in and wallow around awhile. Not all of it will makesense at first, and I'll gloss over lots of detail only to return to it later in the book, but the essential flowof the program can be explained pretty quickly. From time to time you'll take an "Excursion" to related--