Ok, I will admit, maybe I am being a little nit picky here. However, it is driving me crazy. As I have posted in prior post (here and here), I am in the middle of studying for the MCTS exam #70-536.
As I am reading though the book, looking over the code snippets I notice some of the 'bad' practices that are going on.
Using 'Magic Strings' in place of constants
Above they are using a 'magic string' in 2 different places as keys for serialization. Why not use a constant?
Use the + for string concatenation:
Here they are using the '+' operator to concatenate strings. However, a few chapters prior in the book they explicitly talk about NOT doing this. They talk about using the StringBuilder object or String.Format.
You may be asking yourself, why does he care about this? The answer is quite simple. Many people are reading this book that are trying to learn .Net (this is actually the case at my shop). If the see the authors of books like these (this book is not unique) doing 'poor practices' they will start to think that doing this stuff is acceptable.
Again, maybe I am being picky, but I would think that an educational book would attempt to follow best practices when ever possible.
07-02-2007 7:25 PM