Friday, July 27, 2012

Visual Basic 6, Ruby and Getting Off My Lawn

Visual Basic 6, Ruby and Getting Off My Lawn:
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.


© 2012 Scott Hanselman. All rights reserved.

No comments:

Post a Comment