Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Keep tabs as tabs or tabs as spaces

Keep tabs as tabs or tabs as spaces

Scheduled Pinned Locked Moved The Lounge
question
48 Posts 35 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Rob Philpott

    You know what I mean - you can have it so that a tab is a tab, and backspace removes it - or you can have it as usually 4 spaces so one tab takes four backspace hits to remove it. I like the first way and despise the second (it offends my need for symmetry), but seem to be alone in this in my current place of work. Or worse yet - "does it matter?" Please reassure me I'm in the right really....

    Regards, Rob Philpott.

    R Offline
    R Offline
    RobEpworth
    wrote on last edited by
    #41

    It matters big time... Anyone using Source Control needs to consider the implications, in particular when working on multi-developer projects. Source Control (most of them) only store the delta (changes) of the code. Now this setting is a personal preference, so each IDE can set not only how many spaces = 1 tab, but also if it should convert one to the other. (how it handles quoted strings is another story) As devs checkout code, don't like the formatting, change it, and check it back in. You end up with source deltas that contain nothing but tab to space and space to tab conversions - and possibly 1 or 2 real code changes. (and it all has to be stored somewhere) This becomes more problematical when it comes to merging code branches. Tab/Space conversions often upset the offsets used in deltas which results in a merge requiring manual intervention to correct conflicts. I don't care which one you use individually, but if you're working on a group project EVERYONE needs to be using the same settings.

    1 Reply Last reply
    0
    • J Joan M

      Let's be grateful for the first programmer that made an app to convert tabs to spaces and vice-versa... :rolleyes: I prefer tabs. :thumbsup:

      [www.tamelectromecanica.com] Robots, CNC and PLC machines for grinding and polishing.

      G Offline
      G Offline
      Gary Huck
      wrote on last edited by
      #42

      Indeed. Obviously, a personal preference. 'tis what global search/replace is for. Me, I prefer 2 spaces but who cares? 'pretty easy to replace all tabs with such, then the next s/he can do the same.

      W 1 Reply Last reply
      0
      • E Ennis Ray Lynch Jr

        It is the efficient vs. the lazy in this argument. Most people are too lazy to change the flow. VS defaults to spaces so why change it. Watch the people who are in favor of coding with spaces actually code. Watch how slow they (usually) work. I am a tab man. All of my code is used only on Windows. I don't have to deal with using Unix and Windows for the same code base and I can type. Yes it matters. There is nothing worse than having to break away from the keyboard to use the mouse.

        Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

        G Offline
        G Offline
        Gary Huck
        wrote on last edited by
        #43

        Really?! We [space-people] work slow because we may hit the space bar twice sometimes? (the IDE usually does the "work" by the way). Careful with your assessment - we're not lazy!

        1 Reply Last reply
        0
        • R Rob Philpott

          You know what I mean - you can have it so that a tab is a tab, and backspace removes it - or you can have it as usually 4 spaces so one tab takes four backspace hits to remove it. I like the first way and despise the second (it offends my need for symmetry), but seem to be alone in this in my current place of work. Or worse yet - "does it matter?" Please reassure me I'm in the right really....

          Regards, Rob Philpott.

          G Offline
          G Offline
          ghle
          wrote on last edited by
          #44

          If you use spaces instead of tabs, you NEVER have a problem. Deleting spaces? WHY? That would only be necessary if you screwed up your code in the first place. Write cleaner code first time around. :) I'm modifying code in 25-year-old DB language. The original coder didn't use tabs or spaces. Now that sucks! (no comments, either)

          Gary

          1 Reply Last reply
          0
          • G Gary Wheeler

            No, because Visual Studio (at least as recently as VS2008), still does not handle tabs correctly, especially when block indenting a selection.

            Software Zen: delete this;

            G Offline
            G Offline
            ghle
            wrote on last edited by
            #45

            Upped your 2-vote. I guess someone doesn't like you identifying things that don't work in their favorite IDE. :thumbsup:

            Gary

            1 Reply Last reply
            0
            • E Ennis Ray Lynch Jr

              It is the efficient vs. the lazy in this argument. Most people are too lazy to change the flow. VS defaults to spaces so why change it. Watch the people who are in favor of coding with spaces actually code. Watch how slow they (usually) work. I am a tab man. All of my code is used only on Windows. I don't have to deal with using Unix and Windows for the same code base and I can type. Yes it matters. There is nothing worse than having to break away from the keyboard to use the mouse.

              Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

              Y Offline
              Y Offline
              YSLGuru
              wrote on last edited by
              #46

              @Ennis Sorry to bust your bubble but I use SPACES and I can wipe the floor (in terms of speed) of any of my co-workers who prefer using tabs. There are PROS & CONS to using TABS or SPACES and we could all argue whcih is better all day. What is important is that you are consistent in which you use within a project and that you note in your code that you use HARD TABS only or all spaces. That way anyone who has to revise your code knows what to expect. I routinely have to cleanup poorly constructed T-SQL (the SQL Server flavor of SQL) done by procedural programmers with no real RDBMS/SQL training/knowledge and the use of tabs in their code is a nightmare. I use UEStudio, the big brother of UltraEdit, to swap out all tabs with spaces in a single command; a big time saver. So in the end its really a matter of prefernece and specifc scenario and programmer as to whcih is really better no matter how hard one argues for all SPACES or all TABS.

              1 Reply Last reply
              0
              • R Rob Philpott

                You know what I mean - you can have it so that a tab is a tab, and backspace removes it - or you can have it as usually 4 spaces so one tab takes four backspace hits to remove it. I like the first way and despise the second (it offends my need for symmetry), but seem to be alone in this in my current place of work. Or worse yet - "does it matter?" Please reassure me I'm in the right really....

                Regards, Rob Philpott.

                Y Offline
                Y Offline
                YSLGuru
                wrote on last edited by
                #47

                FYI - For those making teh case against using spaces because of the time it takes to backspace over tabs verses SPACES, your argument is weak at best. There are cases (scenario/project specific) for using TABS instead of SPACES however the argment of "takes too long to back space over" is not even close to one. If you use just your keyboard and have a hands off the mouse approach you can quickly and easily highlight multiple spaces with a few keyboard clicks depending on the app your using. If you can't do this then either the ditor you are using is carp and you need to switch or your working on code created by one of the TAB Nazi's and there's not much you can do but bare through it and fix their junk. A TAB NAZI is someone who over -uses tabs to the point of being an extremeist. Tabs and or multiple SPACES for indentation are meant for aligning code and make the code more legiable. Some developers let tabs get out of controal and indent their code WAYYYYYYYYY to far. If you are indenting your code with tabs by more then 4 spaces on the max end then you are over killing it. Anyone who can;t see indented code using 4 spaces needs to get their eyes checked. I have glasses and can easily see indentation with just 2 spaces (or 1 TAB set to 2 spaces). Don't be a TAB Nazi!

                1 Reply Last reply
                0
                • G Gary Huck

                  Indeed. Obviously, a personal preference. 'tis what global search/replace is for. Me, I prefer 2 spaces but who cares? 'pretty easy to replace all tabs with such, then the next s/he can do the same.

                  W Offline
                  W Offline
                  W Balboos GHB
                  wrote on last edited by
                  #48

                  I, too, set the indent for 2 spaces. Four spaces, or eight? Shows a lack of depth-of-thought. Low expectations. These (evil) tab users get their comeuppance when their spacing turns into trash in a new environment.

                  "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                  "As far as we know, our computer has never had an undetected error." - Weisert

                  "If you are searching for perfection in others, then you seek dissappointment. If you are searching for perfection in yourself, then you seek failure." - Balboos HaGadol Mar 2010

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups