Writing Functions
Posted on 24 Jun, 2019
Got to learn some new points regarding functions() in CleanCode.
- 1.Functions should be small.
- 2.They should do one thing only.FUNCTIONS SHOULD DO ONE THING. THEY SHOULD DO IT WELL. THEY SHOULD DO IT ONLY.
- 3.To know if a function is doing more than "one thing" see if you can extract another function from it with a name that is not merely a restatement of its implementation.
- 4.Function arguments should NEVER be greater than 3.
- 5.We should never ignore any part of code.The parts we ignore are where the bugs will hide.