Separate letters for variables and functions

Context

I read a sample JavaScript code written by Google. He used:

  • Single lowercase letters for variables
  • Single capitalization for naming functions

So the code was illegible.

Questions

  • Why is this name?
  • What tools are used for this?
+4
source share
5 answers

Often, when large Javascript libraries are put into operation, the code is "minimized" to ...

  • Reduce download size
  • Make it harder to redo the code

I think the main motivator is No. 1.

This process usually includes things like removing comments and spaces and changing links to links to individual characters.

For example, see JSMin .

+7
source

Fewer letters mean that fewer bytes means faster downloads, which is Google’s main concern (stated).

They probably use the Closure Compiler , but the YUI Compressor is still popular.

+2
source
+1
source

Some people do this to confuse, but many do it to minimize, because fewer characters means that it is a smaller file to transfer.

You can use minimization / compression tools, and google has one that is open source:

http://code.google.com/closure/compiler/

+1
source

It serves two main purposes.

  • reduced throughput as Google serves pages a lot
  • entanglement

http://blogoscoped.com/archive/2008-02-08-n74.html

+1
source

Source: https://habr.com/ru/post/1343558/


All Articles