CodeSOD: Classic WTF: Covering All Cases… And Then Some
by Alex Papadimoulis from The Daily WTF on (#57V61)
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. Original -- Remy
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. Instead, let me remind you to submit your WTF. Our stories come from our readers. If nothing else, it's a great chance to anonymously vent about work.[Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today!