In Praise of VB As A RAD
Written by Ian Elliot   
Thursday, 26 May 2016
Article Index
In Praise of VB As A RAD
Is It Enough?

With the Visual Basic line now 25 years old and growing it seems time to consider what it is all about. Why bother with a language like VB when there are so many better alternatives? The answer is RAD and a more human approach to syntax. 

VB  – Real RAD?

I’ve long been an enthusiastic user of VB, even before it was a fully object-oriented language and then integrated into .NET.

 

vb6box

 

Indeed I have to admit that I was disappointed by the first version of VB .NET. So much so that I’ve more or less adopted C#, or even Managed C++, for most of my Windows work.

But I still occasionally miss VB 6, or classic VB, as it is often called for a number of reasons...

Notice that Microsoft dropped the .NET part of the VB names some time back but to make it clear which version of VB I'm talking about I will use it. 

Classic VB was a rough and ready language and certainly didn’t have much about it that could be admired for aesthetic considerations - not unless you looked real hard and were of a particular turn of mind. It was also limited in various ways that often resulted in having to employ deep and dirty tricks to get something done.

It was a good language for getting projects started but I have to admit that it was often a poor language for getting them finished!

These are the characteristics of a RAD (Rapid Application Development) language. RAD used to be a popular acronym, but now it and its approach to programming have more or less fallen out of fashion.

When .NET was introduced C# was the shiny new language that it was hoped would take over the world. VB .NET was sort of thrown into the mix to placate the angry VB 6 programmers and to try and convince them that VB .NET was the next version of the language they loved. 

It is interesting to ask the question:

"Is VB .NET a RAD language or a C# imitation?".

In other words, does VB .NET continue the RAD tradition of classic VB or is it just C# with some small syntax changes?

When the first version of .NET appeared on the scene VB .NET was clearly a capable language but it seemed to offer little advantage over C#.

The syntax might have seemed a little more familiar to a classic VB programmer but it didn’t really hide the fact that VB .NET was had moved away from RAD to become more structured and "mathematical" like C#. But over time  RAD-like features have made their way back into the language almost unnoticed.

Let me explain first why there is a very natural reaction against any language that is good at RAD. 

The trouble with RAD

The trouble with a RAD language like VB 6 is that it has to leave out advanced features simply because they might get in the way of the novice programmer or the programmer just trying to put something together quickly.

In particular you can’t enforce a pure object oriented approach to programming for example because this stops a casual approach to programming. The beginner has to be able to write something like:

Print "Hello World" 

and expect it to work without having to worry about objects. 

But RAD isn’t necessarily the same thing as being casual about creating code.

The first version of VB .NET did something that many VB 6 programmers had long hopped for.  It made VB a fully object-oriented language but you don’t always want what you wish for.

The conversion of VB 6 to VB .NET lost many of its RAD aspects simply because it had to be hard line object oriented.

This raises the question of whether or not a fully object oriented language with no real limits on what can be achieved could actually be easy to use and hence suitable for RAD style development. I think the answer is yes but you have to make objects and type optional to allow the beginner and the non-expert programmer to use it. 

It's the way that you say it

The first thing to say is that even though VB .NET went object-oriented it still retained the essential "Basic" syntax is an important consideration for a RAD language.

Basic has always phrased its constructions in the natural order of English. For example, consider the if statement. In C# and many other languages it is something like:

if(condition) {do something}

in VB it is

If condition Then do something

Notice that in the VB version there are no brackets, but more to the point it reads more easily.

You can actually say:

"If the condition then do something".

Now try reading the C# style of if statement and you find you either have to translate it to the English/VB form or you have to say:

"if condition curly bracket
          do something close curly bracket"

You might not think that saying an instruction is important but it's a step in how programmers understand code and having to actively translate to English makes it more difficult to think quickly. My guess is that mot programmers put the "then" in when they read a simple if. 

It is even more obvious with the for loop. In C# and similar languages something that looks like a mathematical construct:

for(int i=0;i<10;i++){do something}

but in VB it is again almost English:

For i As Integer = 0 To 9
 do something
Next i

The C# version is cryptic - if you don't already know what it means you have to make a wild guess. The VB version isn't exactly obvious if you are a non-programmer but it is more natural as a way of expressing a range and the end of the loop.

There is also the fact that the VB loop would most likely be expressed as 1 To 10 rather than 0 To 9. This raises another big divide - do you start counting from zero or from one.

It is usually said that mathematicians count from zero but the rest of us count from one. If this is true why do programmers need to count from zero?

What is almost certainly the important point however isn't so much English v Maths syntax but the order.

If programming instructions have an order that corresponds to the way that you think then its going to be better suited to RAD.

For example in C# you say:

int i=10;

in VB you say:

Dim I As Integer=10

Now I would claim that the VB way is more natural - even with the very unnatural Dim at the start. (The reason for the use of Dim is a historical accident - it is short for dimension which was needed when declaring an array which subsequently became the keyword for declaring any variable.)

The real point is that in English we say what something is after the something - as in

"I Programmer" not "Programmer I".

And when we move on to creating objects  - which is more to the point?

The C#:

MyObject X=new MyObject();

or the VB:

Dim X As new MyObject()

Again the VB is closer to the natural order of speech and it avoids the confusing repetition of MyObject once as a type and once as a function.

However, all of this is subjective and I have to agree if you want to hold that the C# way is natural there is no way of proving you wrong.

There is also the worry that if you try to mimic natural language too much in a programing language then the result is Cobol, which is generally agreed to be so wordy as to be unclear. 

When it comes to introducing natural language into programming it has to be just right.

VB .NET matures

There have been a number of important additions to the language since it was first introduced - most are concerned with adding advanced features that bring VB level with C#.

These new features may not add much to the RAD aspects of VB but it would be a poorer language without them and omitting them would mean that VB couldn't make full use of the Framework classes.

For example, take Generics. This allows you to write classes that work with any data type you care to specify. You can think of it as passing the class parameters that specify the types that the class will operate on. Generics allow other facilities to be made simpler within VB such as framework classes that manipulate almost any data type you care to think of and they certainly aren’t beginners or even advanced programmers are going to use directly in their everyday programming. Still their presence will be felt by all one way or another.

There are some technical features that have been added which do add to the RAD. 

For example, the Continue statement causes any loop to skip to the start of the next iteration. You can create customised events and specify exactly how event handlers are processed. There are some new data types – nullable types are really structures that have fields to accommodate out of range values i.e. nulls. There are also some additional simple types in the form of unsigned integers of various lengths. This all makes the language more flexible but it also makes it more difficult to use and less RAD. 

Some recent additions have added to the RAD nature.

For example, auto-implemented properties make object oriented programming faster. Collection initalizers allow you to set up collections in the style of an old fashioned Basic Data statement - perhaps this is stretching the analogy too far. Even the esoteric sounding multi-line lambda expressions and subroutines can be seen as a way of providing the ease of ad-hoc method and subroutine creation that was once the norm in non-object oriented basic. You can think of a lambda as a disembodied method not really belonging to any object if you want to.

 

<ASIN:0470532874>

<ASIN:0521721113>

<ASIN:0073517259>

<ASIN:0132152134>

<ASIN:0672331136>

<ASIN:0470502223>



Last Updated ( Thursday, 26 May 2016 )