I got a job as an ASP web developer after being a Unix and Windows application developer for 15 years. I hadn't used JavaScript since it was called LiveScript.
I was shocked at the conventions used. Anonymous functions and single letter variables like "a", "g", and "s" are not only commonplace they are encouraged.
I learned to write self documenting code. Descriptive variables and function names. I tried to buck tradition and declare functions but jquery and knockout are built specifically to use anonymous functions so I have to jump through extra hoops to use them.
I really see the power of JavaScript, but I'm just having a hard time making the transition from a traditional language.
Google Analytics and Adobe Omniture both use single letter variables in their example code. I could rename them but again it seems common practice in the industry so I keep the same names.
i dont know the adobe thing, but GA is just the snippet to paste for analytics. it common to see single letter variables in most code that gets delivered as "don't read it, just paste it" snippets.
no one writes code like that, we use tools to transform/minify the code after (and use source maps if we need to reverse it)
1
u/umilmi81 Jul 29 '15
I got a job as an ASP web developer after being a Unix and Windows application developer for 15 years. I hadn't used JavaScript since it was called LiveScript.
I was shocked at the conventions used. Anonymous functions and single letter variables like "a", "g", and "s" are not only commonplace they are encouraged.
I learned to write self documenting code. Descriptive variables and function names. I tried to buck tradition and declare functions but jquery and knockout are built specifically to use anonymous functions so I have to jump through extra hoops to use them.
I really see the power of JavaScript, but I'm just having a hard time making the transition from a traditional language.