Photo from Unsplash

In software development, clean code is very important. To write a clean, understandable, and maintainable is an important skill for any software developer. It is frustrating to continue someone else’s code but you cannot understand what it’s doing. In this article, I’ve list some of my tips to make your code a bit cleaner and easier to understand for everyone.

Meaningful Variable Names

int x = 1; // period number
int c = 0; // counter
int periodNumber = 1;
int counter = 0;

When you need to put a function as an argument you don’t need the function variable, use _ as the variable name.

Use _ for the builder function

Comment when necessary

// A comment starts with 2 slashes/// A documentation starts with 3 slashes

You can write comments on a complex algorithm, but not on every class or methods. Here’s my example for documentations on an abstract class:

Keep Functions Small

Before extraction

To Something like this:

Create a function
Apply the function

Project Structure


Know Your Language’s Convention

If you want to learn more about clean code, I recommend to read this book: Clean Code: A Handbook of Agile Software Craftsmanship, Robert C. Martin, Prentice Hall, 2008.

Thanks for reading my article. I hope you find it interesting :)


Computer Science Student

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store