"I'm involved in a big project to re-implement an old, Classic ASP application in a more modern language," writes Mike Johnson, "although I have a decent amount of Classic ASP experience, I still struggle at times interpreting the old. It is a big mess."

"A previous employee, Dan, was famous for churning out tons of code. Users loved him because he seemed responsive and always fixed their (numerous) problems quickly. Sadly he never stopped to really understand what he was doing. When faced with a new problem, he just wrote more code.

"I stumbled across this function that supposedly returned a 'sequence' for a database table. After puzzling for a minute, I realized this function simply returns the time since Unix epoch:

    function doseq()
        dim a, b, c, d
        b = #11/4/2007 7:04:21 PM#
        a = datediff("s", b, now)
        a = a + 1194231874
        doseq = a
    end function

Mike continues, "strangely, this gets the number of seconds from an epoch, just not the Unix epoch, then adds a constant to successfully arrive at Unix time."

"The over-eager dim a, b, c, d is how Dan began every function. I have found some that declare nearly every letter. But even stranger than that, Option Explicit is never enabled in any of his scripts."

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!