Writing Functions (Uncle Bob's principles)
Shoaib Akbar
Posted on July 7, 2020
Some principles to write functions from Clean Code book
- The first rule of functions is that they should be small.
The second rule of functions is that they should be smaller
than that (upto 20 lines of code)FUNCTIONS SHOULD DO ONE THING
Function Arguments
Better if no argument
Functions should have maximum of 2 arguments
But arguments should not be exceeded by 3
(They take a lot of conceptual power)It should has same level of abstraction
(1 level of abstraction)Passing a boolean into a function is a truly terrible
practice. (Flag as argument)
Keep Learning!!
💖 💪 🙅 🚩
Shoaib Akbar
Posted on July 7, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.