Friday, December 21, 2012

WebForms coding standards

Recently I am working with a WebForms environment, and each time when I go back to WebForms stack, I am surprise to realize that programmers that are in this world do not realize so many things that are obvious to other frameworks. Like naming conventions. Why do I see things like:
txtFirstName
btnSubmit
lblLastName
This is totally wrong, and against Microsoft coding standards. I also see this in WinForms environment, programmers somehow do not realize that by doing it you:
Code to a type/control not to a content, you should be able to change the control easily from any type to any type without working of a variable name, here when you change a type from label to literal you need to change a name everywhere you use it.
Besides that there are so many new controls, or custom controls, it is so hard to create a prefix for each of them, and if you use prefix only for a buildin/default controls you are being inconsistent and code looks like a crap.

No comments: