I’ve been doing a lot of documentation for my personal style of building enterprise application using .Net 2.0 (sort of extensions to the book Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries by Krzysztof Cwalina and Brad Abrams), and I thought I’d share this one with everyone. Some of my readers may already know that I like to make Visual Basic .Net feel more .Net like, with less of a focus on the overall looseness of its heritage (and I developed for years in VB 3 thru VB 6). Remember, these guidelines are for building enterprise applications, not rapid application development (RAD) applications. When building something in a RAD style, I use the standard Visual Studio configuration of Visual Basic.
Visual Basic was around long before .Net, and for backwards compatibility, some concessions were made in the Visual Studio IDE to accommodate backward compatibility. Since we are now in the third version of VB.Net, it is about time to cut ties with Visual Basic 6, and embrace the .Net framework when building enterprise applications (these guidelines are not intended for rapid application development).
Do set the project property “Option Strict” to On. This option is set in the Compile tab of the Project Properties
Do set the project property “Option Explicit” to On (this is the default). This option is set in the Compile tab of the Project Property.
Do remove all references not needed (a number of references are included by default that may need to be removed). This option is set in the References tab of the Project Properties.
Do not use project level imported namespaces. Instead, put the import statement for each required namespace at the top of every class file. This option is set in the References tab of the Project Properties
Do not use the Microsoft.VisualBasic library if there is an equivalent function in the base .Net framework.
Do not import the Microsoft.VisualBasic at the class level, and instead fully qualify each use of the Microsoft.VisualBasic library. Besides helping enforce the use of the base .Net framework classes, this will also help the developer recognize when they are using a Visual Basic only feature/extension.
I’m sure some Visual Basic purists out there will cringe at my guidelines, but, as I said, this is the third .Net version of the language, might as well cut the backward compatibility to an old version of the language when you are building enterprise applications.