Be critical of classes that contain more than about seven data members. The
Avoid duplicate code. Undoubtedly the most popular reason for creating a routine is to avoid duplicate code. Indeed, creation of similar code in two routines implies an error in decomposition. Pull th...
Developers' estimates tend to have an optimism factor of 20 to 30 percent
Use locking to control access to global variables. Similar to concurrency control in a multiuser database environment, locking requires that before the value of a global variable can be used or update...
The underlying message of all these rules is that inheritance tends to work against the primary technical imperative you have as a programmer, which is to manage complexity. For the sake of controllin...
The first conclusion is that we now know with certainty that peopleware issues have more impact on software productivity and software quality than any other factor.
One of the most effective guidelines is not to get stuck on a single approach. If diagramming the design in UML isn't working, write it in English. Write a short test program. Try a completely differe...
One key to successful programming is avoiding arbitrary variations so that your brain can be free to focus on the variations that are really needed.
On their way to America, the Pilgrims argued about the best maximum length for a routine. After arguing about it for the entire trip, they arrived at Plymouth Rock and started to draft the Mayflower C...
Notably, the core of NASA's approach to creating reusable classes does not involve designing for reuse. NASA identifies reuse candidates at the ends of their projects. They then perform the work neede...
Make interfaces programmatic rather than semantic when possible. Each interface consists of a programmatic part and a semantic part. The programmatic part consists of the data types and other attribut...
In most instances, global data is really class data for a class that hasn't been designed or implemented very well. In a few instances, data really does need to be global, but accesses to it can be wr...
Global data is generally subject to two problems: routines operate on global data without knowing that other routines are operating on it, and routines are aware that other routines are operating on t...
Dijkstra pointed out that no one's skull is really big enough to contain a modern computer program (Dijkstra 1972), which means that we as software developers shouldn't try to cram whole programs into...
Classes and routines are first and foremost intellectual tools for reducing complexity. If they're not making your job simpler, they're not doing their jobs.
Few people can understand more than three levels of nested ifs
Try to create modules that depend little on other modules. Make them detached, as business associates are, rather than attached, as Siamese twins are.
On small, informal projects, a lot of design is done while the programmer sits at the keyboard. Design might be just writing a class interface in pseudocode before writing the details. It might be dra...
Levels of Design Design is needed at several different levels of detail in a software system. Some design techniques apply at all levels, and some apply at only one or two. Figure 5-2 illustrates the...
Streamline parameter passing. If you're passing a parameter among several routines, that might indicate a need to factor those routines into a class that share the parameter as object data. Streamlini...