A Philosophy of Software Design
Rate it:
Kindle Notes & Highlights
80%
Flag icon
If information is already documented someplace outside your program, don’t repeat the documentation inside the program; just reference the external documentation.
80%
Flag icon
comments are easier to maintain if they are higher-level and more abstract than the code.
80%
Flag icon
Consistency is a powerful tool for reducing the complexity of a system and making its behavior more obvious.
80%
Flag icon
Consistency creates cognitive leverage:
80%
Flag icon
Names.
80%
Flag icon
Coding style.
80%
Flag icon
Interfaces.
81%
Flag icon
Design patterns are generally-accepted solutions to certain common problems,
81%
Flag icon
Invariants reduce the number of special cases that must be considered in code and make it easier to reason about the code’s behavior.
81%
Flag icon
Create a document that lists the most important overall conventions, such as coding style guidelines.
81%
Flag icon
The best way to enforce conventions is to write a tool that checks for violations, and make sure that code cannot be committed to the repository unless it passes the checker.
81%
Flag icon
Don’t change existing conventions.
82%
Flag icon
Having a “better idea” is not a sufficient excuse to introduce inconsistencies.
82%
Flag icon
Obscurity occurs when important information about a system is not obvious to new developers.
82%
Flag icon
The first is choosing good names
82%
Flag icon
Precise and meaningful names clarify the behavior of the code and reduce the need for documentation.
82%
Flag icon
The second technique is consistency
82%
Flag icon
Judicious use of white space.
85%
Flag icon
If the meaning and behavior of code cannot be understood with a quick reading, it is a red flag. Often this means that there is important information that is not immediately clear to someone reading the code.
85%
Flag icon
Generic containers.
86%
Flag icon
rule: software should be designed for ease of reading, not ease of writing.
86%
Flag icon
Different types for declaration and allocation.
86%
Flag icon
To make code obvious, you must ensure that readers always have the information they need to understand it.
87%
Flag icon
In order for an interface to have many implementations, it must capture the essential features of all the underlying implementations while steering clear of the details that differ between the implementations; this notion is at the heart of abstraction.
88%
Flag icon
development should be incremental and iterative. In the agile approach, a software system is developed in a series of iterations,
88%
Flag icon
Developing incrementally is generally a good idea, but the increments of development should be abstractions, not features.
89%
Flag icon
The problem with test-driven development is that it focuses attention on getting specific features working, rather than finding the best design.
89%
Flag icon
Before fixing a bug, write a unit test that fails because of the bug. Then fix the bug and make sure that the unit test now passes.
89%
Flag icon
such as an iterator or an observer.
89%
Flag icon
Design patterns represent an alternative to design: rather than designing a new mechanism from scratch, just apply a well-known design pattern.
89%
Flag icon
The greatest risk with design patterns is over-application.
90%
Flag icon
Network communication: even within a datacenter, a round-trip message exchange can take 10–50 µs, which is tens of thousands of instruction times. Wide-area round-trips can take 10–100 ms.
90%
Flag icon
I/O to secondary storage: disk I/O operations typically take 5–10 ms,
91%
Flag icon
Design around the critical path
94%
Flag icon
The most important overall lesson from this chapter is that clean design and high performance are compatible.
94%
Flag icon
This book is about one thing: complexity.
95%
Flag icon
how can a particular problem be solved with the simplest possible structure?
99%
Flag icon
Complexity is incremental: you have to sweat the small stuff (see p. 11).
99%
Flag icon
Working code isn’t enough (see
99%
Flag icon
Make continual small investments to improve sy...
This highlight has been truncated due to consecutive passage length restrictions.
99%
Flag icon
Modules should...
This highlight has been truncated due to consecutive passage length restrictions.
99%
Flag icon
Interfaces should be designed to make the most common usage as simpl...
This highlight has been truncated due to consecutive passage length restrictions.
99%
Flag icon
It’s more important for a module to have a simple interface than a ...
This highlight has been truncated due to consecutive passage length restrictions.
99%
Flag icon
General-purpose modules are deeper
99%
Flag icon
Separate general-purpose and special-purpose code
99%
Flag icon
Different layers should have differen...
This highlight has been truncated due to consecutive passage length restrictions.
99%
Flag icon
Pull complexity ...
This highlight has been truncated due to consecutive passage length restrictions.
99%
Flag icon
Define errors (and special cases) out...
This highlight has been truncated due to consecutive passage length restrictions.
99%
Flag icon
Design it twi...
This highlight has been truncated due to consecutive passage length restrictions.
99%
Flag icon
Comments should describe things that are not obvi...
This highlight has been truncated due to consecutive passage length restrictions.