Re: Mastering Google Java Coding Style

Alan Gauld via Tutor <[email protected]> Fri, 8 Aug 2025 00:27:19 +0100
Newsgroups gmane.comp.python.tutor
Message-ID <[email protected]>
On 06/08/2025 07:50, Sophia Robart via Tutor wrote:
> Software development requires that developers maintain a consistent coding style

That's actually a highly controversial statement. A lot of
research has gone into this and the results are ambivalent
on the importance of consistent style. Steve McConnell
discusses this in his book Code Complete. Clearly written
code is essential and far more important than a
consistent style.

Consistent style with badly named variables, or unnecessary
loops or branches, even if conformant with the approved
style make code harder to maintain.

I've worked with many different style guides, from COBOL
through BASIC to C++, Java and Lisp. And I've seen good
and bad code in all of them.

Style guides tend to be something that managers like
because they don't need to understand the code to know
whether it follows the guide. They can even write tools
that police the guidelines and even give scores/ratings
on "how good" the code is based on its adherence to the
standard.

Now, there is some evidence in favour of consistent style
too, but it is not as overwhelming as you might think.
And it has very little to do with where you put brackets,
how much indentation to use, and the other trivia that
style guides tend to focus on.

> The Google Java Coding Style is one of the most popular 
> coding styles used by many open-source projects beyond Google. 

Yes, but for Java. Trying to apply Java style to Python
will quite possibly lead to poor Python code, since Python
is very different to Java in its underlying philosophy.

But for those who think a style guide will help them in
some way there are Python style guides around.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos



_______________________________________________
Tutor maillist  -  To unsubscribe send an email to [email protected]
To unsubscribe or change subscription options:
%(web_page_url)slistinfo/%(_internal_name)s