Tuesday, October 23, 2012

Thoughts on JavaScript from 38,000 feet.




Note: what follows is some stream-of-consciousness writing from the plane on my way back from EmpireJS in New York this past Monday. It's a reflection of some of my current thoughts on JavaScript as a platform.


Let's say I wanted to build a robot to do something really awesome, like make toast or drive in space or fly a rocket crane or something. And I wanted to be able to do that in an expressive, high-level language.
Here's the thing. JavaScript won on the web, because it is everywhere. But with new platforms, do we want to be doing it in JavaScript just because it's familiar?


What, actually, are the good parts about JavaScript? Not just Crockford's favorite language features - I mean in terms of the ecosystem.


Npm is obviously a good part. We've done a great job of finding a good level of granularity to promote incredibly productive code reuse, and at the same time built a community to build thousands of these modules. This is good, and we should keep it. Now, bear with me:


I like programming because, as Fred Brooks so brilliantly put it, it makes me feel like a wizard. You sit at a terminal, type a few arcane and idiosyncratic incantations, and suddenly this machine does things. That's cool. But I want to be able to build things faster. Here's the thing - and I know I'm something of an anomoly here - I don't actually like programming. I like making things. I like being able to see the result, sharing things with people, and doing zany or useful or silly or amazing or trivial things. But i dont like typing things. One of the things I love about code is the ability to change things.


I have very little tolerance for idle bitching. Unfortunately, I also tend to complain a lot. Maybe not complain, but criticize, in the sense of identifying things that could (and should) be better. I'm not always a very happy person, because I see so much badnesss around me. But then I give myself the power to change some of it.


In his talk at EmpireJS, @domenic characterized a lot of what we as JavaScript developers do as Stockholm syndrome - we repeat things to ourselves to convince ourselves that we like and enjoy some of the dumb things in JavaScript which no person in their right mind would actually enjoy. Life is too short, the list of problems to be solved too long.


I submit we should be embracing this prolific explosion of compile-to-JavaScript languages. People are making things which solve their on problems. You dont have to use it. Write in whatever you like. But dont feel obligated to write in things you don't like. Don't tolerate badness. Do you like coffeescript? Maybe, maybe not. Now, do you use modules written in coffeescript in your projects? If not, why not? It better not be for some silly reason. Here's the thing - it shouldn't matter what language the code is written in. JavaScript is our vm. Whatever tools we use to arrive at that JavaScript should be wholly immaterial. We need to stop caring so much about imolementations, and start caring more about interfaces.


I heard a crazy and seditious idea last night - to start publishing tons of C modules to npm. At first that sounded crazy: native modules are evil, etc, etc. But why not? There's an argument to be made that having a common implementation language is better for encouraging community contributions. But most modules, I would contend, are written in whole or in large part by a single author. We shouldd acknowledge and embrace this, and realize that the really interesting things we should care about are tiny piece of functionality - especially domain-specific things. We don't need another damn templating language - we need fun things like math and science modules. It shouldn't matter if someone wants to write in R or Fortran. The biggest platform advantage we can have is fostering the incredible environment of code reuse and productivity, built on top of the right abstractions and interoperability.


Rather than promoting some perverse and conformist orthodoxy, I want to be a crowded bazaar at the intersection of exotic trade routes going to every far flung corner of the internet. I want to encourage mad hacking for its own sake - just to see what we can make. I want us to adopt creative and generative constraints, and discard traditional ones. Color outside the lines. Mostly, I want to look out at the world around me and see everything as mutable, as hackable, and continuously improveable. I want to be able to see the world like Neo from the Matrix - and I want to help others see the world this way, too.

No comments:

Post a Comment