For developers, the move from VB6 to VB.NET (or any .NET language) is much more of a mental one than anything else. The syntax of VB.NET is sufficiently familiar to avoid syntax overload. But the functional differences are significant enough to make one question how .NET could make anyone more productive. It has been a while since I made the move myself, but I’d like to share the stages that I, and I suspect most other converts, have passed through.
Unfortunately this was the first emotion I experience and the one that lingered the longest. When I made the move to .NET, I had been a VB/ASP developer for about 7 years. I could make VB/ASP sing and dance like a virtuoso. I didn’t need to think about the commands to type…my fingers knew what to do with no conscious bidding. I strongly believe that more current VB6 developers are living in this state of grace, which is the reason for the lack of acceptance that .NET could increase productivity.
The first two weeks of .NET were hellacious. I went from coding expert to coding simpleton. Things that were just ‘known’ took 45 minutes of Googling to find. Simple functions, like how to convert a string to a date; how to get the current time; how to identify the current working directory. I estimate that I 20% of what I knew was lost with the move to .NET. Anger doesn’t begin to describe the feelings of frustration I felt. Rage would be closer.
Anger gave way to depression as I gradually realized that .NET was the way of the future. The size of the base class library was (and still is) quite intimidating. How was I going to get my head around all of the various namespaces/classes/properties/methods? After the frustration of the previous two weeks, I sunk into a depression as I realized that I was much further away from becoming “.NET virtuoso” than I had hoped I would be. The days of boundless productivity were both far behind me and far into the future.
The turning point in this process came when I tried to do something in .NET was was challenging in VB6. For me, that was the creation of a Windows Service. In VB6, the ability to create an application that started automatically when the computer was started and responded appropriately to start/stop/pause/continue commands required some high-end programming or a third-party component. But for .NET, it is dirt simple. In VB.NET, you simply create a class that derives from the ServiceBase class. Create the OnStart method that is invoked when the process first starts and you’re done. Even adding the mechanism to support installing the Windows Service from a command line was easy.
I was stunned. I started to take a second look at some of the other functionality that were challenging in VB6/ASP, to see if the same improvements had been made. My first stop was creating a simple data-driven Windows form. While it wasn’t exactly what I was looking for (a problem that has since been corrected in VS 2005), it was certainly better than VB6. And in ASP.NET, DataGrids rocked as a way to display tables of information pulled from a database. Maybe there was something to this productivity increase after all.
And it didn’t stop there. Creating a text box that accepted only phone numbers and looked like a normal text box(really…anyone *like* the inflexibility of the MaskedEdit controls display?) was also a breeze. Derive a class from the TextBox class and implement the KeyPress and Text property overloads to ensure that the format is appropriate. All dirt simple.
Now my world was really in an uproar. Could it be that VB6 wasn’t the epitome of development tools…that combination of ease and power that makes it such a staple for business developers? Not possible. After all, look at the millions of lines of code and thousands of developers being successful with VB6. That’s the only measure of a development environment, isn’t it?
And yet, VB.NET ultimately wasn’t that different from what I was used to. Object-oriented concepts had been floating around since VB4.Controls have properties and methods. So could classes. The syntax, nor the idea, isn’t that new. It took a little while to get my head around the power of inheritance, but that doesn’t come up in business development as much as people might think. I was now at the end of the made the journey through the stages of .NET. Once you get over the hump, VB.NET is definitely more productive than VB6 for the average business developer. And keep in mind that I went through these stages in 2002. Assuming you’re moving to VS 2005, then you have even more areas where you have less work to do than you did in the past.
I do have a word of warning for VB6 developers. The Base Class Library (BCL) is incredibly daunting. While I would like to tell everyone not to be intimidated, it’s hard not to be. Enhancements, like the My namespace in VB.NET 2005 relieve some of the stress, but there is still a lot of surface area that the average developer needs to be aware of to maximize their effectiveness. When you first buckle down to learn .NET, make sure you focus on the namespaces and classes that make up the bulk of what you’ll be doing, whether it’s data access, ASP.NET or graphics. Knowledge and familiarity was ultimately the reason that I was able to move through these stages without any -side effects…that would be homicide or suicide.
Good luck with your own journey.