Don't use tab characters

Most code editors allow you to use TAB characters in your source code. Such TAB characters will appear at the start of each line of your code, controlling indentation. The problem is that different tools can render TAB characters in different ways. What may look reasonable to the author, at time of writing in their particular environment, may be rendered in a significantly different way in some other tool.

For example, say the following code appears in your editor as :


import java.util.*;

public final class TabsOne {

  void decideWhatToDo(){
    if(! bored){
      continueWhatYourAreDoing();
    }
    else {
      if (! hasCarpalTunnelIssues()) {
        code();
      }
      else {
        eatSomething();
      }
    }
  }

} 

If you are using TAB characters, then this could easily appear in another tool as:

import java.util.*;

public final class TabsTwo {

    void decideWhatToDo(){
            if(!bored){
                    continueWhatYourAreDoing();
            }
            else {
                    if (! hasCarpalTunnelIssues()) {
                            code();
                    }
                    else {
                            eatSomething();
                    }
            }
    }
} 

Most people would consider such code as more difficult to read, and annoying. Thus, using TAB characters in source code is often considered highly undesirable.
Would you use this technique?
Yes   No   Undecided   
© 2013 Hirondelle Systems | Source Code | Contact | License | RSS
Individual code snippets can be used under this BSD license - Last updated on August 30, 2012.
Over 2,400,000 unique IPs last year - Built with WEB4J.
- In Memoriam : Bill Dirani -