Scott Hanselman

Visual Basic 6, Ruby and Getting Off My Lawn

June 10, 2012 Comment on this post [45] Posted in Musings
Sponsored By

Why hate on Visual Basic? Because it's successful.David Platt has a great article called The Silent Majority: Why Visual Basic 6 Still Thrives. Even though I studied C++ in school, my first corporate job was in Visual Basic 2, then quickly VB3. By the time VB6 came out it's fair to say I could make that thing sing. It's funny how the older and more successful a language is, the more likely the language literati are to bash it. Bigger targets are, well, bigger.

Visual Basic 6 first shipped in 1998, so its apps will have at least 24 years of supported lifetime. Contrast that with the Microsoft .NET Framework 1.0 (2002), which is incompatible with Windows 7 (2009). - David Platt

You could get SO much work done SO quickly in Visual Basic 6 and that itself made the experience of coding in it fun. Once you added in some of the advanced techniques with tools like Dan Appleman's SpyWorks and other comparatively low-level API tools, it was arguably near as powerful and productive as its more advanced brother, MFC and C++.

Another key to the success of Visual Basic 6 was the much shorter learning curve demanded by its limited feature set. Learning to drive a bus takes much less time than learning to fly a fighter jet. Becoming a good Visual Basic 6 programmer took much less time than becoming a good C++ programmer, the primary alternative at the time. - David Platt

A Hacker News discussion started up around this article and one HN'er said what I've been saying for years (emphasis mine):

For those who have never used it, VB6 syntax is actually very similar to Ruby. It uses English language words instead of braces, does not require parentheses, and uses dynamic typing.

VB6 is also quite fast, all things considered, and runs on lots of fairly old hardware.

Don't get me wrong, I'd never choose to use it, but for those who use it day to day it offers overall simplicity and flexibility that few mainstream languages can match. - grandalf

and the obvious followup...

The irony is, [today's] Ruby "rockstar ninjas" are doing exactly the same work that used to be done with VB and Access. - gaius

This is true...20 years later and it's all still text boxes over data. Even the most advanced client side JavaScript single page apps are often shadows of their terminal and text mode grandparents.

Ruby does feel in some ways like the VB of two decades ago. Quick, is this Ruby or VB6?

class MyClass  
def describe
print self.class
end
end

What about Fibonacci?

Public Function Fib(ByVal n As Integer) As Integer
If (n < 2) Then
Fib = n
Else
Fib = Fib(n - 1) + Fib(n - 2)
End If
End Function

Of course, Ruby can do it with a ternary operator.

def fib(n)
n < 2 ? n : fib(n-1) + fib(n-2)
end

And VB6 has only IIF() for that so we get this

Public Function Fib(ByVal n As Integer) As Integer
Fib = IIf (n < 2, n, Fib(n-1) + Fib(n-2))
End Function

Sure VB6 had/has its problems, but this was a great environment a LONG time ago and even though a lot of unskilled people created a lot of crap, a lot of skilled people created a lot of useful apps that are still running today. And I understand why.

The things that Visual Basic 6 did still need doing. - David Platt

Disclaimer - I currently work for Microsoft on the Web Team but this post has nothing to do with that. I have worked here about 5 years but I worked elsewhere for much, much longer. I dabble in Ruby and other languages on the side so don't get my grudging respect for Visual Basic 6's special brand of cheesy pragmatism twisted.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
June 10, 2012 3:17
I'm interested in seeing if LightSwitch fulfills the promise of being able to fulfill some of the old Access/VB niche.
June 10, 2012 3:22
This time, I think this a big stretch here.
VB is very verbose - I don't really see the same correlation you do.

You really think this:
def fib(n)

Is similar to this:
Public Function Fib(ByVal n As Integer) As Integer

?
June 10, 2012 3:59
If I'm not mistaken, the VB6 Fibonacci implementation with IIF won't work; IIF is not equivalent to the conditional operator: it's a function, not an operator, so both arguments are evaluated. So it will cause infinite recursion, and eventually a stack overflow (at least that's what happens in VB.NET; I assume IIF is also a function in VB6)
June 10, 2012 4:11
The superficial syntactic similarities (alliteration!) are a bit of a red herring I think.

