Wednesday, December 29, 2010

Developer Golden Rules

Below are some golden rules for the developer based on my experience with .Net Framework:

· Avoid shared members

· Avoid public variables in classes, always use properties

· Avoid db queries within the loop, always use batch insert, update …

· Avoid raising event on web applications

· Avoid unhandled exceptions

· Avoid MORE handled exceptions with empty catch, it is morphine!

· Avoid imports namespace; try to use fully qualified namespace: system.Lib.Lab.object

· Avoid (or never use) queries in GUI layer, always use BLL for queries

· Respect naming convention for variables and methods, CamelCase for variables (ActiveVar) , and lowerCamelCase for GUI objects (txtUsername), and _VarName for property local variables

· Avoid using modules; it is always reserved for system Architect

· Avoid String manipulation “Bla” & “Foo” always use StringBuilder or String.Format

· Avoid String comparison without .ToLower, make sure the Str has value ( If Not String.IsEmptyOrNull() AndAlso S=”..”)

· Avoid using AJAX without handling OnFailure requests

· Avoid Plaintext with AJAX, always use JSON response for AJAX Requests.

· Avoid Using Stream.ReadToEnd, always read buffer/buffer

Avoid does not mean DO NOT USE: Standard = 98xStandard + 2xUnstandard

No comments: