Skip to content

JavaScript Marathon: How to Write Clean Code

This article was written over 18 months ago and may contain information that is out of date. Some content may be relevant but please refer to the relevant official documentation or available resources for the latest information.

Writing clean code is an essential part of any developer’s toolkit. Not only does it ensure legibility, but it also helps you and other developers understand what your code is doing at a quick glance.

In this article, I’ll share with you the key takeaways from Nacho Vazquez’s session on writing clean code. These points can be found in Uncle Bob’s book “Clean Code: A Handbook of Agile Software Craftsmanship”.

Host

Nacho Vazquez @nacho_devc
  • Software Engineer, This Dot Labs

Key Takeaways

  • Clean code is more of an art and intuition!!
  • To become effective at writing clean code, constant practice is needed!
  • In order to write clean code, a combination of proper naming with variables, functions and components is needed.
  • Don't be afraid to use long names for your variables

Naming Lessons for Programming!

JSMarathon  N_V SS #1
  • No abbreviations
  • Avoid disinformation
  • Make meaningful distinctions
  • Pronounceable names
  • Searchable names
  • Use domain-specific names
  • Abstraction and code-splitting is effective, yet needs to be managed carefully
JSMarathon N_V SS #2
  • Abbreviations
    • Don't Repeat Yourself
    • Write Everything Twice
    • Avoid Hasty Abstractions
    • You Ain't Gunna Need It
  • Don't abstract prematurely. Wait until it becomes necessary (if your code starts to become hard to read for example).
JSMarathon N_V SS #3

If you missed the #javascriptmarathon make sure to head on over and watch it. Nacho shares a lot of useful information in such a short period of time alongside practical examples.