Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^4: On Coding Standards and Code Reviews

by JavaFan (Canon)
on Feb 19, 2009 at 22:57 UTC ( [id://745219] : note . print w/replies, xml ) Need Help??

in reply to Re^3: On Coding Standards and Code Reviews
in thread On Coding Standards and Code Reviews

Having lot of respect for Damian Conway I would like to point out that almost all useful editors allow you to define the tab length. Be it 2, 4 or 8 spaces.
And that's the one and only the reason why tabs are evil. Tabs are fine if they act the same in every editor.

Suppose you have a 80-column coding standard. You have a 3 character indent as standard. You set your tab width to 3 spaces because you indent with tabs, and you have a subroutine containing a loop, and an if statement in that loop. Inside the then block, you have a 65 character line. In your editor, the line ends in column 74, well within the boundaries.

Now the next person never uses tabs, and uses an editor (s)he didn't customize to your habits. Hence, the tabwidth will be at 8. Now your 65 character statement ends at column 89, violating the coding standard.

That's why tabs are evil. Because you do not know how where the tabstops of the next person will be. Spaces are predictable. Tabs aren't.

  • Comment on Re^4: On Coding Standards and Code Reviews

Replies are listed 'Best First'.
Re^5: On Coding Standards and Code Reviews
by puudeli (Pilgrim) on Feb 20, 2009 at 07:03 UTC

    You have a valid point (++ for that) but I still want to leave the choice to the persons responsible of the code. If a team chooses to use spaces it is fine with me. The result is still the thing I am most interested in. If the code is formatted in a way that keeps it maintainable and I can use a formatter when changes are required I am happy with it. ruzam said it nicely, formatter should be the only standard if a formatting standard must exist.

    Overall, in my list code formatting is not the most important coding standard. There are more important things to keep in mind and they are all related to design issues like data encapsulation, module/object/function re-usability and independence (allows unit testing of a single coherent set of functionality) and so on. I do not want to belittle formatting, but it can be automated making it less important.

    seek $her, $from, $everywhere if exists $true{love};