Rolling Ollies and Javascript

2009-02-11

It was fall 2005. I was seventeen then, and I found myself perched on one of the platforms at the local hall, looking at my friend Lawrence, who was doing skateboard tricks on the railings below. He’s one of those kids who had always preferred four wheels instead of two, and even with our eighteen years of friendship, I still think that he cares more for his skateboard than me.

He looked up at me, his face dripping with sweat, yet framed by a satisfied smile. He’s good with a board, and he knows it. He slowly came up the platform where I stood, breathing a little heavier than usual, and grinned at me deviously. “So are you ready to try it out?”

One of my college professors once told me to never take a job as an educator, unless I want my students to hate me with a passion. Apparently, I was too cocky. I didn’t blink when she said that: I guess a part of me knew she was telling the truth. But I always told myself I wasn’t that cocky—I was just always too gung-ho.

I gazed at the weathered board my friend was holding. Before that moment, I have never ridden a skateboard, nor have I thought of even trying. But the ever present spirit of gung-ho told me, “Hey, just do it! What can possibly go wrong?!”

I looked at Lawrence straight in the eyes and smiled. “Sure. Why not?”

The Rolling Ollie Debacle

Lawrence sat on the bottom stair leading to the platform and looked at me. I could see the satisfaction in his eyes, knowing that he somehow succeeded in that brief stint of being a skateboarding instructor. And after five long hours, he finally had success in teaching me how to mount a board, do turns, halt—and I finally managed to do my first successful basic ollie. He took one of the water bottles we brought and took a long draft. “You’re doing good Markee. Next time I’ll teach you how to do a rolling ollie.”

My mind did a quick math: I learned how to skate within the span of a few hours, that’s quite impressive, so a rolling ollie would have been a no-brainer. With his statement, Lawrence unknowingly pinged my gung-ho impregnated ego: “Do it! Show him your mad skills! DO IT!”

I winked at him and gave him a cheezy grin. “A rolling ollie? You mean like this?” And I took the board, rode it a few feet and tried an moving ollie.

The next thing I knew, Lawrence was rushing next to me, trying to help me up. I remember pain, blood and limping—in no particular order. Apparently, I did it wrong, fell and gashed my lower leg on the concrete. I remember looking down and seeing a long, bloody wound underneath my right knee. Lawrence looked at me with concern, and all I could say to him was, “Damn. That’s gonna be one cool scar.”

If there’s one lesson I learned from that incident—which I now refer to as the “Rolling Ollie Debacle”—it’s that most of the time, being gung-ho is not enough.

And in case you’re still wondering what gung-ho is up to this point, then let Dictionary.app clear it out:

Gung-ho adjective. unthinkingly enthusiastic and eager.

I don’t want to go into the details of the history of the word—that’s what Wikipedia is for. But to be clear, to be gung-ho is to be overly excited about doing something that you just dive into the fray without even thinking.

And unfortunately, being gung-ho leads to being faulty.

Javascript Gung-ho

There’s a real problem of too much gung-ho when it comes to programmers these days, and this is especially true when it comes to new Javascript developers. It’s like there’s a rush to use all this cool stuff in their new projects, yet there’s a distinct lack of enthusiasm when it comes to actually learning how the stuff works. Somewhere out there, there’s a programmer who’s never touched a line of Javascript and who doesn’t know a hint about the language, and yet he’s trying to implement a big project with large amounts of Ajax and other js-based bells and whistles.

I understand it when I see people who are not actually web developers or programmers struggle with implementing Javascript functionality. People like the casual web user who just want to put a small script on their social network profile to add additional functionality, or a small js-based widget on their blog. These people don’t work with code all the time, and it’s just normal for them to be all gung-ho when it comes to adding new stuff on their pages or blogs even if they don’t know how—because they’re not expected to.

But when I see someone who’s work is actually web-related, like a programmer or web developer, who’s lurking IRC channels asking for help because they want to implement more than a dozen Javascript-based functionalities on their current project—and still have the nerve to say, “Sorry, I don’t know Javascript”—all I can do is stare at my screen incredulously and think, “What the Fuck?” Talk about too much eagerness.

The Lie of Ease

I can think of one main reason why these people get all naively enthusiastic in implementing js-based features even if they don’t have an inkling about Javascript, and it’s because Javascript has come to the point when it appears to be easier than it looks like.

Think about it: Javascript is now the star of the web. The once loathed and detested language is now the main force behind many of the web’s new functions. It’s become this ubiquitous entity you can’t escape and you can’t turn-off, less you want a “Crippled Internet Experience” (Crippled IE?!).

And the Javascript Frameworks also have a part too. With each release, Javascript Frameworks have made it easier to do stuff like Ajax, special effects and awesome animations. The old stuff that used to take hundreds of lines of code could now be implemented by a dozen. And the hundreds of scripts, widgets and whatchamacallits look all too inviting, promising everyone the satisfaction of a “Web 2.0” experience within a drop of a script file.

This image of Javascript as the pervasive yet no-brainer language is what deludes many developers into thinking that they could implement something big without breaking a sweat. It’s this vision that you could create complex projects using Javascript—without even knowing what Javascript is—that drives some developers into thinking “Hey! It’s gonna be really easy to do this large scale project with Javascript! I don’t know anything about it, but I’ll just drop these scripts here and everything will work perfectly!”.

That’s the gung-ho talking.

Gung-Ho is Never Enough!

I believe that if you know one programming language, it’ll be easier for you to learn another. Javascript is a unique language in its own right, with it’s own quirks and features, but it still has similarities with other languages. And there are things that seem logical in other languages yet totally weird in Javascript, and vice versa.

It is suicidal to think that you could implement a big project in Javascript without knowing even the basics of the language. That’s like me doing a rolling ollie without getting any information on how to do it in the first place. Sure, I already knew how to do an ollie, but a rolling ollie is different—there are other things to consider that are not present when doing an ollie while being stationary.

I’ve seen it many times, and other people will nod their heads when I say that this is more common that we would all like to think. Time and again, you’ll come across someone on a forum or IRC channel asking for help because they don’t know Javascript and they’re trying to implement this functionality and that functionality. And by the time you look at their code, you’ll just gaze in amazement at how one person who doesn’t know Javascript could possibly think he could implement everything on his list.

No amount of enthusiasm can replace knowledge of how to do stuff. Sure, miracles can happen—like the time I successfully baked a cake for my friend’s birthday with no prior baking experiences—but it’s unusual. Even if you really want to do something, if you don’t have an inkling as to how to do that something in the first place, there’s a distinct possibly you’ll fail. Trust me, I know—I still have the scar on my right leg to prove it.

And the bigger your goal, the higher the risk is. If you fail in implementing a small widget for a personal blog, it’ll be okay—it’s just a small project after all. But if you’re talking about a large scale system, with hundreds of users and a dozen stakeholders, you could either do the right thing and learn the stuff before you do it, or pray to the Gods of Firebug that your gung-ho is strong enough to prevent any bugs.

Your Project Should Not Be a Rolling Ollie

I’m calling out to every web developer or programmer out there who wants to implement big js-based functionalities in their project yet know nothing about Javascript: Please, for the sake of your sanity and the sanity of everyone else who’ll eventually come across you as you post your questions on forums or IRC channels—please, quell your gung-ho and learn a little bit of Javascript first.

The great thing about Javascript being so big these days is that it’s even easier to learn it. There are a dozen good books targeted at beginners, which I’m sure you can purchase at any good bookstore or even online. And for the thrifty, there’s a hundred free tutorials, articles and manuals available on the web regarding every topic you’ll ever need to know.

Even if you’re gonna use a framework, please still try to learn how Javascript actually works. No one expects you to be a Javascript guru, but you should at least learn the basics: proper syntax, naming conventions, variable and object declarations, good practices and such. No matter how what framework you’re using, or even if you’re not gonna use a framework, learning the basics is essential when it comes to implementing anything. And if you’re gonna use a framework, for the love of proper closures, please read the documentation.

And experiment: do small stuff first using dummy projects or implement a small personal project. I’ve learned more about Javascript by doing experiments than in anything I’ve ever read, and I still keep an “Experimental” folder on my hard-drive that’s filled with files for trying out new stuff. It’s the safest way to learn how to do stuff before doing anything big—and it is certainly better to get frustrated at yourself when doing an experiment than getting an angry client because you’re failing in implementing their hot new thing.

And please, don’t ever, ever, ever tell people that you don’t have the time to learn Javascript. How the hell are you supposed to complete your Javascript-laden project if you don’t know an inkling of how to do stuff in Javascript? Do you expect the Gods of Javascript to just smile on you and add event handlers to your code automagically or define your variable for you?

In the end, I just have one advice: wipe that programming gung-ho off your face and stop for a moment to learn something you’ll need. Javascript isn’t that simple, but trust me: it’s way easier than a rolling ollie.