I know each programming language has it's good and bad things... but man, after some years working with C/C++ and C#, how the hell am I supposed to work with VB.NET!
I'm right now working with VB.NET (CLR 1.1), a custom framework/application blocks that the client/user has for external developments, and third party web-controls (Infragistics... another day I'll talk about this "amazing" controls...), so I'm in unknown territory.
I'm trying to do the "better" parts (SQL stored procedures, custom controls and user controls' logic, learning how infragistics works *in theory*, learning the custom framework,...), but I have to code in VB.NET anyway.
So apart from the multiple bad things for a C-like developer (constructors, line breaks, null <-> nothing, [] <-> (), and such things that makes me have sort of 10-15 syntax errors each time I create a new code-behind or logic class), one problem we had really pissed me off.
Dim date As NullableDateTime
' This works correctly
If (webDate.Value Is Nothing) Then
date = NullableDateTime.Null
Else
date = NullableDateTime.Parse(webDate.Value)
End If
' This throws an exception because false part is processed and tries to parse a Nothing/null value
date = IIf(webDate.Value Is Nothing, NullableDateTime.Null, NullableDateTime.Parse(webDate.Value))
Why VB.NET processes the false IIF part if the condition is true? I'm doing the IIf just to do that check BEFORE parsing the WebDate control's value, so if that value is null/nothing it don't throws an exception. I don't want VB to pre-check both IIf results!
It gets me mad... I hope I won't work again with VB.NET, because I'm too "C-style" oriented and it's hard to be "switching the chip" from one programming style to another when some things are down to compiler issues...
Tags: Development