Good Programming Practices - EBook

Good Programming Practices

A guide to your “code”

Prepared by
Dinesh Bhat
41 Pages

Contents

Introduction
GUIDELINES
best practices for Good programming
Avoid having too large files.
Avoid writing very long methods.

White Space
Blank Spaces
Parentheses
Naming Guidelines
Use Early Binding for Better performance
Returning Values
Statements

Method name should tell what it does.
A method should do only 'one job'.
Pay Attention to Initialization Order
Do not hardcode numbers.
String Concatenation
Avoid using many member variables.
Use enum wherever required.
Do not make the member variables public or protected.

Never hardcode a path or drive name in code.
"self check" when the application startsup.
Error messages should help the user to solve the problem.
Avoid commenting every line of code.
Exception Handling
Memory Management
Data Access
SErialization
Multithreading

Remoting
Enterprise Services
Security
ASP.net
Disable Session State when not in use

Choose your Session State provider carefully
Usage of ViewState
Avoid excessive round trips to the server
Use Page.IsPostback to avoid extra work on a round trip
Reuse work by Caching
Remove code from content as much as possible

New Page Directives
Use Response.Write for String concatenation
Do not forget to disable Debug mode
Use server controls only when appropriate
Use the WEB.CONFIG/Machine.Config FILE to store application wide data
Exception handling in ASP.Net
General Tips

Good Programming Practices - EBook

No comments: