Posts

News Flash: VB6 is deader than XP

After I loved on to .NET and C#, I was happy to leave the sinking ship that was VB6. As I learned C#, I became more and more aware of just how shoddy and poor that ship was. I had since put it behind me- Visual Basic 6 being long forgotten before I even came aboard.

It would seem however there are still those, in 2014, insisting that it is actually still used by the majority of programmers. I find this claim difficult to believe. Since the author has no ill-intentions, here is the link to that article.

Under normal circumstances this is the kind of ‘crazy-talk’ one is best to avoid. But I feel I am in a unique position. For many of the arguments presented if you had shown me them 6 years ago, I would have resoundingly agreed. I no longer do so and find my previous stance to be ignorant. With that in mind I’ve decided to write a blog post to fully explain why I switched to C# and why I do not regret it for a second. I may cover some of the deficiencies in VB6’s design role that I thought was par for the course for development environments until I switched.

The article in question starts with a rather brief history of Visual Basic 6. Not surprising. It references the prevalence of ADA and COBOL- which are both still used today- as evidence that “newer is not always better”. On the surface this seems like a reasonable argument. However, by following the link provided we see that the ADA Compiler had a release in 2012; and Cobol has “OpenCOBOL” (Now GNU Cobol) still actively maintained and available for download. This puts a bit of a problem in terms of the comparison, in my opinion; Visual Basic 6 has not seen a software update since 2003, with Service Pack 6. (which, reminds me I still need to install SP6). Thus the comparison is false; those other languages are older, however, they are also actively maintained.

It continues by making two claims. The first is that, with increasing processor speed, compiler designers have become increasingly careless and have overestimated hardware capabilities. The second isn’t really relevant and is a literary device theorizing that the above was taken from 3-D Game Makers.

This has some issues.

First, take BCSearch. This is a Program I wrote in VB6 and haven’t bothered to rewrite yet; this is because I Don’t really use it and because it works (for the most part). The project Group- which consists of BCFile (my IMO very nice Object-based File I/O library, with support for Alternate Data Streams, no less) BCSearch, and a few other programs, amounts to- totalling the .cls,.frm and .bas files, 3,703,486 bytes. BASeBlock consists of 3,640,350 Bytes of C# Code. Pretty comparable.

The Visual Basic 6 compilers takes 3 minutes to perform a full recompile of the entire project.

This would seem to demonstrably show (it is repeatable, both BCSearch and BASeBlocks are available on my github account) that the assertion that Compilers are effectively less efficient and slower to be false.

The next Paragraph has a header of “Why is VB6 still successful ?!”. This I think makes yet another false assertion; that being that VB6 is successful. This is perhaps difficult to properly define- since what exactly “success” means is difficult to come up with. After all, VB6 as it is cannot still be “successful” since it is no longer sold; so I would imagine this means that it is still used; which is what I base my objection on. It is hardly common to find a VB6 developer, and even harder to find programs written in VB6.

It’s next statement is that “VB6 get’s along well with embedded machine code and [Embedded] Assembly Language” This is actually not entirely accurate. The method used to run arbitrary Machine code is hardly “friendly”; the process involves creating a String that contains the binary machine code that you want to execute. In order to execute that code, you use the CallWindowProc() API function, but instead of passing a window procedure, you pass in a pointer to that string. Control will pass to the string and it will execute as machine code. The statement that this “get’s along” with VB6 is not the case; as this is rife with problems that can cause the IDE to crash or simply close itself. Mistakes within that compiled assembly cannot be debugged in place by any means, mistakes and bugs will take your entire application down with them. The article then discusses “advanced VB6 programmers”; what it fails to mention is that all of the advanced programmers that provided the wealth of capability to Visual Basic 6 (vbAccelerator, Edanmo, etc) have all moved on to C# and/or VB.NET. It would seem then that logically if those ‘advanced VB6 programmers’ moved on, moving on was in fact the wiser choice? They have left behind a lot of very useful VB6 oriented articles, type libraries, and controls, which we can still leverage, but it seems a curious omission to not mention how they are no longer active with VB6. It then says “Nowadays, through a simple copy and paste of the myriad of functions created by advanced programmers for VB6, an intermediate level programmer can create VB6 applications that run faster than those designed in C++ (no joke there).” They provide no examples or testable, repeatable observations; therefore this is yet another assertion. That isn’t to say that VB6 code cannot be faster than C++ code, but it has the flaw that it promotes cowboy coding (Just copy and paste this code of which you know very little about into your project) as well as working with a premise that a faster piece of software is always superior to a slower one, which is false.

