C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Tips » General »

Coding Standard & Code Review Points [Dot Net]


Posted Date: 09 Jun 2008    Resource Type: Tips    Category: General
Author: Kumar VeluMember Level: Diamond    
Rating: 1 out of 5Points: 10



Following 20 points which are discussed below are not an expert advice, however,it is based on my knowledge & experience.

It is nice to follow these guideline for better coding practice.

General Guidelines:

1)Write comment for all methods.

2)Please don’t write many lines of code in a single method instead make separate private methods and write into them.

3)When you are writing many if endif statement, write comment after each if and endif statement.

4)When you are writing many if endif statement, write comment after each if and endif statement.

5)do not hard code the integer value in the code file, Write into a configuration file or store into database otherwise its very tough to change later on, if needed.

6)store long messages that need to show to the user in case of error or any condition failure into configuration file.

7)Please check query string value for correct format before storing into variables.

8)When you are instantiating an object and calling its methods, please write some comments about the object & its methods. Give some meaningful name to the object or variables.

9)Generally variable declaration should not be kept inside the try block. Put variables declaration out of try block. Try block is used to execute any method that can throw error.

10)In Page_Load event, please use IsPostBack condition, wherever possible.

11)Please unit test the code at least twice before sending for review or sending to the client.

12)String properties of a control or string variables should not be convert into string.

13)Use StringBuilder instead of string concatenation.

14)Instead of directly assigning the value of lblLinks.Text, Concatenate with StrinBuilder and assign the value of the lblLinks.Text at last.

15)DataSet, DataTable should be disposed in finally block.

16)When you are instantiating any object and it has no Dipose method, the ideal way is to nullify the object (in finally block), this indicate the Garbage Collector (GC) that the object is not going to use so its ready to be disposed. However, there is another thought also. As soon as the scope definition of the object ends, the object is ready to be disposed so GC will automatically takes care of it.

17)If there is no proper use of Catch block, do not use catch block.

18)If try is used and exception is caught, it must be handled otherwise error should be thrown.

19)Avoid variable declaration inside the loop.

20)Don’t instantiate any object that you are not going to use.


Any Additional tips and comments are really appreciated

Regards
Kumar Velu.



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Advanced find in outlook
Previous Resource: identifying a system table
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use