80 characters? I never had that limit for the 27 years of programming proceeding using the Google style guide and it never caused me any grief. I find that naming things descriptively and an 80 character limit are at odds.
I'd rather read
maxCombinedUniformVectors = maxFragmentUniformVectors + maxVectorUniformVectors;
than maxCombinedUniformVectors =
maxFragmentUniformVectors + maxVectorUniformVectors;
or maxCombinedUniformVectors = maxFragmentUniformVectors +
maxVectorUniformVectors;
I admit it's kind of useful for side by side diff tools but in my previous 27 years of programming I never felt like "If only this code was 80 characters I could read the diff".More importantly though, the Google Style guide is written by Java programmers to try to make JavaScript into Java, totally ignoring all the benefits of treating JavaScript like JavaScript. That has it's benefits, especially for Java programmers. They don't have to learn some of the cooler things about JavaScript. They can go on treating it like a traditional oop language. And they get static type checking.
On the other hand, all of these FP concepts are out
http://osteele.com/sources/javascript/functional/ http://www.ibm.com/developerworks/library/wa-javascript/inde... http://osteele.com/archives/2007/07/functional-javascript http://www.cubiclemuses.com/cm/blog/archives/000307.html/
Even common JS concepts like encapsulation
var ErrorLogger = (function(){
var privateErrorCount = 0;
return {
error: function(msg) {
console.log(msg);
++privateErrorCount;
},
getNumErrors: function() {
return privateErrorCount;
}
}
}());
Are not allowed by the Google Style guide as well as many other JSisms.Another nit, Google Style guides disallow formatting for readability except for comments?!?!
Allowed
var kStateRun = 1; // character is running
var kStateRunToWalk = 2; // character is transitioning from run to walk
var kStateWalk = 3; // character is walking
Not allowed var kStateRun = 1; // character is running
var kStateRunToWalk = 2; // character is transitioning from run to walk
var kStateWalk = 3; // character is walking
Either lining things up makes them easier to read or it doesn't. Comments are not some exception. If lining up comments makes them easier to read then lining up anything makes it easier to read.