One minute
Locality
Parts that changed together should be placed together. Also when you read the code, you should not jump between different parts of the codebase.
Simplicity
Code should be simple to read and understood
Controllable
When you made a change in one place, you should be able to predict where it will affect. So it good to have no hidden dependencies or side effects.
Reasonable
Additional code should have a reason to be there. It should not be added just in case, or because of some good practices. It should be added because it solves a problem, not a book says that it should be there.
Explicit
Code shouldn’t unnecessarily hide the logic. It should be clear what it does.
Good Examples:
- Functions returns objects that contains dedicated result data and you able to see where that object is used.
Bad Examples:
- Exists some common context objects and each function able to write to it. It hard to understand which function is responsible for which part and what is the correct order of function execution.
175 Words
0001-01-01 01:24