Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is it no longer fashionable to put comments in source code, or is that like asking Jackson Pollock to explain each blob of paint?


Wild guess (I've never programmed Javascript (pathetic, I know)): They've used something like http://code.google.com/closure/ on it to make it more efficient, and any comments have been "optimized" away together with the intentions behind the web as a text based, open, readable format.

That way they can make sure HTML5 really IS the next Flash, i.e. so unreadable that it might as well be a proprietary format. Your source code will be safe from prying, learning (i.e. stealing) eyes.


Well, that link (http://code.google.com/closure/) invites one to "Try the Closure Compiler", leading here: http://closure-compiler.appspot.com/home

So I pasted in the source (http://macek.github.com/google_pacman/src/js/pacman10-hp.3.j...), and tried a couple of the optimization levels. The first squeezes whitespace, the third mangles everything ("Saved 41.37% off the original size (17.94% off the gzipped size)").

But the original is pretty clean, readable source code. It even uses spaces for indentation. Clearly not the output of an optimizer. Code lines such as "g.currentDotEatingSpeed = g.levels.dotEatingFrightSpeed * 0.8;" are better than possibly-out-of-sync comments.


According to the README, it seems like the nicely formatted version has been cleaned up before it was posted on github. ("Thanks to: SteD for providing a nicely formatted version of pacman10-hp.2.js)

/I'll stop talking about things I know nothing about now...


I also dislike binary blobs, or obfuscated 'source', and hadn't tried the optimizer before (thanks for the link, btw), so I gave it a shot.

But this one is the 'real' source. The mangled version is being served over at the now permanent URL (http://www.google.com/pacman , http://www.google.com/pacman/pacman.2.js), doing its job of saving bytes/watts.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: