0

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?

1
  • They did. They just applied a JS minifier to the code afterwards. Commented Jul 2, 2013 at 15:43

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.