The key thing about VB6 was that its IDE was pioneering, outshining anything around at the time, as far as I know. The language itself, however, was a hack (with good (OLE)COM support nonetheless) and I was so glad to ditch it and move to C# when the opportunity arose.
June 10, 2012 4:11
VB6 was my first experience with programming way back in high school. I remember being so surprised at how easy it was to set up a form and write some code to make things happen. I experimented with Java and JavaScript afterwards, but just couldn't bridge the gap between languages until college some years later. I later moved to VB.NET, then to C#, and dabbled with several other languages since. But it was VB6 that got me started.

I have fond memories of VB6.
June 10, 2012 4:16
To be clear, I am not trying to draw anything other than the most TRIVIAL of parallels here. VB was a great little dynamic language back in the day and it works fine on Windows 8 today. Folks got a lot done with it and I see tiny shadows if Ruby sometimes. That's all. Nothing to see here! ;)
June 10, 2012 4:33
I cut my teeth on VB6 20 years ago, and shocked the cobol world I was working in, with how quickly I could produce a usable client solution with fancy UI elements like combo boxes and radio buttons.

I working on reporting for manufacturing solutions coded in .Net, however VB6 is still the best way (quick/nasty) to interface with some very primitative COM based dll's for some of the hardware.
June 10, 2012 5:00
I still think there is an opportunity for some one to build a VB6 runtime on top of the CLR. Not a code conversion tool per se, that's already (or it was) built into Visual Studio and never worked that well. I want to be able to run a VB6 dll directly; BUT also have the ability to swap out certain functions/classes with .Net code. I think this would be a great way to move forward some of the VB legacy.
June 10, 2012 5:25
Sometimes I just would like to fire the new IDE in Visual Studio 2012 and open the old VB6 projects. VB6 is still the quick dirty way of have the work done.
June 10, 2012 5:58
Remain calm folks. Scott is not saying VB6 = Ruby. Far from it. Scott is simply remarking on the Deja Vu that seeing VB6 code gives you once you've been working in Ruby for some time. It's really not a stretch.

Superficial or not, the fact is VB6 doesn't have brackets or semi-colons or return statements. In fact, after a drink or two, it even starts to look-and-feel like duck typing. It even has support for object oriented programming.

Seriously...Nothing to see here!

TVD
June 10, 2012 6:43
Pardon my noticing, but VB6 came out in 1998. 2012-1998 is 14 years, so saying you started programming 20 years ago or that VB6 has been supported for 24 years is rather a large stretch in computer years.
June 10, 2012 6:59
VB2 came out in 1992 when I started with it. That's 20 years.
June 10, 2012 7:01
VB6 was great for getting things done quickly - sometimes too great. One of my managers knocked up the UI for upcoming project and said "Look what I've done in 30 minutes without any experience, now please fill in the backend for me".

But programming in it, especially if you had any C++ and OO knowledge felt somehow dirty; there was no inheritance for example. The thing which turned me off forever was when I ran up against the VB6 control limit - the number of unique controls that could appear in a window; it was something like 200, but there was a workaround to add them to an 'array of controls' or something. The whole language felt like a gigantic kludge.
June 10, 2012 7:04
I'd have to agree with Innes. It was more about the IDE than anything else and Microsoft is still eating everyone else's lunch with Visual Studio, IMO.
June 10, 2012 9:46
The orginal 1989 code name for what later become VB was "Ruby".

http://www.cooper.com/alan/father_of_vb.html

June 10, 2012 9:50
From my perspective, if a developer can show me application(s) built with VB6, mad respect. If that's ALL you can show me? You're not a developer - you're a dinosaur. I learned to code with VB4-5. I wax nostalgic on things VB from time to time. Still, software is built on progress and innovation much more than any one language, no matter how popular.
June 10, 2012 11:24
Very verbose syntax though...

By the way, classic ASP with VBScript should still work on Windows Server 2012 or even Windows Azure right?
June 10, 2012 11:25
the only good reason for using vb6, back in the old days of VB6 is having never tried Delphi.
June 10, 2012 12:54
Just remember that all of us reading Hanselmans blog are more of 'fighter pilots' and less 'bus drivers'. The bulk of the people still using VB6 every day probably don't even know who Scott is. They just use it.
June 10, 2012 13:57
To John: vb6 just got full support for win8, meaning it will have at least a lifetime of 24 years.
June 10, 2012 15:31
My main problem maintaining old stuff with VB6 is the IDE.
VB6 in Visual studio would be very good.
You can already code PHP and Ruby in VS, so...
June 10, 2012 18:43
I remember working on an internal system that started as a Access VBA prototype and then was continually developed over the course of 6 more years. The whole system was a developer's nightmare.

