Sloppy Code, Band-Aid Code, and Quality Code

In my short happy life as a programmer I've noticed that most code seems to fall into the above three buckets.

The biggest offenders in the Sloppy Code camp usually come from the VB.NET camp, simply because the language has become so distorted from efforts by Microsoft at giving it new life instead of a decent burial that they've perpetuated gobs of crutch and helper methods, most of which live in the non-CLS-Compliant Microsoft.VisualBasic namespace. (I see where in VS.NET 2005, this is actually marked as CLS-Compliant for the first time, but I'll need to see proof before I believe it).

In order to do the things that .NET needed, Microsoft decided that they had to "break compatibility" with previous VB versions. VB programs had been mostly "upward compatible" from VB1 right up to VB6. A program written in the first version of VB would still compile and run in the next version. But with VB.NET, they found they just couldn't make the language completely OOP and maintain this upward compatibily. So, once this fundamental decision was made, the floodgates opened, and now you have VB.NET, which has become a real mess, IMHO.

Variants are an example. They're gone. Probably no other single feature of Visual Basic being "Not.Net" better represents the philosophy of "easy and loose". I remember my first introduction to VB 3.0: "Well, Mama, Lookee here! With this here Variant data type, we don't have to declare no variables or nothin'! We can just think 'em up and code at 'em! Whoopee!"

Of course, now you have crutch code that attempts to do the same thing with the Object datatype with LateBinding.This and Information.That, etc.

But the biggest offense with Sloppy Code (both in VB.NET and C#) is the failure to put in any exception - handling. I know - we get post after post to the eggheadcafe.com messageboards with people asking "what went wrong", or even "There's a BUG in...". Look for a try - catch block in their code sample -- it ain't there.

Band-Aid Code is a little more sophisticated. It's the attempt to "Fix" what shouldn't have been done wrong in the first place. I have seen entire corporate operations literally CONSUMED with the maintenance of "Band-Aid Code"! Sad, but true.

Finally, we've got Quality Code.

Quality code is carefully written, it's Object Oriented, it uses interfaces, structured exception handling, its easy to read, and its maintainable. To write quality code, you have to study. You have to RTFM and know where the F1 key is. And -- (gasp!) --you have to think. Viva la Quality Code!