#52WeeksOfCode Week 18 – VB.NET

Week: 18

 

Language: VB.NET

 

IDE(s): MS Visual Basic Express

 

Background:

VB, of course, stands for Visual BASIC and I think it’s worthwhile to review the history of the language and it’s influence in not just the genesis of the commercial software industry but it’s role in the genesis of Microsoft.

First of all, let me give a shout-out to Steven Levy’s wonderful book, Hackers: Heroes of the Computer Revolution. If you want a good, behind-the-scenes look at how the personal computer industry was born and the kinds of people involved in the midwifery, this is the book you want. (I’ll be posting a separate review of it at a later time.) BASIC has several mentions in this book and not always in connection with Bill Gates (but Gates is a key figure in this story).

From the chapter “SpaceWar”, an account of the growing code democratization movement that began at MIT in the 1950’s:

 

“The planners were also extremely concerned about getting the power of computers into the hands of more researchers, scientists, statisticians, and students. Some planners worked on making computers easier to use; John Kemeny of Dartmouth showed how this could be done by writing an easier-to-use computer language called BASIC. Programs written in BASIC ran much slower than assembly language and took up more memory space, but did not require the almost monastic commitment that machine language demanded.”

 

Excerpt From: Steven Levy. “Hackers.” iBooks. https://itun.es/us/Em_Px.l

 

BASIC was at the front of the war against the “mainframe priesthood”, the gatekeepers to the mysterious, room-filling machines that were our only access to computing. It was designed to use English-like commands. For example:

 

10 PRINT "Hello, World!"
140 END

 

I took a programming course in 1977 and saw this first-hand. I wrote out my program by hand, typed it into a keypunch machine, took the punched cards to the computer room and handed them to the operator. If I was lucky (i.e. my code worked the first time), several hours later I would come back to pick up a short print-out showing the output of my program. I was unlucky, then I got a much bigger stack of print-out paper which showed me in excruciating detail how badly my program sucked. Much of the paper consisted of a dump of what was in the computer’s memory when my program failed, along with what instructions were running at the time. I then had to grovel through the output, figure out what I had done wrong, fix it and go through the whole process again.

I had heard about these things called personal computers, like the Commodore PET and the Tandy TRS-80 but these seemed expensive and complicated and weren’t really on my radar.

In 1980, Commodore came out with a computer called the VIC-20. It was simple to set up and, more importantly really cheap, so I got one.

Of course, you didn’t get much for the price. It came with 5 kilobytes of RAM (which shrunk to 3.5 kilobytes once you turned it on), had no external storage (but you could buy an external drive that used cassette tapes). It had a cable that you could use to plug it into a television and the display was 22 characters wide and 23 lines tall. It originally sold for $299 but the price eventually dropped to $100.

But that wasn’t what made it magic for me. I remember unpacking the box, scrambling to get the cables connected just so I could turn it on and see this:

VIC-20_Boot_Screen

It wasn’t as powerful as the mainframe I used in school but it was MINE.

The VIC-20 booted directly into a BASIC interpreter and you interacted with it using BASIC commands. CBM stood for Commodore Business Machines and they used a dialect of BASIC called Commodore BASIC. But they didn’t develop their own version, they bought it from someone else. Someone whose entire business model initially consisted of providing BASIC interpreters for different computers.

It’s hard to imagine that before Bill Gates came along, the idea of selling computer software was unthinkable. Not in a bad way, but in that it just didn’t make any sense. After all, the computer business model was: you buy (or lease) the computer and the company gave you software for free (because the computer wouldn’t run without it). They even gave you the tools to build your own software because this added value to their hardware and encouraged more people to use it. So programmers got into the habit of not only getting their software for free but also giving away the software they wrote.

So when Bill Gates and Paul Allen wrote a BASIC interpreter for a new computer called the MITS Altair, someone snagged a copy of the paper tape containing Altair BASIC and ran off a bunch of copies, then handed them out to their friends, asking them to each make two copies and hand copies to their friends.

Of course, when Gates and Allen found out about it, this resulted the infamous Open Letter to Hobbyists. It’s hard to understate the huge rift this incident created in the nascent personal computer industry. (Seriously, read Hackers. It’s great.)

Microsoft, of course, went on to dominate the commercial software world far beyond their initial humble beginnings, but BASIC came along with them. It was even included in early versions of DOS and Windows. It kept evolving adding features and functionality that let it be deeply embedded into the Microsoft software ecosystem. It became tremendously popular in business software because it was an easy way to hook into your software (assuming you ran MS Office, MS Exchange, MS SQL Server, etc.) and let you quickly put together a GUI front-end for your server systems.

To give you a sense of how much the language has changed, here is the standard Hello World program written in VB.NET:

 

Module Module1

    Sub Main()
        Console.WriteLine("Hello, world!")
    End Sub

End Module

 

Frankly, this looks a lot more like Java:

 

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello, World");
    }

}

 

Can we still call VB a dialect of BASIC? More importantly, with the introduction of cleaner, more modern languages like Ruby, is there still any need for VB, with or without .NET?

I’m going to get some crap for this, but I have to say, “No”. Unless you have an all-Microsoft shop with a substantial investment in legacy Visual BASIC code, there is little reason to use VB.NET.

That being said, let’s fire up Visual BASIC Express and see how it runs.

 

Discussion:

The first thing that shows up:

VB2010_RegWindow

Just to be clear, if you want to use someone’s product then you implicitly agree to whatever conditions they require before you can start using it. However, crap like this is why I actively seek alternatives to Microsoft software. Other commercial software developers make you jump through hoops, but nobody does it with such bloody-minded verve like Microsoft. Fortunately I have a Windows Live account for just such a contingency.

After completing a survey and politely declining membership on several email lists, I finally get a registration key, enter the key, click on Register Now and:

MSWarning

Yes, Microsoft, I’m aware that you have me by the short and curlies. Don’t rub it in.

Once past all that, I was presented with the usual friendly interface. I give Microsoft a lot of crap, but it’s clear that they work very hard making the front-ends to even quite complex software pretty friendly. I selected New Project… and opened the default application template and got this:

WindowsTemplateWarn

Now I appreciate secure computing as much as the next man, but this file was installed on my computer by Microsoft. By. Microsoft. Okay, that’s all I wanted to say about that.

I located a very sketchy tutorial on Udemy, a popular online course site. After a bit of fussing with variable names, I got a simple Windows Forms application:

If you’re familiar with Windows Forms, it doesn’t take too much extra work to get up to speed on VB.NET. The IDE looks and works the same as it does in Visual C# Express, with drag and drop of form elements and easily edited property lists.

I still stand by my opinion that Visual BASIC is essentially a dead-end platform. I thank Gates and Allen for their hard work in bringing programming to a greater audience and doing their part to free us from the grip of the mainframe priesthood.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s