stepzero / stepzero.github.io

StepZero website
Other
0 stars 2 forks source link

Write page: Concepts > Whitespace #23

Open vmbrasseur opened 10 years ago

vmbrasseur commented 10 years ago

Link this to coding conventions.

The matter of whitespace is a religious one in many software development circles. It starts more arguments than the question of "What's the best text editor?" (link to text editor page)

While there are many different types of whitespace which matter to people in software development, one of the most contentious points is that of the number of spaces in a tab stop (link to tab stop definition). The most common number of spaces are 2, 4, and 8. Most projects will choose one of these and use it consistently in all files. This allows for continuity in the flow of the code, making it considerably easier to read. For instance, this:

Example of code using consistent tabstop size

Is much easier for a programmer to read than this:

Same code sample but with differing sizes of tab stops

Before you start working with a project's code, check the (link to coding standards) coding standards (if it exists), the wiki, new contributor documentation. If you don't find something telling you about the preferred number of spaces in a tab stop, ask someone (link to where to ask). If you don't do your homework to learn the preferred number of spaces to use in a tab for that project, then use the wrong number of spaces and commit the code, you may get off on the wrong foot and annoy other members of the project community.

vmbrasseur commented 10 years ago

To reinforce the "religious issue in software dev" point, perhaps screen-cap this Tweet:

https://twitter.com/holman/status/441647555030441984

That captures the issue nicely. :)