back to article We're going to have to start making changes or the adults will do it for us

Gentlemen of IT, I think it's time we talked. I hate people who use spaces to indent their code instead of tabs. I don't mildly dislike them. I am not uncomfortable or annoyed by them. I hate them. A goodly number of you have some technical pet peeve that is similar, and that's a huge part of what's wrong with IT. This is not …

Page:

  1. Anonymous Coward
    Anonymous Coward

    Tabs vs spaces is fairly important. It should be part of the coding standards at a company. Which is chosen doesn't particularly matter, but that one is chosen is.

    So is variable naming, function naming, class naming. All personal preferences, but if there isn't a system, it's chaos.

    ( I prefer tabs, because I'm normal, but if I worked somewhere that mandated spaces, then fine )

    1. Anonymous Coward
      Anonymous Coward

      TAB treachery

      I used to prefer TABs, but one day I tabified a file and the regression tests started failing because Emacs had replaced some of the spaces inside a string literal with TABs. At that point I saw the light and switched allegiance.

      What I really hate is trailing spaces. Fortunately, git has a nice facility to discourage people from committing them.

      1. Peter X

        Re: TAB treachery

        Reading the article I was thinking, "yeah, but now I'm older I'm much more easy going about such things". But then you mentioned tailing spaces... and I don't know why but they *REALLY* irritate me.

        These days my .vimrc contains this:

        match ErrorMsg '\s\+$'

        to highlight trailing white-space, and all is good with the world!

        Rationally, I should not care about this. Yet I do. It's really strange and I'm fairly sure no one outside of IT could possibly understand this.

      2. Michael Thibault

        Re: TAB treachery

        >replaced some of the spaces inside a string literal with TABs

        Why would you have multiple consecutive spaces in such a string to begin with?

    2. Anonymous Coward
      Anonymous Coward

      The problem in IT is the anarchic attitude...

      The problem with many IT people is exactly the anarchic attitude. Regardless of what you think is better, you have to adapt to (and adopt) what the environment you work in requires. There could be reasons, behind rules and standards, you can't see, but are there because someone looking at the overall picture found they are needed.

      You may propose changes, but if they aren't adopted, you have to adapt to existing standards - as it happens in any other discipline (or the results are usually the Mars Climate Orbiter ones).

      But still you can't find a not so small number of IT people that stubbornly refuse to follow the rules, and when requested to do, feel it an insult. And sometimes it really looks to deal with children or anarchists. And the worst ones are usually the one who attempt to escape any responsibility...

      1. Brewster's Angle Grinder Silver badge

        Re: The problem in IT is the anarchic attitude...

        "There could be reasons, behind rules and standards, you can't see, but are there because someone looking at the overall picture found they are needed."

        Experience suggests rules long out-last the reasons for them being there. But emotional attachment and institutional inertia prevent them being changing. ("Look, I wrote the rule. This is the reason I wrote it. We no longer need it, in fact it's counterproductive, and we need to do away with it.")

        The other day somebody posted a link to this brilliamt article about managing geeks The geek aversion to rules is generally an example of geeks working round performance inhibiting damage.

        1. Doctor Syntax Silver badge

          Re: The problem in IT is the anarchic attitude...

          "Experience suggests rules long out-last the reasons for them"

          I've thought for a long time that a rule should be accompanied by its rationale. That way (a) PHBs & CxOs who wish to override them can be made aware of the risks and (b) it's possible to see when changing circumstances remove the rule's reason for existence.

          1. Terry 6 Silver badge

            Re: The problem in IT is the anarchic attitude...

            When they say or imply "That's how we've always done it." That's not just an IT thing. It's definitely common in offices and I'm guessing lots of other workplaces.

        2. Anonymous Coward
          Anonymous Coward

          Re: The problem in IT is the anarchic attitude...

          Yet sometimes those rules are laid down by other geeks who are real experienced ones and not inexperienced wannabes - and there are very actual, valid reasons behind them. The idea than *any* rule is wrong is childish, and dangerous.

          Don't get me wrong - there are very bureaucratic outdated environments which are toxic, but there are some so "creative" that they become unproductive and toxic as well.

          And there's always the need to play along and nicely with others, even if you may not like them personally - otherwise the environment becomes toxic as well.

    3. streaky
      Coffee/keyboard

      Tab v space is a huge issue because it belies fundamental logic failures that are at the core of the way a percentage of code monkey brains operate. I won't tell you which way you should go but it should be obvious to anybody who actually writes code.

    4. Julz

      Tabs vs spaces is not important. Scripting languages and data descriptions that are sensitive to white spaces is the real problem. Oh, and one that has been solved and forgotten, and solved and forgotten, and ... for decades.

      1. streaky

        It's *hugely* important. And yes it's been solved, and that's why it's useful for spotting clowns walking through your door.

  2. Adam 52 Silver badge

    M-x tabify surely?

    As for the other stuff, I'll have to start looking for a new job.

    1. GordonD

      Problem with M-x tabify is that it blows out version control, especially when I revert it on next commit (mwahahahaha).

      tabs vs spaces and new line endings are great feuds, and since they can be handled by any decent version control system on checkout and commit, they're refreshingly pointless.

      A proper feud like ICantReadThis vs sensible_naming resists machine sabotage, although there are worrying signs that the poor handling of CamelCase by speech synthesis might result in sanity being restored by the accessibility red card route.

      1. Anonymous Coward
        Anonymous Coward

        In my experience, heathens who use camel case also like to write sentences as their variable names, eg:

        combinedlValueOfAllTransactionsForMonthSoFar

        1. BasicChimpTheory
        2. Dan 55 Silver badge

          I really would love to have sentences as variables instead of the x, y, and z in uncommented 25-year-old code that I'm maintaining now.

          Can't we all just leave our egos at the door and get along together? (And re-educate the people who use spaces, they know not what they do.)

        3. Anonymous Coward
          Joke

          combinedlValueOfAllTransactionsForMonthSoFar

          Well, one of my ex C developer would probably call it cv_atmf... or maybe cv only.

        4. Pirate Dave Silver badge
          Pirate

          "heathens who use camel case also like to write sentences as their variable names,"

          That's because VB doesn't mind long variable names. ;)

  3. Anonymous Coward
    Anonymous Coward

    Starting point: EMBRACE the human factor

    Yes Trev, you know me.

    I have an answer that is simple to state, but takes a lifetime of effort - also known as a commitment.

    Embrace the human in your work. Your job is not just to manage some kit, widen your view to the point of realisation that what you do affects people (you did allude to that, but it must be an integral part of your thinking). People who write UIs should think of their grandparents trying to use their work. People who design infrastructures should keep in mind the NEXT guy trying to manage it (slight aside: we are in the process of implementing a mandatory handover process to test if this is done right because you cannot have a business dependent on one person - I'll get back to that in a minute). People who audit other people's work should realise that they are dealing with someone's daily job and should help that person to enhance and improve that work, not tear it down on minor flaws so they can show they're "better" to sell their consultancy outfit (trust me, I've met enough of those fools, but the guys that work for me do so because they earned both my respect and trust).

    In other words, look beyond yourself, and help others do that too. Upwards, sideways, downwards. The tabs thing? Well, that's just a REGEX search & replace away from a fix, and a good debate over beer ought to clean this up - learn the difference between an argument and a debate (for fun, take the OTHER side of a viewpoint under discussion - trust me, it's interesting). (Re)Learn tolerance and cutting other people some slack - realise that the black-and-white approach is a result of media induced training to sell ads, not a natural social mode of behaviour.

    Yes, I know there are a lot of managers out there and precious few leaders, but it's not about what they do, it's what you do with and to others. If you're the sort of political, backstabbing climber who has no problem tripping people up for gain, trust me, if you try to get into my crew your reputation and your own habits will get you ejected before you make it past the first month. If you're the sort of boss who needs slaves and despot-like behaviour to run your operation, you do not deserve the best, because the best can and will walk, and you will forever have to watch your back.

    And you want to be the best (never assuming your ARE is part of that, by the way, I alluded to that in another post :) ).

    I know it's fashionable to squeeze the last erg of effort out of people in the age of the spreadsheet, but that's for idiots who do not plan long term. I run my setup in a way that makes every person replaceable, including me. Why? Because it means people can get ill and go on holiday without the fear that the world collapses behind them - they know others (and their boss) have their back rather than stab it. Because it makes good business sense to have people who like where they work because, quite simply, THAT is the right way to get the best of people.

    Of course, this has to go together with a HR process that filters out the idiots, but if you've been doing this for a bit you know that what the likes of Lord Sugar and Orange Trump show as a business is for megalomaniacs. It can be done differently - usually better.

    You can run a business without fear. And if you manage that - you will be feared :).

    (slightly rambly, but I'm going to leave it as it is lack of structure and all :) ).

    1. Mark 110

      Re: Starting point: EMBRACE the human factor

      If you need a hand with that mandatory process give me a shout. I'm available currently. We can just copy and improve the one used at Unilever.

      1. m0rt

        Re: Starting point: EMBRACE the human factor

        "Well, that's just a REGEX search & replace away from a fix"

        But which REGEX standard, though?

        I like Trev. He is my kind of people. I can identify with a lot of things he says. I once worked for a guy who insisted that I put 25 blank lines in java code, after every 25 (or something like that, you get the idea) lines of code because it meant that when he used textpad to view the code he just had to press page down and it was all nice for him.

        I refused and promptly installed IntelliJ at the time.

        these things, ultimately, don't matter if the code is well written and there is a sensible standard adhered in the company. But we all have our fixations. Me? I hate the term 'Artificial Intelligence' because it doesn't mean what people thinks it means. I also hate unhandled exceptions. Justin Bieber. Long rambling posts that go nowhere and don't stay on topic. People who never finish what they st

      2. Anonymous Coward
        Anonymous Coward

        Re: Starting point: EMBRACE the human factor

        If you need a hand with that mandatory process give me a shout. I'm available currently. We can just copy and improve the one used at Unilever.

        We're a few months from completing, for a simple reason: staff. Getting the right staff for a role is only easy if you see them as numbers. The moment you recruit people to keep them (discounting churn etc) it gets a bit more complex because you then have to look at the human, not at the CV. Provided there's some talent, you can fix a lack of skills but you can't always fix attitude..

  4. Anonymous Coward
    Anonymous Coward

    Ok, so...

    how wide should tabs be...?

    is 8 too wide? should they be 4?, 2?

    ...3?

    You don't want to be forced into spaces, but aren't you forcing people into tabs.?

    because a mix doesn't work.

    personally, you always know where you are with a space, and a good editor makes it easy to align things.

    1. Anonymous Coward
      Anonymous Coward

      Re: Ok, so...

      Four. Obviously.

      And if you aren't lining things up for aesthetic reasons, people can set their own tab width.

      1. PassiveSmoking
        Happy

        Re: Ok, so...

        You're all mad.

        It's quite clearly five spaces per tab.

      2. Anonymous Coward
        Anonymous Coward

        Re: Ok, so...

        Sorry, but the indenting width can be quite language specific. There are languages which uses only two spaces indents, for example. And when people are allowed to set their own tab width, you're going to play with fire.

        Anyway, what is important is to set a standard and stick with it. If the standard is based on the language default standard (i.e. PEP8 for Python), the better. Better chances your code will look alike third party one.

        1. Anonymous Coward
          Anonymous Coward

          Re: Ok, so...

          Sorry, but the indenting width can be quite language specific.

          Exactly. Once upon a time I wrote in OPL, and the whole operating environment made indenting code with more than two spaces just not very usable. A text window of 20 characters by 4 lines just isn't the right place to have 8 space wide indents :).

          Personally I prefer a tab being represented as 4 spaces - it's enough to make the blocks visually stand out, but not so large that a line runs off the screen (I don't like wrapped lines as there's too much potential for error).

    2. ToXik-yogHurt

      Re: Ok, so...

      "how wide should tabs be...?"

      As wide as you set your editor to display them. 1 level of indentation is 1 level of indentation, not 4 spaces or 8 spaces specifically.

      1. GerryMC

        Re: Ok, so...

        Sepend on the language of course. a 4 space indent in Pascal looks hideous. 2 in C# looks bonkers. Tabs are for people who can't make up their mind.

        (Note: using tabs is almost unheard of in my most common language (Delphi). I know of no third party code, FOSS or commercial that uses them). Perhaps I should use the troll icon?

        1. Steve Davies 3 Silver badge

          Re: Ok, so...

          Er.... ???

          Isn't Delphi just Pascal on Steroids?

          Sometimes you have to replace tabs (no matter 1,2,4 or 8 spaces) with a single space.

          For example when putting code samples in Documents. you have a limited with and even with 8pt font you get word wrapping which makes readability a PITA.

          Just saying...

          As for line endings they should be...

          Octal 15, 12

          {If you are an old Fogey like me, you will know what systems used those lines endings}

        2. Anonymous Coward
          Anonymous Coward

          Re: Ok, so...

          Sepend on the language of course. a 4 space indent in Pascal looks hideous. 2 in C# looks bonkers.

          Since your argument here is solely about looks, would you therefore agree that the "best" indent width is entirely subjective? That is to say; differing from one person to the next?

          Tabs are for people who can't make up their mind.

          My position is that tabs are for people who don't want to force their own subjective aesthetic preferences on others.

          1. Mr Flibble
            Mushroom

            Re: Ok, so...

            Tabs for block indentation. Spaces (after the block indent) for indentation within a multi-line statement. That way, you get the flexibility of however wide you want your tabs to be today without messing up intra-statement alignment.

            Two-space indents? Been there, done that. Was useful where I used it.

            Now, the pet hate: people using four spaces just because the tabs happen to look like four spaces. I normally have tabs set to every 8th column, but I will sometimes switch to every 4th. That shows quite nicely where the bad indentation is.

    3. David Harper 1

      Re: Ok, so...

      Every line of source code should begin with six spaces, as the venerable and wise John Backus taught us almost sixty years ago. Except for comments, which start with a 'C' in column 1, or continuation lines, which have five spaces, an arbitrary character in column 6, then the rest of your statement from column 7 on.

      1. Little Mouse

        Re: Ok, so...

        "Every line of source code should begin with six spaces"

        Nononononono. Every line of source code should begin with a number. As in:

        10 PRINT "(.Y.)"

        20 GOTO 10

        30 REM Happy days....

        1. Michael Thibault

          Re: Ok, so...

          This is for those occasions when you spill the tray and have to put the program back together? If so, good thinking.

      2. Red Bren
        Trollface

        Re: Ok, so...

        If you cant write all your code on a single line, you're not trying hard enough. And don't give me that nonsense about making it easier to debug; you shouldn't be writing buggy code in the first place!!!

      3. Steve Davies 3 Silver badge

        Re: Ok, so...

        Ah, the memories of punched cards.

        Thanks.

    4. John Sager

      Re: Ok, so...

      My .indent.pro file says '-linux -i2'. 8-space indents are too wide for anything that has much in the way of block nesting. Now you could argue that deep block nesting is bad coding practice, and I tend to agree, but I still read (and sometimes hack on) existing code that had weird or no coding standards applied. As for spaces, my editor of choice (nedit) puts tabs in automatically after it gets to 8-space indent. I don't care. indent will prettify it and the compiler doesn't care.

    5. MJI Silver badge

      Re: Ok, so...

      My personal rules.

      The older system using text files was 2 spaces

      Current system with IDE a tab of 4 spaces

      Both are start at the left rather than indented, use mixed case for legibility

      And most importantly EVERYTHING IS COLUMNISED.

      If the := are not lined up there will be hell to pay.

    6. J.G.Harston Silver badge

      how wide should tabs be...?

      7 for the first column, then 8 for the next nine columns, then zero for each subsequent column (you know who you are).

  5. Denarius
    Thumb Up

    deep thought there

    However, to become an adult one still has to deal with the bullies who seem to have become HR or managers of the PHB kind. And worse, proud of their ignorance. My solution was to become somewhat literal minded. PHBs tend to feel control slipping when their words are taken at face value IMHO. Your mileage will vary.

    However, I disagree its just geeks who fight over trivia. The whole race does it, whether over some variation to barely understood words uttered millennia ago to the pronouncements from on high by newer priesthoods. Transhumanists, misotheists, economic rationalists and other feral utopians come to mind. In short, there are no adults.

    1. J.G.Harston Silver badge

      Re: deep thought there

      "The whole race does it, whether over some variation to barely understood words uttered millennia ago"

      Whole wars fought over a single speck of fly shit that changes "Jesus was born formed as a human" to "Jesus was born in the form of a human"

    2. Mark 85

      Re: deep thought there

      On trivia.. I note that the first 30 some comments are trivial... about Tabs vs. Spaces.

      I believe Trevor is dealing with his inner demons. We all have them. For many of us, we end up doing something useful like IT. There's the few that totally scary and end up as politicians.

  6. Geoff Campbell Silver badge
    Boffin

    Well, to a point...

    The basic analysis seems spot on, although I don't think there will be any awards handed out for deep new insights as a result.

    But if we change, what then? I'm good at what I do *precisely* because of the psychological damage inflicted in earlier life. Write me out of the script, or force me to change into some touchy-feely advocate of technical excellence by consensus vote, and all my hard-won and passingly valuable skills of in-depth analysis and abrasive truth-telling based on empirical evidence disappear.

    Let's face it, deep technical IT skills are pretty much diametrically opposed to good people skills. And you know what? I'm comfortable with that.

    GJC

    1. Anonymous Coward
      Anonymous Coward

      Re: Well, to a point...

      Let's face it, deep technical IT skills are pretty much diametrically opposed to good people skills. And you know what? I'm comfortable with that.

      It's not an either/or mix, they're opposite ends of the same slider. The higher you get up the org chart, the more the slider needs to move towards the "people" side, but if you have managers and beancounters heading the company rather than leaders you have the sort of cultural problem you get at old institutes.

      1. Terry 6 Silver badge

        Re: Well, to a point...

        Managers should have good people skills. Beancounters and technocrats get promoted to management jobs sometimes because they're good at their technical jobs, often because they are mildly better at people skills than the competition (and the suspicion at least is they're less good at the technical stuff - pointy haired boss).

    2. Anonymous Coward
      Anonymous Coward

      Re: Well, to a point...

      @GJC

      > deep technical IT skills are pretty much diametrically opposed to good people skills

      Not necessarily. A good junior programmer that we hired 14 years ago has just become the CEO.

      It's just that those of us who are some flavour of aspie the tech skills are a major part of our identity because - at least in my case - the people skills are pretty poor.

      But actually I enjoy working in a team - as long as it is a bunch of switched-on techies - and in that kind of environment one does get to respect team-mates for what they do well - even if differently from the way I'd prefer to do things.

      When it comes to non-techies I let my wife take the lead...

  7. Anonymous Coward
    Anonymous Coward

    fleventy-five?

    I see what you did there ... well played sir!

    But, tabs ... seriously?

  8. muddysteve

    Spaces

    I have used both (not in the same code, obviously), and I prefer spaces. Simply because if I use tabs and change editors, then the tabs are usually of a different length, and I don't like that. I like 3-space indentations.

Page:

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon