24/12/2013: 10 Best Practices of programming from CodeSpread(31-40)

bestpractice
bestpractice

24/12/2013: 10 Best Practices of programming from CodeSpread(31-40)

We love programming and having a knowledge of best practices always helps in writing beautiful code. We have shared first 20 random best practice in our previous articles 1-10, 11-20, 21-30. More best practices from CodeSpread.

Best Practice #31, Naming Conventions are important,

Use Pascal Casing for class, interface, constants and methods names.

For example:


interface INewClass

{

void NewMethod();

}

public class NewClass : INewClass

{

public const int NewConstant=10;

public void NewMethod()

{

}

}

Best Practice #32,Use camel casing for local variable and parameters.


public class NewClass

{

public int countEmployee;

public void NewMethod(int customerId)

{

}

}

Best Practice #33, Do not use abbreviated language. For ex: do not use single alphabets as it does not convey any useful meaning.


int i=1;

int j=2;

Best Practice #34, Always use descriptive language for naming.


int count=10;

void GetEmployeeCount();

Best Practice #35, Use #region to summate the block of codes together and have a clean separation.


#region Get Customer Details

public class Customer

{

public int customerCount;

public void GetCustomerDetails(int customerId)

{

}

}

#endregion

Best Practice #36, Always maintain updated comments. Use // or ///.


//Get Employee Details

Public Employee GetDetails(int employeeId)

{

}

Best Practice #37, Follow Solid principles.

Best Practice #38, Instead of using hardcoded values, use constants or read only properties.

Best Practice #39, Always trim the reference values used for comparison.

Best Practice #40,Use string.Empty instead of “”.

We would love to hear from our users about the best practices used by them. Please write to admin@codespread.com.

Author: hershey

A passion for knowledge drives me to do programming, A passion for programming drives me to create something different, A passion for creation drives me to spread the knowledge.

Share This Post On

0 Comments

  1. nice superb explaination

    Post a Reply
  2. thanks for the tutorial
    I am having a problem.
    The feature “Create SQL server database” isn’t available , I can’t select it.
    Can you help, please ?

    Post a Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

More from CodeSpread:

  • 17/12/2013: 10 Best Practices of programming from CodeSpread(11-20)17/12/2013: 10 Best Practices of programming from CodeSpread(11-20)We love programming and having a knowledge of best practices always helps in writing beautiful code. We have shared first 10 random best practice in our previous article here, now we are sharing fe...
  • 16/12/2013: 10 Best Practices of programming from CodeSpread16/12/2013: 10 Best Practices of programming from CodeSpreadWe love programming and having a knowledge of best practices always helps in writing beautiful code. Here, we have few best practices shared by professionals. Best Practice#1, Use foreach loop i...
  • 18/12/2013: 10 Best Practices of programming from CodeSpread(21-30)18/12/2013: 10 Best Practices of programming from CodeSpread(21-30)We love programming and having a knowledge of best practices always helps in writing beautiful code. We have shared first 20 random best practice in our previous articles 1-10, 11-20. More best pra...
  • 23 Dec: Must Read Codes [11-15]23 Dec: Must Read Codes [11-15]We are sharing few must read codes/concepts which are required now and then. Each of these codereads doesn’t require a full length descriptive article so combining them into groups of five. CodeRe...
  • Tip : Code Structure C#Tip : Code Structure C#As a developer, I always stress on developing a habit of following the best practices to structure the code. It helps me to easily navigate through the code and also saves a lot of effort in search...
  • Styles of Source Code Comments in C#, SQL, XML, HTML, CSS, JavaScriptStyles of Source Code Comments in C#, SQL, XML, HTML, CSS, JavaScriptDevelopers take months to write beautiful pieces of code and reviewer gets only few hours or I say, minutes to provide suggestions and improvisations. Then it becomes a hard deal for a developer to...
  • Agile Encounters UnpredictabilityAgile Encounters UnpredictabilityWhat is Agile? Wikipedia says “Agile software development is a group of software development methods based on iterative and incremental development, where requirements and solutions evolve through...
  • 19 Dec: Must Read Codes [1-5]19 Dec: Must Read Codes [1-5]We are sharing few must read codes/concepts which are required now and then. Each of these codereads doesn't require a full length descriptive article so combining them into groups of five. CodeRe...