Habits, good or bad, are easy to gain but hard to break. Often, the way one learns to do something is the way they keep doing it, sometimes never questioning if there is a better approach.

One of Lance K.'s colleagues had one habit that was well-intentioned – thoroughly commenting his code – but he apparently didn't realize that comments are meant to explain the why rather than the how:

intMessageID = Cint(request("msg"))

'Make sure the messageID is within the proper range.
  If (intMessageID > 0) AND (intMessageID < 8) Then
'Get text for messages from DB.
msgSQL = "SELECT MessageText FROM Messages WHERE MessageID BETWEEN 1 AND 7"
SET rsMsg = conn.execute(msgSQL)
'Convert the recordset to an array.
   arrMsg = rsMsg.GetRows()

'Display the appropriate message text.
   response.write(arrMsg(0, intMessageID - 1))
End If

You're probably thinking the same thing I am right now. Why test that a value is in a range, look up the same range in the database, put the results in an array, and then load the message by index? Why write comments that describe nothing more than exactly what the following line of code does? Why, why, why?!

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