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!!
Top comments (2)
You should go deeper and continue this article using a example
alright, great suggestion