I remember those days when I started my career in programming. I struggled to write a piece of code and who cared for the coding standards at that time. As time went on, I was getting some command over programming and was able to think of particular scenarios to solve problems. From the start of my career until today, I have found a continity, and that is learning. At that stage, I was learning to manage basic things and now, I am learning to handle the problems. So, in life, learning is a never-ending process. Everyday, we learn something, whether it's from reading articles, watching videos, or by our own mistakes or success in this programming environment.
As per my experience, we should not write our code like a layman. We should follow some coding standard to write clean, reusable, readable, and maintainable code.
I don't know exactly how many people are following coding standards. Even I was not perfectly following the coding standards. However, here are some of the coding guidelines that I used to follow.

To develop reusable, reliable, readable, well-structured, and maintainable application, we must follow the coding standard. There are several coding practices in the software industry. None of them are good or bad but the main thing is that whatever approach we follow, we should make sure that everyone should follow the same standard.

Code Smell
Code Smell is a technical word used to describe the quality of code - how a programmer writes this code.
Code smell is often a word used to describe code that you don't like. In that sense, it is synonymous to ugly, dirty, unclean,repeated, etc. Even though these types of code work perfectly but are hard to handle and maintain.There are a few reasons why our code smells.
- Duplicated Code
- Methods too big
- Classes with too many instance variables
- Classes with too much code
- Lazy class / freeloader
Now, let's see how we can write clean code and avoid these smells in the programme. Let's continue our discussion from the basic coding standard, that is, on Naming Convention.
While we are coding, we shall focus on our naming standard. There are 2 main types of naming standards that we are using these days.
- Pascal casing
A word with the first letter capitalized, and the first letter of each subsequent word-part capitalized.
Ex - CustomerName, EmployeeDetails, Salary,etc.
- Camel casing
A word with the first letter lowercase, and the first letter of each subsequent word-part capitalized.
EX-customerName, employeeDetails, salary
Let's see where we will use which type of casing.
Always use class name and method name in Pascel casing.
public class EmployeeDetails
{
.......
}
Now, this is how we declare methods inside a class.
public class EmployeeDetails
{
public void GetEmployeeSalary()
{
---------------
}
}
Always use variables and parameter names in Camel casing.
public class EmployeeDetails
{
private int totalSalary = 0;
public void GetEmployeeSalary( int employeeId)
{
int amount = 30000;
}
}
Always use letter "I" as prefix with name of interface. After letter I, use Pascal case.
using System;
namespace cleanacode
{
interface IEmployee
{
void GetDetails();
}
}
Use meaningful variables and method names while coding. These names should be self descriptive.
For this, I have created two samples of code. Check the first piece of code. Do you think this code will work effectively for maintainance and code review purposes?
public class EmployeeDetails
{
public void GetSalary(int x, int p)
{
int z = x + p;
}
}

When a new developer checks this code, what he will understand? Now, check the same piece of code with a well organized and good coding standard.
public class EmployeeDetails
{
public void GetEmployeeSalary( int salary, int bonus)
{
int totalSalary = salary + bonus;
}
}

Always rename the variables with a descriptive name. Don't use unnecessary name for any variable so that it will be easy to maintain.
Whenever you are writting any method, always try to write the purpose of the method. Use summary or normal comments to specify the purpose of methods with the short description of parameters.
Here, in this example, we will show how to use this.
So, you can use summary by writing three forward slashes in VS.
public class EmployeeDetails
{
/// <summary>
/// To calculate total salary.
/// </summary>
/// <param name="salary"></param>
/// <param name="bonus"></param>
public void GetEmployeeSalary( int salary, int bonus)
{
int totalSalary = salary + bonus;
}
}
Don't use long method in the project. If by any chance you are using the long method, please use region to make it easy to understand.
/// <summary>
/// To calculate total salary.
/// </summary>
/// <param name="userId"></param>
/// <param name="bonus"></param>
/// <param name="noOfDays"></param>
/// <param name="tax"></param>
/// <param name="deduction"></param>
public void GetEmployeeSalary(string userId,int bonus,int noOfDays,float tax,float deduction)
{
float bsal;
float hra;
float da;
float pf;
float extra;
float total;
#region BasicSalary
float monthlySalary = EmployeeDetails.GetSalary("UI54");
float basicSalary = monthlySalary + bonus;
#endregion
#region Calculate PF
pf= 15 * basicSalary / 100;
#endregion
#region Calculate HRA
hra= 20 * basicSalary / 100;
#endregion
#region Extra
extra = 2 * basicSalary / 100;
#endregion
#region Netsalary after deduction
total = basicSalary - (pf + hra + extra);
#endregion
}
/// <summary>
/// getting user salary
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public static int GetSalary(string userId)
{
if (userId=="UI100")
{
return 60000;
}
else
{
return 45000;
}
} 
















Oleg ZubatenkoPosted Jul 9, 2017, 6:01 AM
It's enough useful the article
Shakti Singh DulawatPosted May 29, 2017, 11:36 AM
Interesting writing good for new one
Mithun KumarPosted May 28, 2017, 7:24 AM
Thanks for share this article.
Manas MohapatraPosted May 18, 2017, 8:53 AM
Although these are basic but collection is really good with examples and description. Keep it bro :)
Sumit DeshmukhPosted May 13, 2017, 8:24 AM
Hey Debendra, Thanks for sharing article.Really nice.
Saravanakumar SekaranPosted May 10, 2017, 2:35 AM
Hello debendra thanks for sharing superb article.
Vivek ShethPosted May 8, 2017, 12:35 AM
Hello Debendra, Thanks for sharing nice article. I have one question. Instead of writing big method(including big business logic), i preferred to divide this method in small methods and call them in one method method because for me it looks so neat and easy to maintain. But my Team Lead said that "Don't write small methods and call them in one because it consumes more memory while you call small methods." Is that correct ? Please suggest what should i do in this case ?
Surya Pratap SinghPosted May 5, 2017, 7:56 AM
nice tips..............
RakeshPosted May 4, 2017, 2:21 PM
Good Information..................
Rajesh KadamPosted May 4, 2017, 3:23 AM
Awesome article..Very nice
SubashPosted May 3, 2017, 9:58 PM
Very nice and useful share
Hariharan KrishnamoorthiPosted May 3, 2017, 9:20 AM
Great Article for the developers.
Suthish NairPosted May 2, 2017, 3:28 AM
Well done.. Nice writing..
Rajan AroraPosted May 2, 2017, 2:31 AM
Superb Article. Thank you for Sharing
Vaibhav DeshmukhPosted May 1, 2017, 4:40 AM
I found something new from your article.Thanks for sharing.
Abhijit KakadePosted May 1, 2017, 3:27 AM
Very nice article in details. agree with Mahesh Chand. Thank you Debendra. Keep sharing.
Mahesh ChandPosted May 1, 2017, 12:45 AM
Good one. I am sure even an experience developer can learn from it a thing or two.
Manav PandyaPosted May 1, 2017, 12:17 AM
Nice share .......................................
Khaja MoizuddinPosted Apr 30, 2017, 11:13 AM
Good Article for beginners like me.