HomePage RecentChanges Tabs

Tabs, 2 space, 4 space, 8 space, 9.5 spaces...

I get asked why I use Tabs. I am very fussy when it comes to code layout. Preferences for indentation, use of brackets etc are all very important. But I also like to leave people choices.

There are lots of arguments on using spaces vs tabs and how many to use. I am not really going to get into them, but I did want to give an example of what should and should not be set.

Rules?

These rules are good:

An example

What font size should you use. Well 9 point. Everyone should use 9 point. This is of course not true. Firstly, everyone should use the font and size to suit them. And secondly screens size change, available space and point size change (depending on what you use for calibration).

So you should give the user the choice of font, background colour, colour syntax highlighting etc.

I believe the same things for spacing of indentations.

Back when I used 21" monitor and used the full width of my screen, I really like 8 spaces for a tab. Now I prefer the more acceptable 4 spaces. But sometimes, when working with XML or Javascript I find that 2 is even appropriate.

Use Tab, configure Spacing

So I use tab. Then I set tab to 4 spaces on my normal computer. And then when another developer in my team prefers 2 spaces there is no down side.

See Also

Software error:

Can't locate object method "endform" via package "CGI" at /data/scott.dd.com.au/wiki/modules/search.pl line 15.

For help, please send mail to the webmaster (webmaster@dd.com.au), giving this error message and the time and date of the error.