I will never be able to forgive VB for spawning VBA. VB wasn't a true object orientated programming language and it's ugly step sister VBA wasn't even supported by a proper development environment.

How many simple VB/VBA systems turned nasty once they started to grow?
June 10, 2012 19:03
That problem is most acute regarding Office, where the users and environment are most likely to be of the kind described by David Platt; and where not even an imperfect substitute exists. You can do desktop VB6 with other tools. You can't do VBA with other tools (VSTO dosn't enable the same use cases). Microsoft ships Office's 2010 version with a 1998 development IDE.
June 10, 2012 21:59
Comparing VB6 with Ruby is like comparing a trabant (http://ro.wikipedia.org/wiki/Trabant) with the latest the Tesla sedan. They are both cars ...
June 11, 2012 0:51
@James If you really want to use some .NET-ish goodness from VB, there is always VBCorLib...
June 11, 2012 0:57
I regards to your comment that
even though a lot of unskilled people created a lot of crap
let's us not forget Sturgeon's Law

90% of science fiction is crap because 90% of everything is crap
June 11, 2012 6:28
Visual Basic Has been the vehicle to many of my house payments over the years ... many thanks to Microsoft and the VB team :)
June 11, 2012 12:36
While C# and Ruby occupy most of my coding time these days, I still program in VB6. Well, Excel/VBA really, but the runtime's the same. It's seemed to me for a long time now that @James' notion of the VB6/CLR (or more likely DLR) combination is the key to moving user-written Office automation into the 21st Century (moving a VBA-savvy user up to VS and - ugh - VSTO or similar) is several steps too far.

June 11, 2012 19:56
Hi,
I was just thinking about doing a simple Metro app and really missing the simplicity of VB and windows forms. Where is the tool that hides all the XAML stuff. I don't want to have to jump into writing XAML or use Blend in order to get simple things done.

I do wonder if we are going backwards.

Martin
June 11, 2012 22:20
Like any language, I have seem some ugly VB6 code, and some beautiful VB6 code. VB6 could do pretty much anything. I still have some websites that run off of VB6. I don't mean Web Documents or whatever they gave to do that stuff, or even the IIS DLLs things you could do, I mean, a full on EXE written in VB6 that serves HTML back. And it's fast.

In another project, using Subclassing, I wrote an app that allowed our estimators to load up an image (pdf, tif, bitmap, jpg, pretty much anything) of the building we were bidding on building. It had real-time viewport functionality, allowed you to draw transparent lines over the top of the drawing in all sorts of patterns and colors, measured those lines, scaled it up to real world lengths and allowed our estimators to quickly bid multi-million dollar jobs.

And it was fast. I mean, it beat the pants off of anything you could buy on the market for under $1000 a copy. I was able to drop down into Device Contexts, create brushes, etc, all without the help of DirectX or GDI+ or anything. Merely using BitBlt and the Win32 OS level GDI functions and objects.

Don't let anyone tell you that you couldn't do something in VB6 (and 5, really). I mean from the End User's perspective. If a program does task X, then it's a success.

The IDE was incredible. You could pause code execution, write code, and continue on right there. No mocked up Edit and Continue, no annoying message boxes about how you can't edit running code, etc.

I love .Net. The IDE is even better than VB6 in almost every way. The language features and extensions are fantastic.

But programming in C# over VB6 does not make you a more competent programmer.
June 12, 2012 0:08
Wait, what's the "Getting off my lawn" part in the title?
June 12, 2012 0:20
The biggest problems I had with VB6 were
1) Editor inheritance - No real way to do inheritance other than copy-pasting method implementations or making private instances of the base class in the derived class and calling methods against that.

2)Strings and Variants - Man, if you really needed to do heavy duty string parsing, VB6 was not your man. You had to dive into the undocumented things like StrPtr and VarPtr and use the Win32 API.
June 12, 2012 0:39
Brad - "Get off my lawn" is what old people say to young people. Google it. ;)
June 12, 2012 3:42
Sadly, Microsoft have never matched VB6 with regards to ease of use and rapid development. They are trying to recapture the RAD space with LightSwitch, but I haven't really been impressed with what I've seen - it's slow, it's clunky, and I can't just drag and drop my controls where I want them.

