Saturday, July 11, 2009

C# Development Best Practice

I didn’t want to re-import pictures, so here are some snapshots from my old blog:

 

image

image

image

image

image

image

image

image

Thursday, July 9, 2009

Casing / Notation

Camel Case

The capitalization of a word is such that the first letter is lowercase and the first letter of each successive word is uppercase, e.g. "propertiesFilename".

Pascal Case

The capitalization of a word, similar to Camel Case except that even the first word is capitalized, e.g. "PropertiesFilename".

Acronyms

Two-letter acronyms use all uppercase letters, such as "DH" or "IO". Acronyms of three or more letters use Pascal casing, such as "Dms" or "Xml".

See MSDN documentation on this topic.

Magic Number

A number that is used in the code, other than 0, that has some special meaning and is not defined by the use of a "const int" or similar declaration. Such a number is difficult to understand why that number is used or what the number actually refers to. Using a "const int" or similar construct to define it also will give it a meaning and allow it to be understood. Compare

if (i == 64)

with

if (debugLevel == DEBUGLEVEL_FULL).

Hungarian Notation

The naming of variables such that the variable type is imbedded in the variable name. For example, "int iLineNumber = 0;" starts with the letter "i" in order to show that the variable is of type "int".

Patterns

Code Smell

A recognizable and problematic pattern in the source code of computer programming. Such a pattern indicates that the source code could be better written to avoid the problematic pattern. When code smells are recognized, known solutions are applied to remedy the problem. For example, code that is repeated multiple times is a code smell. The solution for that particular code smell is to make a function or method of that code that can be used or called when necessar.

Code Styles

OO:Object oriented

The creation of classes to contain both the structures of data wanted and the methods to operate on that data. (Data will be treated as singular or plural in this document; that data, those data. Datum will not be used for the singular of data.)