Dear Pascal,
> - Permission and Forgiveness: Who are these code reviewers and OWNERS
> [sic!] that the document talks about here? Why do they care about my
> projects?
>
I don't see what you're getting so upset about:
No one really cares about your projects.
If call them "my projects", you are tautologically the owner of them, and
you get to choose who reviews your code (if anyone will) and
who else's code to review (if anyone contributes).
Just like the other Google Style Guides, this document
only claims to apply to code written at Google.
Google will NOT be sending SWAT teams to take out
non-Google hackers who fail to abide by the recommendations,
nor to abduct them and lock them into FEMA camps.
There isn't even any expected sanction against Google hackers
who fail to abide by the recommendations, beside remarks
from their reviewers or subsequent passes that fix their code.
We publish these Guides both as a service to the general community,
with the hope that they may be of some help to developers
(newbies especially so),
and as a way for us to gather feedback
(of which we've got plenty).
(As an aside, I interrupt this flamewar to profusively thank
to all those who replied with constructive comments;
I may not be replying to all of you individually,
but I'll continue integrating all your remarks.)
> - Principles: "Every developer's code must be easy for another developer
> to read, understand, and modify." Does this also apply to code that I
> don't intend to release?
>
Of course. God is watching you, and every time you fail him, a puppy dies.
As for me, I often find that I'm a different developer from the one I used
to be a few years back when I wrote a piece of code, and I'm grateful to
that other developer when he made his code readable, and less grateful
when he didn't.
> - "Everybody's code should look the same." I strongly object to that.
> An implementation of, say, quicksort should look different from an
> implementation of, say, mergesort.
>
I don't see how that's relevant to who writes the code.
Hopefully, Steve's quicksort will be similar enough to Scott's quicksort,
and Ben's mergesort will be similar enough to David's mergesort.
Whether to use quicksort or mergesort
(and whether to bother implementing yet another sort)
should be decided based on technical considerations.
> - Architecture: What is being said here contradicts to some extent
> principles from agile methodologies (like XP). Style guides shouldn't be
> influenced by a particular development methodology, because these are
> orthogonal issues.
>
Any drone strike against hackers who dare to follow methodologies
that differ from Google is purely coincidental.
Please disregard any children dying as collateral damage.
> - Using Libraries: I strongly object to the idea that people MUST NOT
> [sic!] start libraries. Hobbyists can do whatever they want, and the
> community should be open to hobbyists.
>
Oh noes! More puppies dying.
> - Open-Sourcing Code: What if my "main project" is to modify an existing
> open-source library? Do I still need to publish it separately?!? This
> seems contradictory in itself...
>
My head has exploded already.
The rest of this message is provided courtesy of Emacs auto-reply-mode.
> - Everything in "development process" may be completely over the top,
> depending on situation. It should not be mentioned in a style guide.
>
Sir, yes sir.
> - Spelling: Seriously?!? If somebody provides useful code, and there are
> minor spelling mistakes in there, is that really a problem?!?
>
Speling misstakes ain't no problem z'long as
the very same mistayke iz made consistently by evrywun.
> - Line length: I'm in favor of choosing a line length of 127. [Hint:
> sarcasm.]
>
Of course. Google will immediately amend its policies.
> - Indentation: LispWorks indents differently from GNU Emacs, and GNU
> Emacs with SLIME indents differently than without. Some developers
> (including well-known ones in the CL community) change indentation
> settings to have a personal indentation style. All of that MUST (har!)
> be fine for a community!
>
If and when any of them comes contribute code to one of our projects,
they will use the same settings as we do,
thanks to the configuration files we provide.
> - File Header: Some of the recommendations here may conflict with
> requirements of other (!) companies. A style guide shouldn't impose such
> requirements.
>
Soon enough, Google will buy those companies and reformat their code.
Unless droning is cheaper.
> - Vertical white space: I sometimes add two lines to distinguish between
> sections of code, especially when additional comments to separate the
> sections seem overkill. I don't want to discourage other hackers to use
> three or four lines. Why does it even matter?!?
>
If it doesn't matter, why be so upset about it?
> - Horizontal white space: I strongly object to the discouragement of
> vertical alignments through horizontal spaces. This can drastically
> improve readability (which supposedly was also a goal of this document).
> But I also don't want to impose on others to have the same preference as
> me. Such nonsense should just not be in such guidelines!
>
There are reasons to align things vertically.
Absent such reasons, it is only distracting to align vertically,
which only suggests a reason that doesn't exist.
By following such conventions, it becomes easier to convey meaning.
> - Document everything: This is clearly wrong! Read the literature about
> extreme programming for reasons why documenting everything is a really,
> really bad idea!
>
There are good reasons to document things in a project
with tens of other people who will have to maintain your code
long after you're gone.
This rule obviously does not apply to throwaway code,
code written by immortals who never quit,
and code written by people who are going to be droned imminently, anyway.
> - Comment semicolons: Somewhere in all the Common Lisp code I have
> written so far, I'm pretty sure I used the wrong number of semicolons
> occasionally. Am I now a bad boy?
>
You are very naughty body indeed, Mr Costanza.
I don't think Santa will come visit you this year.
> - Naming: Many of the things mentioned here are standard practice. But
> again, too many "musts" and "shoulds." This is not necessary. Just
> explain what the common practice is.
>
MUSTs and SHOULDs are indeed descriptive of common practice.
Some constraints are stronger than others, and it is appropriate
to use different words to express this difference in strength.
> - Language usage guidelines: All the subsections in here are highly
> controversial. Common Lisp is a language which encourages development of
> a personal coding style. A document like this should not try to restrict
> this freedom. Especially controversial are: avoidance of recursion,
> using special variables sparingly, avoidance of slot-value and
> with-slots, all the talk about protocols, requiring that specializing
> classes should inherit from the same base class (wtf!?!), not using MOP
> intercession (wtf?!?). (How generous of you that you "allow" exceptions
> to the rules in the document. A style guide intended for the community
> should not pretend that it is a binding authority!!!)
>
The entire purpose of a Style Guide is make it easier for many developers
to communicate with each other by laying down common expectations as to
what code looks like by default, thereby allowing developers to raise
awareness when they challenge those defaults. If there are no defaults,
then discrepancies are just costly noise that readers must ignore,
rather than beneficial signals that they must pay attention to.
Now at long last, I find some technical content to your message.
I'll clarify the rationale.
Regarding special variables, they are state,
introduce complexity due to potential interaction,
are costly to manage, and should only be used
when their benefits are greater than these costs.
I will add a paragraph to that effect.
Slot-values are low-level. Most of the time, you should be
on the other side of the abstraction barrier. Use accessors.
Yes, base classes are cleaner.
They are a locus for documentation, specialization, etc.
You can't retrofit them onto other people's code.
You can and should add them to your own.
Regarding not using MOP intercession,
I didn't write this guideline, but I'll stand by it.
At runtime, they are at worst a danger, at best a performance issue.
At compile-time, it is cleaner that
macros should things up the right way on the first pass,
without the need to modify things in a second pass.
They are great tools for interactive development and IDE,
but you should not use them in the code being developed.
You are the only one here who suggests
the guide is intended for "the" community.
I was not aware there was One and only One community,
and that YOU were its spokesperson. My apologies.
> I'll stop here. I guess you got the idea by now...
>
I get that you are confused as to the intended purpose of this Guide.
To avoid criticism, do nothing, say nothing, and be nothing. – Elbert Hubbard