Thursday, 6 October 2011

Visual Basic 6.ra

Flash back to five years ago. The Windows programming world was divided by many factions. You had the Visual C++ group, who believed in the purity of C/C++ to deliver solid stand-alone applications. You had the Visual Foxpro group, most of which grew up using dBase and Foxpro to develop database-centric applications. And among the many more groups, you had the Visual Basic, or VB, developers. The VB developers were about quick application prototyping, and even quicker program completion.
Now fast forward to the current day and age. Microsoft is heavily pushing its .NET platform at every turn, stating that it is the wave of the future. It consists of a common language runtime (the CLR), and every .NET compatible language that you compile creates code that runs against the CLR. The solid lines that used to exist between C++ and VB and J++ and countless others have now blurred, and it's kind of hard to determine where one stops and another begins.
But is it the Nirvana that Microsoft has promised?

Why did people hate Visual Basic?


Back in the heyday of Visual Studio 6, you either loved or hated Visual Basic. There was no in between. So strong was this rivalry between different development platforms that one might not consider the line between them as being drawn in the sand, but set in concrete.

The Visual C++ purists HATED the fact that VB only compiled down to bit-code and needed a runtime library to run. Admittedly, it was a small library, but it was still required nonetheless. (I'm not even going to go into the fact that .NET ALSO has a runtime library, for ALL of its languages).
The Java people hated the fact that it was a Windows-only development tool, and refused to touch it because it wouldn't work cross-platform.

But probably the biggest knock that Visual Basic got was that it was considered a “kiddie language.” Programmers, analysts, department managers, all stayed away from VB because it was “BASIC.” Hence, VB got a bad name and was even stereotyped by people who had never even bothered taking a look for themselves. You'd have better luck getting these people to build an application with Legos than with VB.

But while VB was snubbed by the majority, the many who actually tried it for themselves loved what they found.

Why VB is better than people think


Like I said, while VB had a bad name, it also managed to grow a pretty decent following. VB had many things the other languages simply didn't have.
For example, no other language allowed for quick application prototyping like VB did. A VB programmer could create a skeleton of an application in practically no time. Given some specifications, a VB coder could whip together a somewhat-working prototype in mere hours compared to the days it would take to accomplish the same task in other languages.
Sure, Visual C++ also had WYSIWYG design tools, but they weren't as integrated into the language as they were in VB. There was still a bit of work involved, just to make the screens functional. This wasn't so in VB. Draw the form, draw some controls on the form, and that was it. For a menu or one form to call another, you added one line of code to pop the form. But other than that, you could create the complete framework for an application while only writing a few handfuls of code.
To many, this kind of functionality is invaluable. Imagine getting to see what your application looks like before writing a piece of code. Being able to see the screens and how they're laid out often opens the mind to other thoughts, design wise, that may not be considered until the program is already complete otherwise. With quick prototyping, design changes are easy to implement at a moment's notice.
While many won't admit it, it became a common practice for many Visual C++ shops to prototype their applications using Visual Basic first. They would build the application framework and show it to management, or to the customers for feedback. Once they had gathered all feedback and gotten a sign-off on the application, they would then re-create it from scratch in Visual C++. Why did they do that? It could have been for many reasons. But the point I'm making is that VB was a solid tool, even for people who didn't like it.
But prototyping isn't the only thing VB does well. For starters, the VB controls you build your forms with are tightly coupled with the language. And taking a prototype to a finished product is a fairly simple proposition. The VB language is also very easy to use and learn, as compared to other languages. For example, which of the following do you think is easier to learn?

VB:
For myVar = 1 to 10  print "The value is " & myVarNext myVar
C:
for (c=0;c<10;c++) {  printf("The value is %dn", c+1);}
The BASIC language was created to be simple to use. Sure, it could still be a little cryptic, but nowhere as near as difficult to read as C, C++, Java, Pascal, or dozens of other languages.
I could go on and on about COM integration, reusable components, access to Windows printers and file systems. What you couldn't get at using the base code, you could easy access by a few calls to the Windows API; the SAME API used by Visual C++.
To sum things up, Visual Basic was a robust platform for developing applications.
But it wasn't perfect. I'd be a liar if I sat here and pretended that Visual Basic was the end-all solution for all programming projects. There are countless examples of when another language, be it Visual C++, Visual Foxpro, Java, or another development tool was a better fit for a certain purpose.
That being said, VB had its place in the grand scheme of things. And while it couldn't be everything to everyone, it was always a solid alternative for many projects.

Why VB6 is still alive today


So here we find ourselves, back in the present day. It is almost midyear in 2007 as I'm writing this, five years since .NET appeared on the scene and many programmers flocked into Microsoft's waiting arms to embrace the new technologies.
So would it surprise you to find out that I, among countless others, with tools such as .NET at our fingertips, STILL choose to create applications in Visual Basic 6?
Some of you at this point might be asking why. Why would you be creating stuff in VB6, when you can just use VB.NET instead? Why use a development platform that hasn't seen an update in five years?
There are many possible reasons for this. I'll actually explain my main reason right now. It's the .NET framework.
I do a bit of consulting, both for web work as well as desktop application development. I have a good number of clients who need custom applications built for them to achieve some business purpose. Some of these might be something as simple as generating project quotes for their customers, or as complex as some sort of database for storing inventory or even customer information. But one thing my customers all have in common is that they are small companies and most of the applications I write for them are fairly narrow in scope. Many of my customers are running many computers, with operating systems ranging from Windows 98 (yikes, I know) to Windows Vista. Many of them only have a dial-up connection to the Internet, as well. So, without any consideration as to which platform my customers are running on, I know that any application download or update (including the VB6 runtime libraries) never exceeds 2 MB of download. I have several utilities I give away for free, and the downloads are all quite quick.
But consider what would happen if I were using VB.NET for these applications. Then I would require that all of my customers install the version of the .NET framework I used on their machines before I could even begin to try running my software. This immediately cuts the Windows 98 users from my prospective user base. Windows Vista users would be lucky, since they should have the current framework already pre-installed. For now, that is, until the next update.
Is that the only reason? No. There are many reasons, but the above is one of my strongest. To many, though, VB 6 is considered to be the last true version of Visual Basic. With VB.NET, the language underwent a huge change, the largest change since the original inception of the original BASIC language. Many VB purists still stick to VB 6 for this reason alone. To be honest, I find that just a tad silly myself, but everyone has their own reasons.
Do I use VB 6 for every project? Nope. I have a wide variety of choices for my projects, and yes, I concede I even use VB.NET when it is appropriate. But VB 6.0 is definitely still in my toolbox. If I need to create an application that VB6 would handle eloquently, I definitely don't hesitate to open the IDE and start developing. There is a still a need for VB6, and probably will be for some time to come.

No comments:

Post a Comment