Clean Code Tips (Week 2)
Hello again! The Clean Code tips for the current week are…
- The first rule of functions is that they should be small. This implies that the blocks within if statements,else statements,while statements, and so on should be one line long.
- The smaller and more focused a function is, the easier it is to choose a descriptive name.
- If a function is divided into sections this is an obvious symptom of doing more than one thing. Functions that do one thing cannot be reasonably divided into sections.
- Don’t be afraid to make a name long. A long descriptive name is better than a short enigmatic name. A long descriptive name is better than a long descriptive comment.
I hope it helps in your daily work!
All tips have been taken from Robert Martin’s Clean Code book
Stay tuned for the next week.
blog comments powered by Disqus