Things that make programmers go AACK! 1

This post is bound to be disapproved of by two-thirds of our founding team. Dennis will disapprove because he thinks ‘programmer’ is something lowlier than a ‘software developer’ and I should not call myself a programmer. Ha! (This is the type of reasoned argument we have here at 7 Generation Games.)

Maria disapproves because coding talks don’t drive as much traffic to our site as say, posts on how people irritate me.  Double- ha! That would be – Ha! Ha!

Because, listen to this …. I know the thing that makes programmers go absolutely crazy is this:

You wrote some code. It worked. Now it doesn’t work. Or, more accurately, it works on some browsers but not others. Furthermore, no errors show up in your error log.

You are chasing this bug and you can’t find it because it doesn’t always happen. On top of that, you know that the code used to work and you KNOW that you did not change anything in it. This isn’t one of those cases where somebody is lying and they really did change it, because you have version control and you can SEE that it wasn’t changed.


nasty bee

Okay, let me cut to the chase on how I fixed one of these problems. It’s a memory game where you are supposed to match the cards of an equation, like 5 x 7 with its answer. I wrote it years ago. We were going to add a lot more bells and whistles to it and use it on our summer site that will have activities for students to do to maintain their academics over the summer.

In the function where your choice is compared to the location of the cards in the deck, I had this:

if (ev.layerX || ev.layerX == 0) {
    mx = ev.layerX ;
    my = ev.layerY ;
else if (ev.offsetX || ev.offsetX == 0) {
    mx = ev.offsetX ;
    my = ev.offsetY ;

Well, the event.layerX and event.layerY properties are no longer supported. I replaced the above code with this:
and, hurray, it is all working again!

var canoffset = $(canvas).offset();
mx = ev.clientX + document.body.scrollLeft + document.documentElement.scrollLeft - Math.floor(canoffset.left);
my = ev.clientY + document.body.scrollTop + document.documentElement.scrollTop - Math.floor( + 1;


You might wonder how I could be so dumb as to use features that were not supported but, as I said, I wrote this years ago and they were supported then. (Note to self, keep a better eye on deprecated features.)

You might also wonder why this fix wasn’t immediately obvious. Since it used to work and it now did not, I logically assumed it was one of the functions that had been added or changed that caused it to quit working. Makes sense, correct? I reversed those changes one by one and it STILL didn’t work!

Once I realized this was the problem, it took me about two seconds to find the above solution on Stack Overflow. I’m an ingrate because I did not save the link for that particular answer, but just let me be the billionth person to say that Stack Overflow is the bomb!

Leave a comment

Your email address will not be published. Required fields are marked *

One thought on “Things that make programmers go AACK!

  • Lance Andrewes

    Decades ago when I was a bona fide programmer, I asked my boss why my job-title had changed from “software developer” to “software engineer”. He told me I could stay a “software developer”, but I’d be paid less. Apparently there is a hierarchy. But yes, Stack Overflow is very useful, and it covers such a wide range.