CodeSOD: The Duff Code

This post was originally published on this site

The Daily WTF

As we frequently note, a staggering number of real-world software products start their lives as Access databases running from a shared folder somewhere. There are professional developers who end up maintaining these monstrosities.

Gregory has had the misfortune of being one of those developers. A client has a terribly performing Access database, and it happens to be the driver of their business: it generates insurance quotes for an insurance company.

Let’s take a look at some of the code.

‘A Pause function Public Function HoldIt(Longish As Integer) Dim Startof Dim temp temp = 0 Startof = Second(Now) Do temp = Second(Now) – Startof Loop Until temp > Longish End Function

Hey, I think I found the performance problem. The only good thing I can say about this busy loop is that they actually check the system time, and didn’t just throw a pile of iterations at it and hope

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