Long time I am trying to understand the logic behind the Google's javascript codes. Each method in the script: http://pastebin.com/10DvhDYM get a non-logical name.
For example:
function ha(a, b) {
return a.name = b
}
function Ca(a) {
return void 0 != a && -1 < (a.constructor + "")[q]("String")
}
function F(a, b) {
return void 0 == a || "-" == a && !b || "" == a
}
Why they didn't using more logical and meaningful names for the methods and the vars ?
Most of the people that i asked, think that the names came from special IDE that built for Google developers teams, it's help them to work in team and more ability to understand quickly each function - is that true?
-
They did. They just applied a JS minifier to the code afterwards.user1233508– user12335082013年07月02日 15:43:17 +00:00Commented Jul 2, 2013 at 15:43
2 Answers 2
It's called minification. Shorter variable names take up less file space than longer variable names. In addition to variable renaming, whitespace is usually also removed to aid in compression. However, as you've found, it makes the code much more difficult to read.
Comments
They minified it to minimize the amount of bandwidth used. While it may only marginally decrease the size of the script for small files, the savings add up when you serve millions of pages every day as Google does.