What is the most horrible programming language or technology you have worked with?

View original thread
Eric O. Jonathan's photo

I just had a discussion with a colleague about a JavaScript file that we're both working on. There's this 'that' variable/object that was suddenly being used in the functions without having it being initially declared. Not being well versed in JavaScript I was assuming that must be a built-in Java object that is equivalent to 'this'. But then it takes different function arguments. It didn't seem right. If it was an anonymous function, shouldn't it also be declared as such somewhere in the script?

Anyway, we traced the 'that' assignment on a different JavaScript file that was declared earlier before the JavaScript file that we were working on. And even worse, that assignment was declared in one of the functions there, not at the top as global variable!

"This is sloppy coding!" I said. Just because the variable that you declared using 'var' can be used beyond the function that you declared at, that doesn't mean you have to use it as global variable! Using 'let' is still much better. It prevents unwanted behavior when treating variables as though they are available everywhere!

So, that's my gripe with JavaScript so far. Sloppy coding can happen in any programming language but JavaScript made it too easy to do it.