Sorry Visual Basic -- I is through *WITH* YOU!
I've always had a soft spot for visual basic.
Sure it's verbose. (verbose, like XML, is evil.)
Sure it feels patronising to say "nothing" when you really mean "null".
Sure some of the default settings were criminally stupid.
Sure VB over uses the round brackets, like they're good enough for parameters, arrays and generics all at once, yet makes no clear distinction about using them for method versus property references... then mis-uses the angle brackets for crazy non-XML stuff like attributes.
But it has background compilation, and -- smarter still -- it has the with
statement.
The with
statement is way cool.
With
is like the (not yet invented) Context Driven Development
which will give us a further 46% productivity gain. (Eat that, smug lisp weenies!)
Yet with
just bit me bad -- turns out there's something fundamental i didn't know about with
...
Say you have an object variable you've already declared:
Dim builder As StringBuilder
While it's fine to write this:
builder = New StringBuilder
With builder
.Append("Fred")
End With
It's not fine to write this:
With builder
builder = New StringBuilder
.Append("Fred")
End With
The latter returns a null reference exception.
Setting the with
'd variable inside the with
seems to be a little bit ignored.
The reason is buried deep in the generated MSIL. I expect. And it sh*ts me to tears.
So one of those tiny elegant features that makes life simpler and easier just dissolved for me -- making like uglier and more complex.
At least VB's still got background compilation and a nicer embedded XML syntax (...come 2008. Whenever that's gonna get here)
(and before some dimwit troll jumps in to attack a language in the comments -- i strongly support polyglotics over language-war.
Say the average human can master 3 natural languages. And the average computer language is (for the sake of argument) 1/20th as complex as a natural language -- then the average programmer ought to be able to master 60 programming languages. If you've mastered less than 60 languages and you openly discourage others from learning a particular language -- well, that's outright bigotry. maybe. or not ;-) )
Next → ← PreviousMy book "Choose Your First Product" is available now.
It gives you 4 easy steps to find and validate a humble product idea.