« DoD Manages to Stay Asleep| Main | Nerd Joke »

Javascript and Kindergarten

| | Comments (0)

I've done all sorts of programming. Back in the day, I started with DBase, then AppleBasic, then C. I moved through a bunch of stuff. I've written all kinds of cool, web 2.0, cutting-edge programs.

Somewhere along the way, I ended up in JavaScript. I used to think, gee, in twenty years we'll all be talking to the computers and they'll be converting speech into programs. But it's twenty years later, and it didn't work like that. Somehow I don't really feel like we're making any progress here. JS is a loosely typed language, which really raises my C++ hackles. But it's everywhere, and it's definitely the language of the future.

But I can't get over the feeling that JS is really a throw-back from the past. Seems like everything I know about JavaScript I learned in kindergarten.

Picture of Vulcan family from Star Trek. Spock, Sarek, and Amanda
Will Spock find true logic?
Will Sarek finally open that Waffle House he dreams of?
Will Amanda will the "Babes Of Vulcan" contest this year?
  • Beats me what it is - When you're a kid, there's a lot of stuff that's a mystery to you. Funny-looking thing with metal pieces? Beats me. When you're looking through somebody else's JavaScript, you get the same feeling. Most programmers couldn't name a variable something like "TitleText". Nope, that would be too easy. So instead they give it a useful name like "g7". My first contract program on an Apple II used variables like "g9" because the language only supported two-letter variables. Nowadays we've got to cut the size of the download! So we're back to square one. Ever look through somebody else's JS code? You might as well drink a six-pack and try to figure out Vulcan soap operas. Got a variable "j3qx4"? Beats me. There's just too much going on under the surface for your brain to track effectively.
  • Do little things at a time - When you were a kid, if the teacher asked you to do something like "pick up your toys, go to the bathroom, get your lunch, and stand in line" you'd just stand there with a dumb look on your face. Kids can only take so many instructions at one time. JS is the same way. If you're writing a 10-line JS function, life is good. If you're writing a 40 or 60-line JS function, you've got a bit of work. If you're writing an 800-line function, not only should you look up "coupling and cohesion" on Wiki, but you're on the Bataan Death March.I don't care how good your IDE is, do little things. You can still stand there with a dumb look on your face, just not while the other programmers are looking.
  • Stay away from the bullies - In school, if the bully wanted the good seat in the cafeteria, you gave it to him. Likewise, if you're coding something that, say, Microsoft or Google is also coding, their solution wins. Yes, you can re-invent the wheel, but whatever they are doing will have so much market traction that it will become a sort of standard.
  • Color inside the lines - When I was a kid, seems like every day we had some kind of art project. It was probably something to give the teachers a break. There would always be paper, crayons or paints, scissors, tape, and that smelly glue. I'm not sure what we ever did with all that stuff. For all I know the teachers had bought stock in a school supply company and were making a killing on options trading. But I did learn something important: people want something with just the right amount of flash. Flash and sizzle are great -- it's what makes a site distinctive. You always have to balance the sizzle with the content, however. When done well, your sliding DIVs, blinking SPANS, and fading IMG tags will just highlight the good content, not distract from it. So JS is all about little details, little splashes around the edges. Sure, there's the magic engine that does whatever neat thing your site does, like contact the ghost of Elvis or enter the reader on American Idol, but that's content. Content is always king. The trick is to also add the little details in the right spots to accent the content. And no, taping construction paper to your monitor does not count.
  • Don't keep screwing around with it - On parent day, my parents came to the school to visit the teachers and see how I was doing. All the little art projects were put up on the walls, all the little desks were in a row. Each desk had a piece of masking tape with the child's name across the top. One art project was put up at an awful angle, and out of all of the desks, one desk had the tape all messed up, obviously where it had been pulled up and played with and stuck back down. If you do something so that it works, and it's tested, leave it alone, for goshsakes. There's nothing worse than taking a perfectly good piece of code and mucking it up because you wanting the indents to be different.
  • Share - If you don't share in Kindergarten, they make you sit in the corner. In JavaScript, yes, you can set a timer for every 50ms and do whatever you like, but people are going to say ugly things about your family if you do. Sure, you can grab that windows onload function and just beat out anybody who wants a piece of it, but other stuff ain't going to work. JS is the language of the web, and that means your JS had better be playing nice with all the other JS on the page, some of which you didn't write. Eventually there may be an interop standard for side-by-side JS living on the same page from different vendors, but until there is, you have to just try to share as best you can. Just think of how much better you'll feel.

That's how to take your school experience and apply it to your web programming. If the languages keep evolving like this, maybe in another twenty years those hand-painting and taping skills might come in handy. I just hope they don't give us those little desks again.

Leave a comment

About this Entry

This page contains a single entry by DanielBMarkham published on July 27, 2007 4:56 PM.

DoD Manages to Stay Asleep was the previous entry in this blog.

Nerd Joke is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Social Widgets





Share Bookmark this on Delicious

Information you might find handy
(other sites I have worked on)





Recently I created a list of books that hackers recommend to each other -- what are the books super hackers use to help guide them form their own startups and make millions? hn-books might be a site you'd like to check out.
On the low-end of the spectrum, I realized that a lot of people have problems logging into Facebook, of all things. So I created a micro-site to help folks learn how to log-in correctly, and to share various funny pictures and such that folks might like to share with their friends. It's called (appropriately enough) facebook login help