- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
confusion is the key!
Admin
I love the way they eat any exception, rather than what .FindByValue returns. Mmmm.... silently failing code....
Admin
To get the most out of this blog it seems working knowledge of VB and SQL are really needed.
I have also realized that I never want to use VB or SQL, ever.
Admin
Since this guy broke the mold I figure I can finally implement this code:
Public Function IsIntBob(value as Integer) as Boolean
If ctype(ctype(value, Double), String) = "Bob" Then
Return True
Else
Return False
End if
End Function
Admin
Tony, that is hysterical.
Admin
But Tony, shouldn't you surround that with a Try…Catch, just in case there's an InvalidCastException?
Admin
If you would like to see more examples, just let me know. I've spent months replacing code like this from this particular colleague and since I use source control, I can always go back into history and find some code for a good laugh now and then.
Admin
Hey, I wonder if a few lines down, we see:
Public Readonly Property GetDocumentIndex() as Int32
Get
return ddlDocument.SelectedIndex
End Get
End Property
Admin
Oh thats nothing. How about this?
Public ReadOnly Property GetProduction(ByVal vType As eProductionType) As String
Get
Dim oDataView As DataView
Select Case vType
Case eProductionType.Projected
Return FormatOrderAmount(SelectedGroup.ProjectedProduction)
Case eProductionType.OnHold
Return FormatOrderAmount(SelectedGroup.OnHoldOrderTotal)
Case eProductionType.Potential
Return FormatOrderAmount(SelectedGroup.PotentialProduction)
End Select
End Get
End Property
A parameterized read only property named with a Get prefix! I'm at a loss for words.
Admin
I like to call the above pattern an "Propenumtion". It use an enum and a paramterized property that to all others looks like a function.