CodeSOD: Classic WTF: Covering All Cases… And Then Some

This post was originally published on this site

The Daily WTF

It’s Labor Day in the US, where we celebrate the labor movement and people who, y’know, do actual work. So let’s flip back to an old story, which does a lot of extra work. OriginalRemy

Ben Murphy found a developer who liked to cover all of his bases … then cover the dug-out … then the bench. If you think this method to convert input (from 33 to 0.33) is a bit superflous, you should see data validation.

Static Function ConvertPercent(v_value As Double) If v_value > 1 Then ConvertPercent = v_value / 100 ElseIf v_value = 1 Then ConvertPercent = v_value / 100 ElseIf v_value < 1 Then ConvertPercent = v_value / 100 ElseIf v_value = -1 Then ConvertPercent = v_value / 100 Else ConvertPercent = v_value End If End Function

The original article- from 2004!- featured Alex asking for a logo.

To read the full article click on the 'post' link at the top.