A Philosophy of Software Design
Rate it:
Kindle Notes & Highlights
21%
Flag icon
The opposite of information hiding is information leakage.
21%
Flag icon
pernicious
21%
Flag icon
One of the best skills you can learn as a software designer is a high level of sensitivity to information leakage.
21%
Flag icon
Information leakage occurs when the same knowledge is used in multiple places, such as two different classes that both understand the format of a particular type of file.
21%
Flag icon
In temporal decomposition, the structure of a system corresponds to the time order in which operations will occur.
22%
Flag icon
When designing modules, focus on the knowledge that’s needed to perform each task, not the order in which tasks occur.
22%
Flag icon
information hiding can often be improved by making a class slightly larger.
24%
Flag icon
Defaults illustrate the principle that interfaces should be designed to make the common case as simple as possible.
24%
Flag icon
Whenever possible, classes should “do the right thing” without being explicitly asked.
24%
Flag icon
If the API for a commonly used feature forces users to learn about other features that are rarely used, this increases the cognitive load on users who don’t need the rarely used features.
25%
Flag icon
general-purpose or special-purpose
25%
Flag icon
The general-purpose approach seems consistent with the investment mindset discussed in Chapter 3, where you spend a bit more time up front to save time later on.
25%
Flag icon
The phrase “somewhat general-purpose” means that the module’s functionality should reflect your current needs, but its interface should not.
27%
Flag icon
Generality leads to better information hiding
27%
Flag icon
One of the most important elements of software design is determining who needs to know what, and when.
27%
Flag icon
What is the simplest interface that will cover all my current needs?
28%
Flag icon
In how many situations will this method be used?
28%
Flag icon
Is this API easy to use for my current needs?
28%
Flag icon
Making your modules somewhat general-purpose is one of the best ways to reduce overall system complexity.
28%
Flag icon
In a well-designed system, each layer provides a different abstraction from the layers above and below it;
28%
Flag icon
If a system contains adjacent layers with similar abstractions,
28%
Flag icon
A pass-through method is one that does little except invoke another method, whose signature is similar or identical to that of the calling method.
29%
Flag icon
This typically indicates that there is not a clean division of responsibility between the classes.
30%
Flag icon
“Exactly which features and abstractions is each of these classes responsible for?”
30%
Flag icon
The decorator design pattern (also known as a “wrapper”)
31%
Flag icon
The motivation for decorators is to separate special-purpose extensions of a class from a more generic core.
33%
Flag icon
Pull Complexity Downwards
33%
Flag icon
Most modules have more users than developers, so it is better for the developers to suffer than the users.
33%
Flag icon
it is more important for a module to have a simple interface than a simple implementation.
34%
Flag icon
Configuration parameters are an example of moving complexity upwards instead of down.
34%
Flag icon
the complexity being pulled down is closely related to the class’s existing functionality,
34%
Flag icon
pulling the complexity down will result in many simplifications elsewhere in the application,
34%
Flag icon
pulling the complexity down simplifies the cl...
This highlight has been truncated due to consecutive passage length restrictions.
35%
Flag icon
Bringing pieces of code together is most beneficial if they are closely related. If the pieces are unrelated, they are probably better off apart.
35%
Flag icon
They share information;
35%
Flag icon
They are used together:
35%
Flag icon
They overlap conceptually,
35%
Flag icon
It is hard to understand one of the pieces of code without looking at the other.
35%
Flag icon
Bring together if information is shared
36%
Flag icon
Bring together if it will simplify the interface
36%
Flag icon
Bring together to eliminate duplication
36%
Flag icon
Separate general-purpose and special-purpose code
37%
Flag icon
If the same piece of code (or code that is almost the same) appears over and over again, that’s a red flag that you haven’t found the right abstractions.
37%
Flag icon
This red flag occurs when a general-purpose mechanism also contains code specialized for a particular use of that mechanism.
41%
Flag icon
The key design decision was the one that separated the general-purpose part of the undo mechanism from the special-purpose parts and put the general-purpose part in a class by itself.
41%
Flag icon
Each method should do one thing and do it completely.
41%
Flag icon
someone reading the child method doesn’t need to know anything about the parent method
41%
Flag icon
someone reading the parent method doesn’t need to understand the implementation of the child method.
42%
Flag icon
I use the term exception to refer to any uncommon condition that alters the normal flow of control in a program.
44%
Flag icon
“code that hasn’t been executed doesn’t work”).