Thursday, August 1, 2013

The JavaScript Rap

Last year, I gave a talk at EverywhereJS called "JS in the front, REST in the back" about our frontend-heavy architecture and the advantages of it. I thought that the title had a nice rhyme to it and that it almost seemed like to start of a rap, and I always like an excuse to sing and dance in my talks, so I started an EtherPad with one stanza in it, and asked Twitter to take it from there.

I discovered that my Twitter followers are all rhymers at heart, and they should probably all just give up coding and spend their time penning mad rhymes. But, actually, they're also JS ninjas: their rhymes mentioned the most obscure of JS features and the new ES6 hotness. Since the etherpad gets "vandalized" a lot, I've decided to snippet it here for posterity. If any of you actually record yourself rapping this whole thing (or country singing it, that's cool too), please let me know. It would make my day/life.

Update: I dared Adam Sontag to deliver the rap as the closing for BackboneConf, and he got through a whole 40% of it. Check out the video here. Best conference closing ever.

Update 2: You can now listen to JavaScript speaking the rap. Amazing. Better than I could ever do it.

Give me the Mic
Crockford and Eich
From Netscape to Node
It’s been quite a hike
 
JS in the front, REST in the back
Ain’t it time you changed your stack?
Server-side rendering? That’s just whack
Once you go Backbone, you never go back
 
Unobtrusive set us free
It all blew up with jQuery
Now it’s MVC with TDD
Ain’t got time for PHP
 
Onclick to Require was such a ride
With GitHub code ain't got no where to hide
my lack of globals is a point of pride
I’m hitting my stride on the client-side
 
Stop testing IE 6, it’s a trap!
Been crap since way back, everybody knows that
Standards make dev such a snap
And don’t get me started on space vs. tab. [mic drop]
 
Use Grunt, watch it automate on a dime
Don’t waste no coding time
AMD will make you feel cool
Loose Coupling so you won’t look like a fool
 
Just sit right back hear the tale
Brendan’s gonna make, we cannot fail
We ain’t got three hours, it’ll take ten days
Born from scheme and self in a lispy haze.
 
And amp, semicolon, the rhymes, I got plenty
I got the space encoded, fool it’s percent twenty
my var’s locked in closure, that’s dope
Ain’t no bleedin or leakin’ since I’m in the right scope.
 
Yo, JS is /the/ form,
where I code like a storm
Free from spaghetti!
Fierce like the Serengeti
If that bug’s hard to track
console’s got your back
 
Code it DRY, code it right
Browser, server, world; its all in sight
Use the remote debugger
Like there ain't no other
 
You code in JS, but you mixing the types
And always forget the syntax for “splice”
To type “double equal” is like rolling the dice
And you scared to death … of prototypes
 
It’s time to stand up and get some respect
Just go to ECMA and read the fucking spec
Unpuzzle, unlock it, uncode and decrypt
And gain yourself power of true JavaScript
 
You add number to string and string to array
Divide it by object (you know it’s ok)
The prototype chain you can see through the code…
It was a great journey from Netscape to Node.
 
`eval` is evil and `with` is whack
F*ck classes — you can have ’em back
This is the generation of floating math
No tail calls in this giant stack
 
Var i, math dot pie in the sky
Fly tries to catch zero size
arrays with new prototypes are lies
disguised as wise overrides
prefix with java, ecma, mocha, and live
script all day and all night
microsize your JS lines
but don’t self minify
above all else, yo, f*ck static types
 
Go async and then you’ll never look
(this line will run before the last’s call)
back. Stop waiting for some slow IO
and start using four cores in your MacBook Pro.
fat arrow lambda, func’d the funky
close over this, ya JavaScript junkie
comma abuse, ASI hack
truth-y compare, you'll wanna redact
Bask in the glow, open/close brace
of any indent, Insignificant whitespace
`arguments` array? It isn’t that hard
You ain’t gotta call Captain Picard
 
My macros are sweet, my models aren’t fat
My build script’s complete, unit test — all that
Controllers are trim, view models fine
E.C.M.A. - TC-39b
 
functional code, is what I’m rockin’
dot foreach and map, reduce ain’t lockin’
those mutable props, makin’ me sneeze
I think I’m allergic, object dot freeze
 
while cache clonin’, weakMap for me
gimme some has-Own-Prop-er-ty
awaiting for no one, renaming a file
async is alright, actor callback style
 
Google Go code-gen, in fat reams
Don’t need no types, or agile teams
Slingin’ that node, gimme pipes, gimme streams
Gimme that Harmony, of our dreams
 
My code is lean, it ain’t all swollen
I love my braces and my semicolons
It’s ok now, don’t you be tight-lipped
it’s ok to say you hate CoffeeScript!
 
It was all a dream 
I used to code vanilla JS on the scene 
Now I got Backbone and Zepto all up in the IDE
JS is blowin’ up like I thought it would 
New frameworks, but same language in the hood.
And it’s all good.
So if you don’t know, now you know, coders. Uh.
 
Hey yo server siders clogging up the rear
Stop making it complex, I’m starting to tear
try the frontend, that’s where it’s at
Power to the coders, got nothin’ to catch

No comments: