Notes & TILs
Search…
Writing Functions
Posted on 24 Jun, 2019
Got to learn some new points regarding functions() in CleanCode.
  1. 1.
    Functions should be small.
  2. 2.
    They should do one thing only.
    FUNCTIONS SHOULD DO ONE THING. THEY SHOULD DO IT WELL. THEY SHOULD DO IT ONLY.
  3. 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. 4.
    Function arguments should NEVER be greater than 3.
  5. 5.
    We should never ignore any part of code.The parts we ignore are where the bugs will hide.
​
PS : I have been reading CleanCode for a while & logging what I learn here.
Last modified 1mo ago
Copy link