Posts Tagged ‘object oriented design’

Why the default form instance does more harm than good

February 2, 2012 1 comment

First things first. The default form instance is a feature of VB.NET for versions 2.0 and up, applicable only to WinForms projects, and provides a forms management functionality that is in keeping with the code “feel” of VB6, the predecessor of VB.NET. Functionally, this feature allows for the programmer to use the name of a form to directly reference instance members on that form’s class (i.e. controls, properties). This feature made sense when working with forms in VB6

This of course flies in the face of object oriented design (and the .NET framework’s design patterns for that matter) which leaves the onus on the developer to be in control of his own object instances. In essence it introduces a non-OO principle into an OO language — and this is the starting point of my argument that in net sum, this is a harmful feature… at least in the way it is presented in the default WinForms Visual Studio template (I’ll clarify that later).
Read more…