I’ve been a Visual Basic programmer since ‘98 - actually earning money programming in VB6 that is. I dabbled a bit with similar concept previously although they were called Access Basic or later Visual Basic for Applications. Then one day Microsoft decided to join the object oriented crowd. They claimed that VB6 was an object oriented language or at least could be used at such but few ever figured out how. Along came the .Net Framework and C#. Woohoo!
I managed to get involved in a few C# projects at work - the learning by doing kind. And when things started getting interesting I got to create applications for PocketPCs using .Net Compact Framework. You were hampered by the fact that several neat features in the full framework didn’t make it to the compact version but there where workarounds that still made it enjoyable albeit frustrating at times. My last C# project actually landed me in the fullframework version 2.0 with some new recruits who actually knew what they were doing. Oh joy, now I managed to learn how it really should be done or at least learn some alternative ways to solve problems using the tools at hand. I evolved from using a hammer and a nail since that was all I knew to using the whole toolbox. Did you know that a screwdriver was more than just a drink?
Which brings me back to the title and the reason for my rant. I’m currently in new project at a goverment agency. The first time outside the office for an extended period which is great. And this agency’s IT-policy is that all projects shall be developed in Visual Basic. I’m back to square one, sort of. We get to use .Net Framework 2.0 and Visual Studio 2005 which is a great tool to work with compared to previous versions. And Microsoft has forced Visual Basic into the object oriented universe. They had to if it was going to comply with .Net since the framework is built using an object oriented paradigm. But (A) why couldn’t they do it right? And (B) why can’t I get my brain to revert back to Visual Basic syntax?
Why the (A) you might ask and rightly so. If I tell you that AndAlso and OrElse actually are valid keywords you start to get the picture. In previous versions of Visual Basic the logical operands And and Or evaluated all expressions which meant that you couldn’t check for the existance of a value and it’s validity in the same If statement. In most other language the logical statements shortcircuit, by which I mean that And evaluates from left to right and at the first False the evaluation terminates. Likewise for Or except that it terminates at the first True statement since the the entire statement must be true. When they gave Visual Basic CPR and transformed it into VB.Net they didn’t alter the behaviour of And or Or instead they added shortcircuiting equivalents and named them … Yes, you guessed it! AndAlso and OrElse. WTF!
The (B) is because I have been spoiled using C# and somehow everything I write now is a mix of the two. In C# you declare an object by it’s type and then it’s name. In VB it’s the other way around. In VB there is no end of statement character, each statement is on one line and one line only. Well not entirely true but true enough compared to C# where each statement is terminated by a semicolon so that a statement can be formatted for readability and still compile. I’ve gotten so far that I actually manage to get the basic method declarations correct with qualifiers before the name and the return type at the end but I still write the actual parameters in the C# way using type and then name; hence VB# the bastard offspring of a deranged VB/C# programmer.

Hehe, I’m sooo glad that I’m not working with VB! AndAlso, OrElse. *Brrrrrrrr*
Posted by Mika Perälä on February 22nd, 2007