Next part of my notes from Clean Code: A Handbook of Agile Software Craftsmanship, by Robert C. Martin. Kent Beck invented four rules of simple design: Runs all the tests Our project has to give us a system that works in the intended way. A system that is not tested cannot be … Continue reading Emergence
Category: Clean Code
Systems
Next part of my notes from Clean Code: A Handbook of Agile Software Craftsmanship, by Robert C. Martin. Is one person able to manage all details of a big system? Probably not. Also a city exist thanks to teams that take care of different parts of it: water supply, traffic, healthcare, electricity. Some of them know … Continue reading Systems
Unit tests
Next part of my notes from Clean Code: A Handbook of Agile Software Craftsmanship, by Robert C. Martin. Clean tests Having clean tests is as important as writing clean production code. Why? Writing poor quality testing code makes it more and more expensive to maintain and extend. After some time tests become less reliable … Continue reading Unit tests
Error handling
Next part of my notes from Clean Code: A Handbook of Agile Software Craftsmanship, by Robert C. Martin. Don't return and don't pass null Returning null is creating additional work and problems for methods that consume our function. We do not want methods to consist mainly of lines checking for nulls. In the code above we have … Continue reading Error handling
Classes and objects
Next part of my notes from Clean Code: A Handbook of Agile Software Craftsmanship, by Robert C. Martin. Hiding implementation Create a new class... add private fields (yes, yes, of course - we follow encapsulation)... add public getters and setters to all your private fields... STOP! There is a reason why you made your fields private in … Continue reading Classes and objects
Functions
Next part of my notes from Clean Code: A Handbook of Agile Software Craftsmanship, by Robert C. Martin. "Functions should do one thing. They should do it well. They should do it only." Robert C. Martin Functions should be small. It is much better to have many small functions with distinct responsibilities than a big one. … Continue reading Functions
Names and Comments
Next part of my notes from Clean Code: A Handbook of Agile Software Craftsmanship, by Robert C. Martin. Names What makes a good name of a class, method, variable, etc.? Every name created in the code should be: meaningful and reveal coder's intentions The name of a variable, function or class should answer questions such as why … Continue reading Names and Comments
Clean Code
This series of posts will be my notes from Clean Code: A Handbook of Agile Software Craftsmanship, by Robert C. Martin (known as Uncle Bob). Unlike other books that teach how to use specific language, this book is about style. The rules that Uncle Bob gives here are applicable to any object-oriented language, although examples in … Continue reading Clean Code
The Law of Demeter
Principle of Least Knowledge The Law of Demeter or Principle of Least Knowledge is a style rule for designing object-oriented systems. It was formed by Ian Holland in 1987. It states that a module should know nothing about the internals of an object that it uses. Modules that manipulate an object should tell it to do something … Continue reading The Law of Demeter
