Slashdot Mirror


Does Coding Style Matter?

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?"

3 of 479 comments (clear)

  1. Re:Kinda Subjective but... by A+Friendly+Troll · · Score: 3, Interesting

    Here's the funny thing, and I'm honestly not joking: one of these guys is using Comic Sans as his coding font, as he's dyslexic and it helps him. The other is using Tahoma, because it's very narrow.

    Visual preferences vary. That is why we are able to set our own fonts and colours in our IDEs. It is strictly a personal thing. I'm a black-on-white guy, but the Tahoma guy from above is using the old Borland nineties colour scheme, yellow-on-blue. Strangely enough, I "grew up" on those same colours, and since switching to LCD monitors, I can't stand it any longer. No idea why...

  2. Re:It's easy with an IDE by Dr_Barnowl · · Score: 4, Interesting

    Having a consistent style means that you don't end up in the situation we are, where we have several patches that are probably a days work to merge with the main line, not because our patches are large, but because some bonehead decided it would be good to run an automated code reformatter on his source tree.

    This not only reformatted everything to a style that no-one else on the project uses, but re-sorted all the fields and methods in the source files affected. This made everyone elses copy of the source conflict violently with essentially every change made in the reformatted files, giving everyone else the headache of re-implementing their patches.

    Peoples edits continue to make the format of these files a mess because they are indented in a way that's inconsistent with the source.

    Alas, we can't undo these patches because the bonehead is the lead developer. But catering to prima-donnas means more work for everyone else.

  3. Re:It's easy with an IDE by WaywardGeek · · Score: 3, Interesting

    It all comes down from the guy in charge. I've set the coding style at two of the last three companies I've worked for, and while new guys may not like it, it does promote effective teamwork. It's a lot more than just indentation. We use the same data structure styles, iterator styles, and everything from start to finish. It can be very difficult to determine who wrote any given piece of code, and a git-blame shows that it's a patchwork quilt with everyone contributing all over the place.

    The guy who I will say is now the lead developer of our main software suite writes code that looks exactly like mine. We've even on occasion wrote entire functions, in the same place, which were identical down to the last character, even in the obligatory comment. No git conflict in that case. At the other company, there literally were no coding style guidelines, and the result is no one was able or willing to easily edit anyone else's code. That makes it very difficult to move people around to projects that need them most.

    There are a ton of developers out there who are loners. It's a field that attracts geeks who are somewhat social-phobic. I've never seen programmers voluntarily adopt a common coding style. It's more fun to fiddle around on your own. So, instead of working together as a team to solve real problems rapidly, individual programmers go off in different directions, learning more about different ways to write code than actually writing code.

    --
    Celebrate failure, and then learn from it - Nolan Bushnell