You’ve read about this many times – hobbyists, beginners and accidental developers prefer Visual Basic over other languages. I don’t disagree in principle but would like to point out why.
Historically, VB was the only environment that offered easy GUI development. Beginners don’t like console applications, they want forms and buttons. Thus it’s not the language they are gravitating toward, it’s the IDE.
That said, beginners also don’t like strict rules. They don’t want to strictly type the variables nor to even declare them at all. VB allowed all that, but so did Python and Ruby. Yet they did not have a fancy IDE with drag-and-drop GUI creation.
Don’t forget the horde of hobbyists who used to program in BASIC (all capitals) in the old days of 8–bit and 16–bit computers; Visual Basic is a BASIC after all, isn’t it?
Visual Basic has been and still is quite a chatty language. For beginners this is great – you don’t need to overcome a steep learning curve as the code is immediately readable (code is read many times more than it is written). Since you’re not gonna write a ton of it you never get tired of long lines and lots of words. Compare this to the cryptic curly braces used in C++/Java/C#, semicolons everywhere etc.
This deliberate toning down of VB continues to this day. For those who wish to do “real” programming with VB.NET (the only supported descendant of the VB languages branch on Windows platform) this hand holding can become quite a nuisance. Recently I was trying to explain the fundamental advantages of the generics to my wife (she’s trying to get Microsoft certified and is using VB.NET). I made sure that the relaxed settings that allow you not to declare the variables were all turned off. But the following code snippet compiled without warnings (!):
Dim ls As New List(Of String)
Dim li As New List(Of Integer)
ls.Add(1) ' should not work
li.Add("2") ' should not work
How is this possible? This is a classic example of the kind of type safety that usage of generics offer. What does this code snippet produce? Let’s have a look at the real truth(TM) in the shape of IL decompiled source using the most excellent Reflector:
Dim ls As New List(Of String)
Dim li As New List(Of Integer)
ls.Add(Conversions.ToString(1))
li.Add(Conversions.ToInteger("2"))
The compiler worked really hard to help you ignore the types and convert the values as needed. By chance, this will not fail at runtime because "2" is convertible to Integer. I’m not sure if a developer should consider this helpful or not. After all, what is a hobbyist doing using generic collections?
Finally, why did this compile? Because the settings for “compiler relaxness” exist both globally (for all projects) and locally (for each project). Turned out the project was opened from Microsoft provided demo CD and the settings were relaxed on the project level.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5