Best practises are methods and techniques for achieving a certain goal. By their very nature they set the standard for us to follow, and form a mechanism by which developers can be judged.
ASP.NET is my platform of choice when developing applications, but it gets a bum rap from developers on both sides of the open source debate, for its creators’ inherently arrogant approach to Web standards.
While working on a new project I thought I’d have to bite my tongue when I saw some of the .NET markup that was being used, but after a while it dawned on me that what was being written wasn’t incorrect, it was simply following Microsoft’s best practises rather than, for example the W3C.
Under ASP.NET, the tools that allow developers to change the styling for Webpage elements (font faces, sizes, colours, etc) are very close to hand. When adding a text box control to a form, the user can specify its border style, font size and colour aswell as the usual stuff like maximum length and validation functionality. Now as part of the XHTML and CSS methodology, which encourages the separation of content and styling, this type of customisation is abhorrent: it’s simply not the done thing. However, when developing the .NET Framework (and specifically ASP.NET), Microsoft were simply following a pattern.
Some people actually don’t realise, but the .NET Framework in and of itself has nothing to do with Web development: it is simply a software framework. Programmers can build desktop and console applications, libraries and games with it. Now in desktop application development it is very common for developers to be given the option to change how a form looks by hard-coding the window styles directly into the application. There is no CSS technology for desktop applications, and so programmers pick colours from a specific palette (which include system colours) and fonts from a dropdown list, to suit their needs.
Not only can you build both desktop and Web applications with the .NET Framework, you can also use the same software (Visual Studio) to build both types of application, so developers could make the transition from building Windows Forms apps to producing Websites. Microsoft even took care to give the Web versions of their controls (like textboxes and labels) the same or similar name as their Windows Forms counterparts, with the same abilities to change styling that programmers had grown used to.
So I think it’s unfair to rail at Microsoft for not embracing W3C, when this isn’t actually the case. As a standards-conscious developer I’m not forced to use the hard-coded styling method that I would use with Windows apps: I can apply CSS classes to my controls just like I could in HTML.
So hard-coding your “look and feel” doesn’t make you a bad Web developer: just one that’s following one set of practises. Problems only arise when developers pick and choose elements from different methodologies to create their own which makes picking up someone else’s project that bit more difficult.
This realisation has made me a more forgiving programmer: now I just have to learn to resist the urge to force my ideals onto others.
