Constants Usage

January 17, 2007

Hi Guys,

These are set of guidelines suggested by Krzysztof C and Microsoft Design Guidelines on the web on Constant Usage.

1. If a value is constant in nature (never changes its value in its life time) make it a constant, such as Pi. [MSDN2: Microsoft design Guidelines]

2. If a literal used in two different assemblies make it public static read-only.

3. If a literal used in two different types (e.g. classes) in the same assembly make it a public constant and introduce a separate Constants code file.

4. If a literal used in two different members (method or a property) in a same type (e.g. class) make it a private field constant.

5. If a literal occurred in two places in a member, make it a local constant.

6. If a string literal is used at least once, consider it making a constant. (This guideline is the controversial oneJ)

It also says that, using constants is better than not using them.

I also see that the Maintainability aspect should get the precedence over any other “good” technical practices behind constants.


My First Blog

January 12, 2007

Hi Guys, welcome to my blog!!!!


Hello world!

January 12, 2007

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!