Profile image

Uche's Coding Corner

Passionate about software, technology, personal discoveries, and more.

10 Tips for clean code

Fri Nov 01 2019 🍵 0 min read

I was listening to a YouTube video on Clean Code by Michael Toppa during a short break from work. This video is an awesome summary of what you should keep in mind when you are structuring your code or implementing a new feature.

If you've come across a bit of nasty code that you wrote months ago and wondered how to refactor it, then the tips in this video are a good place to start.

I highly recommend that you watch the video for more details (the video is at the end of this post). Below is the list of the 10 Tips he mentioned for having clean code:

  1. You are responsible for the quality of your code

  2. Use meaningful names

  3. Write code that expresses intent

  4. Comments are often lies waiting to happen. Code should speak for itself whenever possible

  5. Boy Scout Rule: Leave the code better than you found it

  6. Single Responsible Principle (SPR)

  7. Write tests (Test-driven development (TDD))

  8. Work in short cycles: incremental and iterative

  9. Independent Architecture

  10. Practice makes perfect

learning
education