More on this book
Community
Kindle Notes & Highlights
We teach for loops and object-oriented programming, but not software design.
I have wondered whether software design can be taught, and I have hypothesized that design skill is what separates great programmers from average ones.
The second approach to complexity is to encapsulate it, so that programmers can work on a system without being exposed to all of its complexity at once. This approach is called modular design. In modular design, a software system is divided up into modules, such as classes in an object-oriented language. The modules are designed to be relatively independent of each other, so that a programmer can work on one module without having to understand the details of other modules.
Incremental development means that software design is never done. Design happens continuously over the life of a system: developers should always be thinking about design issues. Incremental development also means continuous redesign.
You can then use these when you are coding: when you see a red flag, stop and look for an alternate design that eliminates the problem.
Complexity is more apparent to readers than writers. If you write a piece of code and it seems simple to you, but other people think it is complex, then it is complex.
complexity of a system would be the complexity of its worst module.
Bringing pieces of code together is most beneficial if they are closely related. If the pieces are unrelated, they are probably better off apart.
I have noticed that the design-it-twice principle is sometimes hard for really smart people to embrace.
The design-it-twice approach not only improves your designs, but it also improves your design skills.
the process of writing comments, if done correctly, will actually improve a system’s design.
Documentation can reduce cognitive load by providing developers with the information they need to make changes and by making it easy for developers to ignore information that is irrelevant.
The idea of an abstraction is to provide a simple way of thinking about something, but code is so detailed that it can be hard to see the abstraction just from reading the code.
Developers should be able to understand the abstraction provided by a module without reading any code other than its externally visible declarations.
Writing the comments first makes documentation part of the design process. Not only does this produce better documentation, but it also produces better designs and it makes the process of writing documentation more enjoyable.
Interfaces. An interface with multiple implementations is another example of consistency. Once you understand one implementation of the interface, any other implementation becomes easier to understand because you already know the features it will have to provide.
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.
software should be designed for ease of reading, not ease of writing.
The problem with test-driven development is that it focuses attention on getting specific features working, rather than finding the best design.
Dealing with complexity is the most important challenge in software design.
The modules you defined carefully at the beginning of a project will save you time later as you reuse them over and over.