cover-img

5 Best coding practices for beginners

4 December, 2022

3

3

0

As a beginner in coding, There are some practices that you should know which will help you in writing good code.

What is good code?

A code is considered good if it is not complicated, easily readable and understandable.
In this blog, I am sharing 5 tips with you that will help you write good code.

1. Variable naming convention

When you make a program, the variables declared should have names that describe the kind of data they store in them. If you give variables names like A, B, or C the code will become extremely unreadable. As a beginner, We write small programs so we don't care about the naming convention but when you will write large programs like 1000 lines of code. At that point, you will understand the need for appropriate naming.
The above code is written in Java so people who don't understand Java will not understand it. To overcome this problem comments came in picture.

2. Comments

Comments are the most important thing when it comes to readability. Variable can tell what they store in them but can not tell about the functionality of the code. To understand the functionality comments are written.
By reading the comments any developer can easily understand the code regardless of whether they know the language or not.

3. Reusability

Reusability simply mean follow the DRY principle. DRY stands for Don't Repeat Yourself.
This principle states that there should be no repetition in code. Repetition reduces maintainability. If the code is repetitive and you want to make changes in that code you have to change it at every place you wrote it. You can make modules or functions of that code and reuse it which will make the code more readable, maintainable, and scalable.

4. Structuring ( Indentation )

Indentation means giving proper spaces in code. Indentation helps you to make your code clear and visible. If we remove indentation from the code, it will become a complete mess. In some languages like Python Indentation is compulsory, but in some languages like C++ and Java, it is optional. You can easily understand the importance of indentation by looking at the code below.

Code without indentation
Code with indentation

5. Code refactoring

Code refactoring is the process of restructuring the code without changing its functionality. In other words, you can call it the process of converting dirty code into clean code.
Code before refactoring
Some IDEs like intelliJ, PyCharm also suggests refactoring like this.
img
Code after refactoring
This code looks much cleaner, but Code refactoring should be done very carefully because sometimes it makes code complex.

coding

tricks

tips

develevate

bestpractices

3

3

0

coding

tricks

tips

develevate

bestpractices

Lakshay Pruthi
• Web Developer •

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2025. Showcase Creators Inc. All rights reserved.