Monday, November 14, 2005

JavaScript is the Devil!

It's Monday morning, I got 5 hours of sleep, and I'm cranky. So I want to talk today about my impossible coding session yesterday with JavaScript. I wanted to play around with some AJAX techniques, and see what I could make of it. I wanted to write something cool, something that I could actually use. The first thing that I wanted to build was a simple client-side RSS reader. It was a crazy idea on a lazy Sunday.

I kicked open my favorite IDE, Eclipse, and kicked off my project routine. I created a managable directory structure with JavaScript and CSS files in their own directories. I checked the initial structure into Subversion. Then I started coding. A div here, an onload here, and I was well on my way to having some fun.

I write some JavaScript code for my work, but my primary language for the last few years is Java, with years of prior Perl experience before that. Neither of these really prepared me for the nine hells that would be known to me as JavaScript. I have always been an Emacs fan, and I saw IDE's as bulky, and excessive. Recently though I wanted to really learn to use an IDE and see what sort of benefits it would provide. I found that, in general, I like using an IDE, or more specifically Eclipse. The refactoring tools along increase productivity, and help get the job done under budget and on time. My IDE is now a part of my toolbox.

Back to the Devil... As I was saying, I created the initial project framework, and started coding. I don't do much JavaScript coding, like I mentioned, and my JavaScript book was at work, so I relied on a few online resources to guide me through the DOM. After a few minutes I was ready to try out what I had so far. It didn't work. Hmmm... the Firefox JavaScript console showed an error. I scanned the API, made some changes, and tried again. It didn't work. Hmmm... the Firefox JavaScript console didn't show an error. It seems that I had miss named the property of an object, so I fixed the mistake, and tried it again. It didn't work. I looked at my code, rechecked the online reference, and scratched my head. Just at that moment my other computer, the one that I was using to play a podcast, started to skip, like a scratched record. I rebooted it (Windows is the Devil too).

This went on for two hours.

During this session I called my computer every name that I could think of. I even yelled, "I'm going to replace you with a Power Mac!". My computer to it... well... like a computer. It just sat there devoid of emotion. I felt like I wanted to throw it out the window, but I wouldn't do that. I knew that when I cooled down that I would still need it to do my work. Lukily my wife came home around that time, and I just walked away, the same way you walk away from a pointless fight that you know you can't win.

Writing all of this down is, I think, good therapy for me. I'm not going to let a non-typed language run me out of town! I'll get back up on that horse soon, and then I'll teach JS a few tricks!

No comments: