Home > Programming > Avoiding religion in programming

Avoiding religion in programming

August 15th, 2010

Thou Shalt Rend Software and Religion Asunder

Steve McConnell, Code Complete Second Edition

There are numerous infamous religious wars in the world of programming. Windows vs. Unix, Windows vs. Mac, IDEs vs. text editors, Emacs vs. vi, Python vs. Ruby, where to put the curly brace, spaces vs. tabs, 2 spaces vs. 4 spaces; the list goes on ad nauseum. The fact that these arguments never end shows that there is no “true” answer. Usually it comes down to personal preference, which is fine. The problem comes when programmers become bogged down in the arguments, and begin to see their side as “the one true way”. Anyone using the other method is an infidel and must be converted or crushed. Of course, this is often just tongue-in-cheek banter, but all too often it goes further than this.

Most of my friends probably have a preference either way for Coke/Pepsi, and some have explained to me their reasoning. But none of them have ever tried to tell me that I’m drinking the wrong drink, because that would be silly (I hardly ever drink Coke or Pepsi, but that’s a moot point).

Alex Martelli wrote a fantastic essay about the differences between Ruby and Python on comp.lang.python. He makes a thorough comparison, noting what is shared and what is different. He also gives his opinion on why he prefers the Python way, while noting that it is only his opinion (speaking on implicit calling of functions vs. requiring empty parentheses: “I do understand why others would thing otherwise, even though I could hardly disagree more vehemently with them:-). “).

The upshot of all this is my vow to avoid all religion in programming. This is something I’ve been doing gradually for a long time. At one point I only ever used Windows, but reading The Pragmatic Programmer convinced me to try Linux. I started off using IDEs (NetBeans, Visual Studio), but then moved to Emacs. I’ve recently started learning Vim properly, and haven’t decided yet which I’ll pick as my primary editor (because you still need to have favourites!). I’d got to a point where I’d virtually declared Python the One True Language — this led me to start learning Ruby. I use 4 spaces for indentation in Python, and 2 in Ruby. I use spaces instead of tabs because tabs are silly and anyone who doesn’t think so is silly too :). When I use JavaScript I put braces on the same line as the control statement, because that’s what Douglas Crockford told me to do. I do the same thing everywhere else because I prefer it visually.

Now, I know there are a lot of enlightened programmers out there who already work in this way, so good work. But to all the others, have a look through the list of wars at the top of this post, and see whether you might be able to cross over to the dark side, however briefly, and try out your enemy for a bit. At least then you can give an objective argument about why you prefer one over the other (which always beats “x is teh suck”). Hopefully though, you’ll find that these things just aren’t worth arguing over.

Categories: Programming Tags:
  1. Jake
    August 15th, 2010 at 23:48 | #1

    Infidel! Tabs are the true indenters!

  2. August 16th, 2010 at 08:11 | #2

    Die, tabbing scum!

  3. WarWeasle
    August 26th, 2010 at 13:42 | #3

    My only religion is to use the right tool to solve the problem at hand.

    So I use lisp. :)

  4. August 26th, 2010 at 13:50 | #4

    Using tabs is the only mature and selfless way to operate. People who use spaces are forcing their own (often stupid) indent conventions on their peers. Given that the “tab” character means “indent this”, without specifying a specific amount to indent, your peers are free to view your code with whatever indent level they are comfortable with. You are likewise free to view their code however you like. Therefore, I posit that whether one uses tabs or spaces is an indicator of their maturity level (or, perhaps more accurately, their level of respect and consideration for their peers).

  5. August 26th, 2010 at 14:28 | #5

    @WarWeasle

    Obligatory xkcd reference: http://xkcd.com/224/

  6. meraxes
    August 26th, 2010 at 15:01 | #6

    Hurah for this.

    I tire of religous wars. There’s far too much opinion that asserts superiority. I really don’t get this. I like the language I use. That doesn’t mean the language you prefer is bad or wrong nor is mine bad or wrong because it’s now yours. Just different, and my preferences run the other way.

    I find this discussion particularly amusing around Python, Perl, Ruby and PHP because, ultimately, they are the same thing. Sure, there’s some syntactic and semantic differences… but you can do the same stuff in all of them. Anyone who says otherwise is selling something. :) You may be more productive in one that the other but that doesn’t mean someone can’t be more productive in it.

    I find online opinion is so polarized and full of vitriol but in meatspace I’ve met programmers of many different stripes who may not get each other, but they’re happy to hear about the cool stuff you did and tell you about theirs.

  7. August 26th, 2010 at 15:22 | #7

    IMO tabs are semantic, spaces are hardcoded. But I use the existing convention when contributing to a project, and tabs when starting my own. I don’t feel the need to argue with other about it. My editor is sane enough to have an expand tab option so when I hit tab it indents what I meant with spaces. Your editor should be sane enough to display tabs at whatever indentation you want and thus be capable of working on my code (and sane enough to disable expand tabs).

  8. August 26th, 2010 at 15:35 | #8

    @Caleb Cushing ( xenoterracide ) I would like to say that I use spaces where I want less semantic meaning and a more strict visual alignment, such as with a hash, betweeen the key and value.

  9. Dale
    August 26th, 2010 at 20:32 | #9

    I agree in a general sense. However, as far as trying different technologies, I always try them for a reason. Sometimes the reason is a need to learn them because they have been chosen by someone else working on a project I’m a part of. Other times, I choose them because they are recommended as being better suited to a problem I want to solve than the tools I already know. Other times, I just try them because I’m curious. Having a motivation for learning a new technology helps me to focus my self-education. The day I don’t have a wish list of things I want to learn that is greater than the time I have to learn them, I might consider another approach.

  10. squiggles
    August 29th, 2010 at 03:27 | #10

    for(dicks) {
    }

    for(godsway)
      {
      }
    

  11. Miro
    August 30th, 2010 at 05:58 | #11

    @squiggles I have a dick but no god. So, it looks like I’m doing it right.

  12. September 14th, 2010 at 20:26 | #12

    but… it would be boring with no holy wars :) take it as fun

  13. June 25th, 2013 at 10:58 | #13

    I needed to draft you the tiny note to thank you so much once again for your personal gorgeous ideas you’ve shown on this site. This has been simply particularly generous with people like you to provide unreservedly what exactly a lot of folks would’ve marketed as an e book to make some money for their own end, most importantly since you might have done it if you wanted. Those good tips additionally acted to be the great way to understand that many people have the same desire like my very own to realize very much more around this matter. I believe there are many more enjoyable situations ahead for individuals that find out your blog post.

  14. June 12th, 2014 at 06:45 | #14

    Remarkable issues here. I am very glad to look your article. Thanks so much and I am taking a look forward to contact you. Will you kindly drop me a mail?

Comments are closed.