.NET has introduced since its very first version the concept of enumerations. It's of course quite nice and allow us to replace magic numbers in the code by self documented structure.
But their use is far over too common, without thinking before to the consequences of such a choice.
First people usually think that using an enum as a function parameter restrinct the range of the accepted values. Wrong.
We all know unfortunately that developpers use something without knowing all of it.
But this is not my main concern with enumerations.
Starting to use an enum will of course lead to some points in the code to conditional code, either using a "if / else" structure or a "switch" (please don't forget the default !). And this conditional code will soon start spreading all over the code.
And what happen if you had later on a new value to the enum ? You should check (and potentially update) the very numerous places where you have been using it to update acordingly the conditions to let it continue working with the new value.
OO and centralized code you have said ? No, no longer.
I won't discuss here more in detail this problematic as we have decided to hold an open discussion next tuesday (11th September 2007) either in Charleroi or in Brussels to address this specific point.
Interested in participating or in exchanging on this subject ? Please, leave a comment !