It continues, and suggests that Microsoft should “perhaps listen to the hundreds of thousands of programmers who demand the introduction of VB6 to the market”; I assume, this means, the re introduction to the market, nearly a decade after it had been shelved. It cites the VB6 petition. This is present [url=http://classicvb.org/petition/]here[/url]. It’s notable, that this petition has been online for nearly a decade; to assert that all of the signatories still agree with the premise of the petition is false- I base this on a simple fact that I am a signatory! That is, my name is on the petition. I signed that petition 12 years ago; as did a large number of the other people listed. I obviously can only speak for myself, but if I was able to do so I would remove my name from the Petition, since I no longer feel the same way. It’s possibly many of the others on the petition also have completely forgotten about the petition and simply moved on. Thus the assertion that all the signatories still desire the petitioned results is disingenuous.

It then cites a few available VB6 projects; the display of these projects is something I find curious; the work and effort and the end result of these projects does not mean VB6 is viable, it simply means the developers are capable. After all, if an artist makes an extraordinary work of art out of a dog turd, people praise the artist, not the turd.

Let’s take a look at some of the examples.

Visia Compiler 4.8.7.1

This project appears interesting, However it sadly also steals most of it’s code. Some with attribution, some without. All taken from “Planet-sourcecode”. It was submitted recently, but the project file dates are last edited in 2006; that makes me suspicious that the person submitting it is the real author.

It features many issues that stem from it being in VB6. I was able to crash it by simply shrinking the form (division by zero). The Menu is emulated with PictureBox’s and not responding to any accelerator keys properly being one. These issues are not present in… say… Linqpad, which is written in .NET and runs .NET language code. To me this certainly feels like a project originally created by a high-schooler- the reason I think this is because I used to be one and I know I used to think those sorts of things were actually viable when they weren’t.

PhotoDemon

The article claims this is “as powerful as Photoshop is”. This is simply not true; and the author of the program makes no such claim. It is only getting layer support now, in the development builds. It’s definitely a very interesting project, but the claims made in the article are simply false, and do it a disservice.

Advanced mathematical functions (made in VB6)

Back in the day, I had a VB Module called “GRAPHICS.BAS”. This was a module I created with one of my early applications for drawing a Gradient. I don’t remember what the gradient was for- I suspect it was a stupid feature that just drew a background for no good reason. the function was called Paintfrm and I put a lot of work into it. It had loads of functions and I had much the same perspective expressed here. At any rate- all of the functions described do in fact have implementations in any number of other languages, and stating otherwise is rather foolish.

Libry Compiler 4.1

This is pretty much the same program as described earlier, but in a earlier variant. It’s posted by the same person on Planet Source Code.

OpenStreetMap

Without a link I cannot really verify this. I guess it’s a program to open a certain file type.

It goes on to cite statistics about Visual Basic usage. the statistics are based on Search engine search results of certain queries. That is not a way to determine the popularity, capability, or even permeance of a Programming Language. remember that those search results will include websites that were indexed years ago; those webmasters could have moved on already. And certainly the argument that there is more code for a given language does not show that the language is better anyway.

VB programmers do not particularly like VB. NET and don’t like any other versions of VB after VB6. Why? VB6 is dependent on a single file, namely: msvbvm60.dll. On the other hand, VB .NET is dependent on the .NET Framework environment, which inhibits the individualism of the programmer and this is not consistent with the human nature.

This is my favourite portion of the article. I used to be a VB6 programmer, and I would have said the same thing. I would have been wrong; Visual Basic 6 applications typically have far more dependencies, including various Common Controls and libraries, depending on the Application. I was a big fan of vbAccelerator components, for example; when using COM components they need to be registered on the machine or else your application fails without a specific error (ActiveX Component cannot create object) and you have to find out what component was not registered. Quite painful. Most systems will have the .NET framework installed; arguing that you need it installed to run an application is pretty dumb, particularly since it doesn’t “inhibit the individualism of the programmer”, which is a extraordinarily silly claim.

Now, with that out of the way, let me be blunt about this.

C# and VB.NET are better languages than Visual Basic 6 in absolutely every single possible way. There is not a single thing that, while working in C#, I think “golly, I wish I could still do that” about VB6 features. Not a single one. I do not miss ANYTHING about that terrible, underachieving IDE and it’s accompanying language. And when I was using it, the only thing driving my dislike of .NET was misunderstanding and a fear of that which I didn’t understand. I slagged .NET and C# in order to bolster myself- I didn’t know C#… “but bah that didn’t matter right because C# is .NET and .NET sucks.” And I continued blithely along in my ignorance, working in VB6.

I can think of many specific situations where VB6’s language falls short. It does not allow for Enumerator Methods, you cannot use threads, and it’s standard library (VBRUN) is dismal. C# and VB.NET with the .NET framework provide a veritable wealth of classes that you can use for any number of purposes; to get many of those same capabilities with VB6 you have to fight against the IDE, the language, or the compiler. It’s simply not economical.