Visual Basic is Evil
At some level, this is simply axiomatic. After all, it is a Microsoft product. But seriously folks...
I had been developing an application to manage the book cart I help run at church, and I've been developing it in Visual Basic .Net. A relatively easy process. Recently, a portion of a project I've been working on at the office looks like it should have a custom program as a solution (a small program, mind you). I was going to rollout VB for it, but it seems that the new standard in the group is C#.
In order to learn C# quickly, I figured the best approach would be to port the book cart application over to C#. There are programs you can buy to do this, but since there were a relatively small number of forms to recreate, I simply rebuilt them and have been redoing the code to make it C#. Since it has been a couple of years since I touched Java (which is quite similar to C#), I mistakenly assumed most of the code could just be copied, with the addition of some semicolons and braces. Oops.
What I had forgotten is how sloppy VB allows you to be. Data hiding? No, everything is pretty much open for other objects in the system to manipulate. If I don't want object b to be able to directly manipulate the controls or properties of object a, I have to take steps to prevent it. Casting of variables? VB seems to handle anything you throw at it. Rarely does it not get what you're trying to do, even if you don't.
So, why is this evil. Realistically for small individual apps like I'm dealing with, its fairly irrelevant. There will not be other coders working on this, and the complexity won't be such that I need be concerned with breaking something via direct manipulation. However, I really had to stop and think about what I was doing when dealing with C#. I had become so very sloppy in my programming habits, simply because VB lets you. I suspect VB was developed for rapid development of small programs by less than well trained programmers, something it is very good for. Unfortunately, if you want to become a well trained programmer, I think VB probably harms you more than it helps.
Posted: Friday - May 29, 2009 at 06:42 AM