In Praise of VB
Written by Mike James   
Wednesday, 09 June 2010
Article Index
In Praise of VB
VB enhancements
Objects - the key to RAD

With Visual Basic .NET now reaching maturity, or should that be old age, in the form of VB 2010 it's a good time to consider its unique RAD appeal.

VB  – Real RAD?

I’ve long been an enthusiastic user of VB, even before it was a fully object-oriented language integrated into .NET. 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 work.

But I still occasionally miss VB 6 for a number of reasons...

It was a rough and ready language and certainly didn’t have much about it that could be admired for aesthetic considerations. 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 - and its is interesting to ask the question

"is VB 2010 a RAD language or a C# imitation?".

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 familiar 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 and versions 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 an object oriented approach to programming for example because this stops a casual approach to programming.

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 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.

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 is it

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.

It is even more obvious with the for loop. In C# and similar languages it's 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.

<ASIN:0672331004>

<ASIN:013212856X>

<ASIN:047050224X>

<ASIN:0136113400>

<ASIN:1430272406>

<ASIN:0735626693>



Last Updated ( Wednesday, 09 June 2010 )
 
 

   
RSS feed of all content
I Programmer - full contents
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.