How to write clean code ? follow these best practices for writing clean code

How to write clean code ? follow these best practices for writing clean code

This article is not about some java related feature or concept but more than that . Basically I’m going to explain what all mistakes a java developer does while writing the code and hence how you can minimize it and you don’t have to refactor your code .So this article is about BEST PRACTICES a developer should always follow .

Hey programmers , this article is not about some java related feature or concept but more than that . Basically I’m going to explain what all mistakes a java developer does while writing the code and hence how you can minimize it and you don’t have to refactor your code .So this article is about BEST PRACTICES a developer should always follow .

1. What’s there in the name :

A developer should always try to give a meaningful name to the variables, methods and classes . It becomes too easy to understand what the method or class or variable is about when some one reads your code while reviewing it or debugging it. Giving name like a ,b,c to variable do not intent any meaning and becomes less relevant while debugging the code .

  1. Always start the name of a class with upper case .Eg.
public class Employee {

}

here *Employee *is class name and other developers can easily understand that this class deals with employee related stuff.

2. Always start a variable name with lower case .Eg.

private int salary;

here *salary *tells about salary of employee .

3.Always start method name with lower case and do not include And and Or words in method name .Eg.

public int calculateSalary(int noOfDaysWorked , int baseSalary)

4. Write constants in upper case and separate them with under score .Eg.

public final int RETIREMENT_AGE = 58;

Note : do not use special symbols while writing variables ,methods , constants or classes names .

programming best-practices code-review java coding

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Recommended Java Practice Platforms for Your 10,000 Hours | Hacker Noon

Recommended Java Practice Platforms for Your 10,000 Hours. The more you do something the better outcomes you gradually get. This common knowledge applies to Java programming as well.

How to Learn Java As Quickly As Possible: Best Practices to Adopt

Students who start to learn Java and other programming languages often wonder if there are any tips and tricks that will quicken the learning process. I am not sure about tricks in terms of studying, but there are a few handy tips to make the process as quick as it is realistically possible.

Softagram - Making Code Reviews Humane

The story of Softagram is a long one and has many twists. Everything started in a small company long time ago, from the area of static analysis tools development. After many phases, Softagram is focusing on helping developers to get visual feedback on the code change: how is the software design evolving in the pull request under review.

3 Coding Best Practices I learned from Spring Framework in Java

Spring is much more than just another DI and IOC framework and you can learn how to write better code using Spring.

Effective Code Reviews: A Primer

Peer code reviews have increasingly been adopted by engineering teams around the world. Here are 6 tips to make the process better for teams.