robconery.com

Leaving Your Mark

April 17, 2012 | Opinion
Don Syme makes a very interesting postulation over on his blog: Is JavaScript code always so full of bugs? His post goes on to show what happens when you turn on script errors in IE - which is striking. But is it really that easy?
***

Slop

The rampant amount of errors you run across (if you use IE with script error notification enabled) will make you sad for the internet. It lead my friend Miguel deIcaza to postulate:

Guess a sloppy language encourages sloppy practices

A broad stroke, but you can't deny that JavaScript has a number of pain points. Inexperience writing in a painful language on top of shifting platforms (browsers) with changing standards... it's easy to agree with Miguel's sentence.

But it made me wonder:

Do we get mad at JavaScript so much because we can see the problems so readily?

It's right in front of our noses (especially if you have script errors on) - and the source is there for everyone to read and run through JSLint (JavaScript validator).

Side note: for fun I ran Don's blog through JSLint and it was red red and more red. This isn't a critique of Don, more of a wow dude might be more right than he knows kind of thing.

Your Slop

What if you could lift the lid on every site out there and peer inside at the source code? What if you could flip a switch that says ignore every try/catch, every begin/rescue and let the errors flow freely?

I think the internet would stop working.

I think blaming a language for being sloppy is probably a bit off base - as Phil put it:

sloppy developers promote sloppy code. It's just most sloppy code is hidden from us more than JavaScript is. ;)

I think Phil's right. But it brings up a question: when you write code, how many errors do you write per hour? And, more importantly, how do you know they're there and then fix them?

Forged From The Fiery Pits of Exception Hell

Think of all the code you've written over the years - JavaScript, Ruby, PHP, C# - whatever. Where is it now? How many bugs, logic errors and overall madness have you given birth to?

About 1 time out of 9 I can write a routine that works the first time. And when that happens I usually let out a "YIP!" - and then immediately distrust whatever it was that I wrote.

There's no way I can get it right the first time - Odds are that I can't. I know that so I test my stuff as much as I possibly can. Even then I know I'm letting crap out the door. It's human nature.

Our brains are wired to improve upon millions of years of pain and suffering (if you believe in evolution). Why shouldn't our code be the same way? What do we know of any other way to create... anything?

If you have kids and were present at their birth, you very much know what I'm talking about

The Mark of the Maker

Our code is forged from the pain of misunderstandings, miscommunications, hubris, bullheaded ego and a smidge of inspiration and love. After a period of slow-torture and water boarding, our applications take shape.

The true question is:

Do you forge your code carefully, fold it gently, and pound the finest edge found anywhere in the land? Does your code bear the marks of its maker?

The steel of the sword is only valuable as a measure of vanity - a tree limb can take a man's head if it's properly swung. It's the Mark of the Maker the tells the true tale of the weapon.

What does your Mark look like?

Join over 15,000 programmers just like you and me

I have a problem when it comes to trying new things and learning about computer science stuff. I'm self-taught, so it's imperative I keep up with what's going on. I love sharing, so sign up and I'll send along what I've learned right to your inbox.