Visual Basic: Why?

Tags: development, technology

A Fascinating Intro

I was reading Scott Hanselman’s blog, in which he talked about implicit usings in C#. Riveting way to start a post, I know. But a little quip from him caught itself in my mind… and I haven’t been able to stop thinking about it for a little bit.

NOTE: Did you know that Visual Basic has had this very feature forever?

Uh, no Scott, I wouldn’t have expected anyone to know that!

Why was I so bemused by this?

At the heart of this question was a real bias I’ve had from the first time I encountered and heard of Visual Basic. I really don’t like Visual Basic, even more than I don’t like Java - and I really don’t like Java for personal reasons.

A Metaphor, Extended

Imagine if you really liked movies, and you were multilingual (and subtitles weren’t really a thing). Imagine if people made movies in Lojban. Lojban is not a good language for that kind of thing, though it is “logical,” and to me Lojban reminds me a lot of Visual Basic. Visual Basic feels like a language with a lot of features that sound good but really don’t give you what you need in a programming language. Visual Basic is technically a full-featured language, but not a lot of people use it, and the community around it doesn’t really want to grow the language in a way that promotes the language itself. At least that’s my perspective; I have yet to see a project I was really impressed or inspired by that was written in Visual Basic. Or Lojban for that matter.

That’s what it’s like for me with Visual Basic. I can read it, I can understand it, and sure it “makes sense”. The language itself isn’t missing any critical features but it has this reputation of just being bad. Maybe it’s because it was Microsoft’s pet language, or maybe it’s because its been grandfathered from other mostly unrelated projects.

Apparently, Visual Basic 6 was the last of its line, and VB.NET was totally different. And now VB.NET is on it’s way out. I spent about a week looking into this thing, and I think it’s time I stop looking at Visual Basic for as long as I can. Here’s what I found.

Features

From what I can find many proponents of VB are more interested in some of the interesting side effects of the features of the language and the IDE… uh I’m not sure I want to wade into any flame wars. In any case there are some weird things that were left out, and kept in.

No Block Comments

Block Comments. Just why? Maybe it’s to combat verbose code blocks. (maybe?)

Implicit Usings

But it does have that “implicit usings” feature. It seems like it’s a pretty good feature, but it’s not impressive enough to really sell the language in my opinion.

Case In-sensitivity

An included feature of VB is case insensitivity. Essentially, “someVar” and “somevar” are the same. This is a bad idea. This drives me nuts in Windows; if I make a mistake in when making a new directory what has to happen is I have to rename the darn directory to something different; I can’t just move the directory to a new path with the correct capitalization! The added benefit… is nebulous and the downside is frustrating. Plus, it really hurts interoperability and refactoring tools (something I know Visual Basic doesn’t really care about). This isn’t a deal-breaker but it is one of the language’s unique features.

Visual Stuff

The one thing that VB was pretty good for was generating visual programs (maybe that was why it was called ‘Visual’ Basic). Reading through some examples, it’s kinda verbose, but not too bad. The actual brains of the system looks like this:

'Ali Ahmad
'CP Period 3
'4/8/2019

Public Class Form1
    Dim strcost As String = ""
    Dim dblcost As Double
    Dim strnum As String = ""
    Dim dblnum As Double
    Dim total As Double
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        strcost = txtCost.Text
        strnum = txtNumber.Text
        If Double.TryParse(strcost, dblcost) Then
            'This checks if they put in a cost for the items
            If Double.TryParse(strnum, dblnum) Then
                total = dblcost * dblnum
                'this calculates the total
                lblInfo.Text = "The total cost of your item is " & total.ToString("c")
                'this puts the total in the label
            Else
                lblInfo.Text = "Enter correct numeric values"
                'if they ddin't put in a number to the number of items this appeasr
            End If
        End If
    End Sub
End Class

I grabbed this code from here. It does the Python thing where you don’t use line terminators (because exactly why do we need them) and uses the period as an element operator which is a thing that most languages after C do. I’m not a fan of the “End If” clauses that you need to signal that you’re done using a block - I’m not a fan of this in bash, nor in Lua. In my opinion (and it really is just that) a language should do the Python thing, where you really just use indentation (which is not a perfect solution), or just buckle down and use good ol' curly brackets.

This was almost all I could find (under the MIT license). Microsoft has a strict “Don’t copy anything we write,” policy, so I’m steering clear of that.

Popularity

One way to know how popular a coding language is to look for tools: if you have craftsmen and talented people working with / on this language, they’re going to get fed up when it doesn’t have the tools you need to build stuff.

VB.net formatters… there’s one for it: it’s the dotnet-format. Yeah it’s not insanely popular either, otherwise it’d be way easier to find some tooling for the thing. With JavaScript and even Java, there’s a selection of tools and projects for building tools (JavaScript especially, because that language has a lot of ways to mess things up).

I looked far and wide for some project that was popular. Something that people had built and wanted to share. I couldn’t find anything on GitHub, and this makes me think that Visual Basic being unpopular is… well popular. I’ve seen VB defenders on some forms, but I feel like they’re in the minority or they’re working jobs I’m lucky to have dodged. I grabbed the example above from a kind individual who actually wrote these things down. The repo is here. While writing up this article I even found another article dunking on VB: here, paragraph 3. Other than that, I was scraping the barrel.

What does the definitive source of programming language popularity say? StackOverflow. And you know what, It’s not the worst (most despised)!

It’s second worst

The End is Nigh

Visual Basic is dead. Microsoft stated last year that they aren’t updating the language any more. It’s not capable of evolving and it wont' be changing. Since Microsoft hasn’t open sourced it (yet?), and the VB community doesn’t seem inclined to work on the language itself (see my point on lack of tooling), it seems like it’s going to stay that way. The current ecosystem compiles to the same intermediate language as C#, which is getting features and updates from Microsoft. Boiling down the logic, if you allow such a thing, if you were going to write a script in VB, ideally you would simply write it in C# since it’s going to be the same and it’s actually being maintained.

The way I see it (and I don’t have a lot of experience so don’t take this too seriously), there’s no future for Visual Basic, and there really never was a future for the language outside of what it started as. Microsoft made a language that filled a niche. Today, that niche isn’t really filled by anything, but that’s because times and tech has changed. Microsoft might not see it that way as they seem to keep pushing new docs and updating the text for getting the thing started, and that costs money. I honestly don’t see the language existing outside the small community of Excel power users that won’t upgrade to JavaScript, whenever that is fully fleshed out. (Please let me know if it’s actually fully featured, I can’t find a lot of people talking about add-ons or custom functionality like we had with VB).

When Visual Basic was the new hotness it was filling a niche to add programming to a place where lots was needed but it wasn’t easy to get to: peoples machines running Excel. Today, most computing happens in the cloud, and cloud providers want you to run code in their gardens. SAAS and PAAS provider’s gardens require passwords and in-group knowledge. Now you need developers or you need to shell out to those who built the garden or those who have walked in the garden. Visual Basic has no place in that world.