June 12, 2012 4:49
And jsut how long did it take for your final FIb function in VB to return a value ?

http://msmvps.com/blogs/bill/archive/2012/06/12/why-a-little-bit-of-vb-is-a-bad-abd-thing.aspx
June 12, 2012 5:53
Perhaps the ship has sailed, but I would love to see a "VB Lite" or "VB RAD" for .NET that basically emulated the old VB6 interface, except it's in XAML and compiles to .NET IL. Something like that could still be a winner for internal LOB applications.
June 13, 2012 0:03
Great - so VB6 gets to live on, while .NET 4.5 dies a horrible death. Way to go, Microsoft.
June 15, 2012 10:58
Urgh, this brings back so many memories, think I just threw up in my mouth
June 22, 2012 0:51
Scott, When you compare the simplicity of VB6 to the tangled mess of html, javascript, and whatever flavour of .NET you use, which all have to weaved and mashed together into some sort of pulp that resembles a functioning application, then you see that VB (even without inheritance and (real) pointers and all the things it missed) is like an elegant yacht alongside a sunday afternoon raft race effort.
Noone can deny the power of web applications, and SOA, and all these things of course, but the way we develop them today is still hideous.

We're still waiting for "real" edit and continue after what eleven years of .NET..... ;)

Some days I miss Mort....

http://vb.mvps.org/vfred/Trust.asp
July 17, 2012 23:09
I wrote many application in VB6 of which still run today. One I wrote while I was in school learning C then about 7 years ago I re-wrote it in VB6. That VB6 application has been running in our enterprise on our servers everyday with only 1 break in 7+ years. About 3 months ago it failed to the point that we had to pull out the source code to look it. We had found 1 bug in 7 years that if you deleted a specific folder the application would break.

I wrote many other applications in VB6 that generated so much profit for our company in hours saved. I still dabble with the VBA IDE in Word and Excel just for the time savings it has over .NET.
August 17, 2012 18:20
Scott, I've got a VB6 app that I recently ported to Ruby on Rails and I have to say the parallels are striking to me between Ruby and VB6. I do really appreciate some of syntax flexibility offered by Ruby. Thanks for drawing the line between these two technologies.
August 28, 2012 3:22
I just went to a Windows 8 Developer Camp. In the intro talk the speaker asked for a show of hands.

Who's been programming Windows 8? --- some hands.
Who's been programming in .net? - - - lots of hands.
Who's still programming in VB6? - - - My hand was the only one left in the air. :-\

(and they all moved away from me.....)

:-)
February 14, 2013 3:26
Going to the VT terminal article, I recently created an ASP.NET 4 web app that mimics the basics of the then current AS400 "green screen" app in most every way; and even improved on a few things! It truly is about design.

As far as VB6 goes, at my current place of employment, I am supporting several VB6 apps that have been around since VB6 was first released. Do I like it? No, but I don't hate it, per se. Are we having trouble supporting them? Oh, yes, that's why we are rewriting them in WPF and .NET 4.5. We are finding it more difficult find VB6 developers...
April 03, 2013 17:02
I am one of those old guys that has said "get off my lawn" before. Professionally, I have programmed in over 30 languages, including 80888 assembler and was on a team that wrote a proprietary compiler back in the 90's. To me, VB was an incredible leap forward at the time. That is what makes it memorable. Of course a fool, even with a good tool, is still a fool. Anyone can write crap or gold in any language. VB made it easier to write crap. It also made it easier to write good code as well. Microsoft continues to improve their language products and right now, my environment of choice is VS2012, C#, .NET 4.5. At the time, VB was awesome and was a great chapter in the saga of programming languages. I wouldn't write anything new in it these days but for its time, I thought it was fantastic.
June 21, 2013 13:38
"Microsoft ships Office's 2010 version with a 1998 development IDE." That's wrong. Office 2010 = vba7.

On the other hand, while Ruby has several advantages, when dealing with databases I will always prefer Access VBA. It is just simpler, self contained... and faster if you compare it with Ruby's ActiveRecord.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.