Sessions for sessions sake

I have a client who’s website I am now responsible for. This site suffers from “too many developers” syndrome, in that there are some very different coding styles througout. The unfortunate thing is that by reading through the code you can see that most of them have absolutely no idea what they were doing.

I’ve found instances of horribly inefficient JavaScript where 3 functions are defined for each record in a result set and the Primary Key field is appended to the function name to make it unique. None of these repeated functions did anything different. None of them used any of the information from the recordset other than the Primary Key field. It was effectively just a window.alert('Are you sure?'); type function.

I’ve found inefficient ASP where a query is performed, the record set is looped through and counted, the query is closed, and then it is redone. All just so that the number of returned records would be known before the record set was processed. Never mind that the record set can be interogated to find out how big it is. Never mind that even if that was not possible, you could have processed the record set, perform a MoveFirst and then start again without having to destroy the recordset and recreate it.

I think I’ve just found the piece de resistance - storing information in session variables just for the sake of it. A Page that I am currently reworking sections of has the following brilliant piece of coding

Session(”CustomMessageSmall”) = “error about credit card payment failure”
response.write Session(”CustomMessageSmall”) & “<br />”

I could understand putting the message into a session variable if it was being used on another page somewhere, but it’s being used on the very next line. I mean seriuosly guys, lets not make the server do any more than it has too.

2 Comments »

  1. Alistair Said,

    November 14, 2005 @ 8:18 am

    Think of it this way, its code like that which is pushing the hardware industry forward.

    ;p

  2. Liam Said,

    November 22, 2005 @ 6:09 pm

    mmmmmmmmmmmm new itaniums :-D

    there’s some sexy shite coming up… we’ve just been to a few intel conferences… in which one of the guys let slip stats on the next gen itaniums then went “OH SHIT! NDA! NDA! YOU DIDN’T HEAR THAT FROM ME!!!”

RSS feed for comments on this post · TrackBack URI

Leave a Comment