Clean Code: A Handbook of Agile Software Craftsmanship (Robert C. Martin Series)
Rate it:
Open Preview
31%
Flag icon
Instead of experimenting and trying out the new stuff in our production code, we could write some tests to explore our understanding of the third-party code. Jim Newkirk calls such tests learning tests.1
32%
Flag icon
First Law You may not write production code until you have written a failing unit test. Second Law You may not write more of a unit test than is sufficient to fail, and not compiling is failing. Third Law You may not write more production code than is sufficient to pass the currently failing test.
33%
Flag icon
If you don’t keep your tests clean, you will lose them. And without them, you lose the very thing that keeps your production code flexible. Yes, you read that correctly. It is unit tests that keep our code flexible, maintainable, and reusable. The reason is simple. If you have tests, you do not fear making changes to the code! Without tests every change is a possible bug.
35%
Flag icon
With functions we measured size by counting physical lines. With classes we use a different measure. We count responsibilities.1
36%
Flag icon
The Single Responsibility Principle (SRP)2 states that a class or module should have one, and only one, reason to change.
39%
Flag icon
In an ideal system, we incorporate new features by extending the system, not by making modifications to existing code.