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

4 of 479 comments (clear)

  1. Re:It's easy with an IDE by Anonymous Coward · · Score: 5, Informative

    ... and it makes version control diffs shorter and to the point.

  2. Style is Substance by afgam28 · · Score: 4, Informative

    The best article that I've ever read on coding style is Style is Substance 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.

  3. KR by SpaghettiPattern · · Score: 4, Informative
    Kernighan and Ritchie stands for an exemplary coding style. It's spirit can be transferred to more modern languages. It was thought of with readability and screen economy in mind.

    My does:
    • Never omit braces for conditions and loops.
    • Spaces instead of tabs. This is a holy war which I have fought with myself. Stated with tabs but after years of persevering I realised spaces had less issues.
    • In related projects, choose one style and stick with it.
    • Let the IDE do the code formatting for you.
    • At any cost, avoid the order of members to be significant.
    • If you need fancy formatted comment then your design may need a review.
    • Design your software to be a set of modules and develop each module as pure as you can. Solving one problem well reflects in the code you produce.
    • Divide your compilation units in units containing data structure definitions and units containing processing code. That also makes your code more readable.
    • Learn from better programmers and become a better programmer every day.
    • Avoid the pitfall of cryptic programs. The more people can read you code the better it can be maintained.

    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.

    --

    I hadn't the slightest objection to his spending his time planning massacres for the bourgeoisie... (P.G. Wodehouse)
  4. Re:Kinda Subjective but... by icebraining · · 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 and Open-Dyslexic?