Better Programming

Advice for programmers.

Member-only story

12 Conventions for Writing Clean Code

5 min readApr 26, 2021

--

blank computer screen and a keyboard sitting on a desk
Photo by Sora Sagano on Unsplash

Coding conventions are the style guidelines for programming. Programming best practices and principles are included in this. Here we will discuss some coding conventions.

Benefits of Following Conventions

  • Clean code
  • Quality of code
  • Readability of code
  • Makes code maintenance easier

“Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer’s intent but rather is full of crisp abstractions and straightforward lines of control.” — Robert C. Martin

1. Magic Numbers

A magic number means we are assigning a number with no clear meaning. Sometimes we use a value for a specific purpose, and we don't assign the value in a meaningful variable. The problem is that when someone works with your code, then the person doesn't know the meaning of that direct value.

--

--