Code Complete
Rate it:
Open Preview
Started reading November 29, 2024
10%
Flag icon
One key task in designing a class is deciding which features should be known outside the class and which should remain secret.
10%
Flag icon
The interface to a class should reveal as little as possible about its inner workings.
10%
Flag icon
A good class interface is like the tip of an iceberg, leaving most of the class unexposed
10%
Flag icon
Asking about what needs to be hidden supports good design decisions at all levels.
10%
Flag icon
Accommodating changes is one of the most challenging aspects of good program design.
10%
Flag icon
Design the interfaces so that changes are limited to the inside of the class and the outside remains unaffected.
10%
Flag icon
Status variables indicate the state of a program and tend to be changed more frequently than most other data.
10%
Flag icon
Use access routines rather than checking the variable directly.
10%
Flag icon
A good technique for identifying areas likely to change is first to identify the minimal subset of the program that might be of use to the user.
10%
Flag icon
Coupling describes how tightly a class or routine is related to other classes or routines.
10%
Flag icon
Try to create modules that depend little on other modules.
10%
Flag icon
A routine that takes one parameter is more loosely coupled to modules that call it than a routine that takes six parameters.
10%
Flag icon
Flexibility refers to how easily you can change the connections between modules.
11%
Flag icon
In creating a system structure, break up the program along the lines of minimal interconnectedness.
11%
Flag icon
Patterns reduce complexity by providing ready-made abstractions. If
11%
Flag icon
The Factory Method is a pattern that allows you to instantiate any class derived from a specific base class without needing to keep track of the individual derived classes anywhere but the Factory Method.
11%
Flag icon
Patterns reduce errors by institutionalizing details of common solutions. Software
11%
Flag icon
Patterns streamline communication by moving the design dialog to a higher level. In
11%
Flag icon
Binding time refers to the time a specific value is bound to a variable.
11%
Flag icon
A brute-force solution that works is better than an elegant solution that doesn't work.
11%
Flag icon
When in doubt, use brute force.
11%
Flag icon
Incremental refinement is a powerful tool for managing complexity.
12%
Flag icon
Continue decomposing until it seems as if it would be easier to code the next level than to decompose it.
12%
Flag icon
Sometimes the top-down approach is so abstract that it's hard to get started.
12%
Flag icon
We try to solve the problem by rushing through the design process so that enough time is left at the end of the project to uncover the errors that were made because we rushed through the design process.
13%
Flag icon
Have you tried decomposing the system in several different ways to see which way will work best?
13%
Flag icon
Have you driven the design to the point that its implementation seems obvious?
13%
Flag icon
A class is a collection of data and routines that share a cohesive, well-defined responsibility.
13%
Flag icon
A key to being an effective programmer is maximizing the portion of a program that you can safely ignore while working on any one section of code.
13%
Flag icon
An abstract data type is a collection of data and operations that work on that data.
14%
Flag icon
One way of thinking of a class is as an abstract data type plus inheritance and polymorphism.
14%
Flag icon
Each class should implement one and only one ADT.
14%
Flag icon
When you design a class, check each public routine to determine whether you need its complement.
14%
Flag icon
Look for ways to convert semantic interface elements to programmatic interface elements by using Asserts or other techniques.
14%
Flag icon
Don't put a routine into the public interface just because it uses only public routines. The
14%
Flag icon
Favoring a technique that speeds write-time convenience at the expense of read-time convenience is a false economy.
14%
Flag icon
It ain't abstract if you have to look at the underlying implementation to understand what's going on.
14%
Flag icon
Tight coupling occurs when an abstraction is leaky, or when encapsulation is broken.
15%
Flag icon
Be critical of classes that contain more than about seven data members. The
15%
Flag icon
The purpose of inheritance is to create simpler code by defining a base class that specifies common elements of two or more derived classes.
15%
Flag icon
Inheritance helps avoid the need to repeat code and data in multiple locations by centralizing it within a base class.
15%
Flag icon
If the derived class isn't going to adhere completely to the same interface contract defined by the base class, inheritance is not the right implementation technique.
15%
Flag icon
Design and document for inheritance or prohibit it. Inheritance
15%
Flag icon
If you want to use a class's implementation but not its interface, use containment rather than inheritance.
15%
Flag icon
Move common interfaces, data, and behavior as high as possible in the inheritance tree. The
15%
Flag icon
Be suspicious of base classes of which there is only one derived class. When
15%
Flag icon
Be suspicious of classes that override a routine and do nothing inside the derived routine. This
15%
Flag icon
Prefer polymorphism to extensive type checking. Frequently
15%
Flag icon
For the sake of controlling complexity, you should maintain a heavy bias against inheritance.
15%
Flag icon
If multiple classes share common data but not behavior, create a common object that those classes can contain.