Does Coding Style Matter? 479
theodp writes "Over at Smashing Magazine, Nicholas C. Zakas makes the case for Why Coding Style Matters. 'Coding style guides are an important part of writing code as a professional,' Zakas concludes. 'Whether you're writing JavaScript or CSS or any other language, deciding how your code should look is an important part of overall code quality. If you don't already have a style guide for your team or project, it's worth the time to start one.' So, how are coding style guidelines working (or not) in your world?"
Re:It's easy with an IDE (Score:5, Informative)
... and it makes version control diffs shorter and to the point.
Re:Kinda Subjective but... (Score:2, Informative)
Tabs indent, spaces align. Your code should look equally good no matter whether tabstop is three characters or eight.
Re:Kinda Subjective but... (Score:4, Informative)
I use tabs because anyone can set the width to whatever they like (2, 4 or 8 spaces usually).
There still exists a lot of tools that assume tab stops are 8, without the ability to change them. Some people use those tools by choice, some people use those tools by mandate.
Style is Substance (Score:5, Informative)
The best article that I've ever read on coding style is Style is Substance [artima.com] by Ken Arnold.
I won't repeat what he has to say here, because he explains it better than I could. But I wish that more programming languages would follow what he is advocating, because we waste way too much time arguing about braces and tabs.
Run everything through a formatter (Score:4, Informative)
Just use Artistic Style [sourceforge.net] for C and its derivatives C++, C#, and Java. I usually set it for "--style=ansi", but that's a project preference. External code is run through Artistic Style before use. This way, everyone knows the indentation is consistent.
For Python, of course, there are few formatting options, so this isn't an issue. Dreamweaver will indent HTML. Javascript remains a problem.
Re:Kinda Subjective but... (Score:2, Informative)
KR (Score:5, Informative)
My does:
My don'ts list is getting shorter and shorter. Most programmers have reasons why they produce the code the way they do. Lack of experience should be met with understanding and appreciation for improvements.
Re:Kinda Subjective but... (Score:5, Informative)
one of these guys is using Comic Sans as his coding font, as he's dyslexic and it helps him
Has he looked into fonts designed to help dyslexics, like Gill Dyslexic [pixelscript.net] and Open-Dyslexic [dyslexicfonts.com]?
Re:Kinda Subjective but... (Score:4, Informative)
no, it's you who broke the formatting by mixing whitespace characters.
and you don't want to type "| expand -t4", so you're going to make a mess of the commit log, make diff a mess, and force everyone else to run everything through indent.
It's sloppy and inconsistent.. and you're making it harder for everyone else on your team because of your laziness.