Tuesday, November 18, 2008

Stealing JavaScript

I was talking to a new friend who is starting his own small web agency, recruiting small businesses. It is at this point, a two-person operation: him for sales and another person for the actual creation. "He's all into XHTML, CSS, validation, talks in pixels."
-- "Who does your JavaScript?"
"We just steal that."

It's true. And very much done, and not for JavaScript. I wasn't the only programmer out there who would rather start with a half-baked program or skeleton or template rather than have to fire up the Software Development Environment with a blank page, in any language, not just JavaScript, scouring the web or ftp or textbooks for some piece of source vaguely related to what I wanted my program to do. Good environments like Eclipse will even try to fill in as much as they can for any project for you.

There is some question of ethics there, but in the end we do what we do to get there fastest and not commit to egregious an infringement. Of course, the Open Source movement is all about having this not be a problem: Open Source projects are very explicit you can re-use their computer code, as long as you release your modifications and re-uses and adaptations to the larger community as well. Trying to operationalize this involves much hair-splitting over copyright notices, examining what constitutes re-use and adaptation, when should source code for a computer system be released back to the community or not.

JavaScript sidesteps all this. JavaScript source code is compiled inside the browser, so it is the plain-text source code that gets shipped around when pages are loaded. Sure it can be obfuscated and re-arranged to be unreadable, but a good formatter can handle most of that. So while Open Source developers are worried about infringing and infringement and what license and notice to use when they should make source available with their compiled binaries, JavaScript just gets shared automatically when it is used. There is no binary compiled JavaScript to ship.

The result is that the ethic of 'stealing' JavaScript is widespread, but the fruits can't be hoarded anyway, they get immediately shared. In that way is enforced Open Source, and possibly a very good model for future systems and languages: don't allow binaries to be shipped, just human-readable programs. JAVA is almost there if it didn't insist on its intermediary bytecode form. All that's missing is the 'currency' Open Source proponents say is the one important to them: credit. When the copyright notice gets taken out, so does the credit and kudos about who made this brilliant script, and with that future emplyability. Another system is necessary to keep it.