[SUMMARY] Clean Code Chapter 3: Functions (Robert C. Martin)
Small!
Do One Thing
The Stepdown Rule
Switch Statements
Use Descriptive Names
Function Arguments
Reducing Arguments
Recommended by LinkedIn
Have No Side Effects
Command Query Separation (CQS)
Exceptions over Error Codes
Don’t Repeat Yourself (DRY)
Conclusion
Like writing a book where functions are verbs and classes are nouns, you don’t have clean code right away. You start with code that works as a first draft and refactor it to have a clean expressive code - TDD helps with that.
For more details and analyses, I highly recommend reading the book!
The summary of the previous chapters are available as posts :)
« Only 1 indent => everything in blocks (if, try …) should be a function call! » => This reduces our mental load so much!
Thank you for the summary, i will definitely read this book.