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. Other Discussions
  3. The Insider News
  4. Tabs versus spaces: Spaces won

Tabs versus spaces: Spaces won

Scheduled Pinned Locked Moved The Insider News
csharpvisual-studiocomquestion
27 Posts 10 Posters 0 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.
  • M MarqW

    I hate all the defaults of tabs space of 4 and 8... I mean 8!? Come on, you're half way across the screen. 2 is the magic number :-D

    C Offline
    C Offline
    Clifford Nelson
    wrote on last edited by
    #8

    I also vote for 2 spaces. Fortunately do not have to deal with people who insist on 4 or 8. I am surprised how many of the good developers I know agree with 2.

    J 1 Reply Last reply
    0
    • P PIEBALDconsult

      OK, now look at your code in Notepad. Not everyone uses an IDE.

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #9

      PIEBALDconsult wrote:

      OK, now look at your code in Notepad.
       
      Not everyone uses an IDE.

      Are you suggesting that programmers that don't use IDEs use Notepad? Certainly isn't the case for me. Certainly isn't the case for other developers that I know that don't use IDEs.

      P 1 Reply Last reply
      0
      • C Clifford Nelson

        I also vote for 2 spaces. Fortunately do not have to deal with people who insist on 4 or 8. I am surprised how many of the good developers I know agree with 2.

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #10

        Clifford Nelson wrote:

        I am surprised how many of the good developers I know agree with 2.

        However presumably those "good" developers spend the vast majority of time discussing a vast array of subjects of all which have nothing to do with indent preferences.

        C 1 Reply Last reply
        0
        • J jschell

          Clifford Nelson wrote:

          I am surprised how many of the good developers I know agree with 2.

          However presumably those "good" developers spend the vast majority of time discussing a vast array of subjects of all which have nothing to do with indent preferences.

          C Offline
          C Offline
          Clifford Nelson
          wrote on last edited by
          #11

          Actually they have no reason to worry about that since that is a personal preference. Probably the best developer on my team was adamant about using tabs instead of spaces. Then he can use whatever he wants, and does not care what other developers are using.

          L 1 Reply Last reply
          0
          • P PIEBALDconsult

            The only place I worked that had an actual standard, the standard was four SPACEs, so I got used to that. Where I am now, all the existing code uses two SPACEs, so I adapted. Now my four SPACE indents look huge. :sigh:

            C Offline
            C Offline
            Clifford Nelson
            wrote on last edited by
            #12

            Agreed

            1 Reply Last reply
            0
            • P PIEBALDconsult

              OK, now look at your code in Notepad. Not everyone uses an IDE.

              R Offline
              R Offline
              R Giskard Reventlov
              wrote on last edited by
              #13

              PIEBALDconsult wrote:

              Not everyone uses an IDE.

              Amateurs. Seriously? Creating complex, feature rich applications/web sites with notepad? Not practical. Perhaps with something like Notepad++ but Windows Notepad? No, definitely not.

              "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me

              P A 2 Replies Last reply
              0
              • M MarqW

                I hate all the defaults of tabs space of 4 and 8... I mean 8!? Come on, you're half way across the screen. 2 is the magic number :-D

                L Offline
                L Offline
                Lutoslaw
                wrote on last edited by
                #14

                Maybe 2 is magic, but 3 is more Freudy. Seriously, I got used to 4 which is often a default setting. But 8 looks ridiculus to me too.

                Greetings - Jacek

                1 Reply Last reply
                0
                • J jschell

                  PIEBALDconsult wrote:

                  OK, now look at your code in Notepad.
                   
                  Not everyone uses an IDE.

                  Are you suggesting that programmers that don't use IDEs use Notepad? Certainly isn't the case for me. Certainly isn't the case for other developers that I know that don't use IDEs.

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #15

                  That is two separate statements.

                  1 Reply Last reply
                  0
                  • C Clifford Nelson

                    Actually they have no reason to worry about that since that is a personal preference. Probably the best developer on my team was adamant about using tabs instead of spaces. Then he can use whatever he wants, and does not care what other developers are using.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #16

                    So what happens whenshe edits your code, or you edit his?

                    MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

                    C 1 Reply Last reply
                    0
                    • R R Giskard Reventlov

                      PIEBALDconsult wrote:

                      Not everyone uses an IDE.

                      Amateurs. Seriously? Creating complex, feature rich applications/web sites with notepad? Not practical. Perhaps with something like Notepad++ but Windows Notepad? No, definitely not.

                      "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #17

                      mark merrens wrote:

                      Amateurs.

                      Contrarywise; newbies use IDEs and don't realize that there are other ways. Experienced developers know that there are several ways to skin most cats.

                      mark merrens wrote:

                      Creating complex, feature rich applications/web sites with notepad?

                      I didn't say that.

                      1 Reply Last reply
                      0
                      • T Terrence Dorsey

                        Tabs versus spaces: Spaces won[^] (source: Los Techies)
                        Why? Because since at least Visual Studio 2005, the default has been spaces.

                        "Do you like tabs in Visual Studio? I do too! But I gave up the tabs versus spaces argument, and so should you."

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #18

                        Gawd! All these 'should it be 2 spaces or 4' arguments can be done away with by using tabs-then you decide how wide you want a tab to be when you are editing, while your colleague can use a different value - everyone is happy!

                        MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

                        P 1 Reply Last reply
                        0
                        • R R Giskard Reventlov

                          PIEBALDconsult wrote:

                          Not everyone uses an IDE.

                          Amateurs. Seriously? Creating complex, feature rich applications/web sites with notepad? Not practical. Perhaps with something like Notepad++ but Windows Notepad? No, definitely not.

                          "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me

                          A Offline
                          A Offline
                          AspDotNetDev
                          wrote on last edited by
                          #19

                          We at my company often use the web editor in Umbraco to edit pages. It works best with spaces. Because of editors like this, much of the rest of our code follows that same convention so we don't have to switch things up.

                          Thou mewling ill-breeding pignut!

                          1 Reply Last reply
                          0
                          • L Lost User

                            So what happens whenshe edits your code, or you edit his?

                            MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

                            C Offline
                            C Offline
                            Clifford Nelson
                            wrote on last edited by
                            #20

                            That is the reason for going with tabs. If spaces are used, then the number of spaces specified will appear for everyone no matter what the user sets his tab spacing. When the person does editing with tabs as an option, then there will be a mixture of tabs and spaces, and it will look different on applications with different settings. When a person does editing with a different tab setting with spaces, then still have the problem. With tabs set for everyone, then each person can have what they like, and it will appear correct on thier screen. Thats why there is an issue that this forum was discussing. Set Option for Text Editor for C# to "Keep Tabs" and then each developer can have whatever indent size they like, and everybody is happy.

                            P L 2 Replies Last reply
                            0
                            • C Clifford Nelson

                              That is the reason for going with tabs. If spaces are used, then the number of spaces specified will appear for everyone no matter what the user sets his tab spacing. When the person does editing with tabs as an option, then there will be a mixture of tabs and spaces, and it will look different on applications with different settings. When a person does editing with a different tab setting with spaces, then still have the problem. With tabs set for everyone, then each person can have what they like, and it will appear correct on thier screen. Thats why there is an issue that this forum was discussing. Set Option for Text Editor for C# to "Keep Tabs" and then each developer can have whatever indent size they like, and everybody is happy.

                              P Offline
                              P Offline
                              PIEBALDconsult
                              wrote on last edited by
                              #21

                              Clifford Nelson wrote:

                              each developer can have whatever indent size they like

                              That depends on the tool. SPACEs are always consistent.

                              L C 2 Replies Last reply
                              0
                              • C Clifford Nelson

                                That is the reason for going with tabs. If spaces are used, then the number of spaces specified will appear for everyone no matter what the user sets his tab spacing. When the person does editing with tabs as an option, then there will be a mixture of tabs and spaces, and it will look different on applications with different settings. When a person does editing with a different tab setting with spaces, then still have the problem. With tabs set for everyone, then each person can have what they like, and it will appear correct on thier screen. Thats why there is an issue that this forum was discussing. Set Option for Text Editor for C# to "Keep Tabs" and then each developer can have whatever indent size they like, and everybody is happy.

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #22

                                Egg-sactly

                                MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

                                C 1 Reply Last reply
                                0
                                • L Lost User

                                  Gawd! All these 'should it be 2 spaces or 4' arguments can be done away with by using tabs-then you decide how wide you want a tab to be when you are editing, while your colleague can use a different value - everyone is happy!

                                  MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

                                  P Offline
                                  P Offline
                                  PIEBALDconsult
                                  wrote on last edited by
                                  #23

                                  _Maxxx_ wrote:

                                  you decide how wide you want a tab to be when you are editing

                                  That depends on the tool. Have you tried setting the tabs on a VT100 or emulator? There are historical reasons for using SPACEs. If you insist on TABs you'd better hope to never encounter code from last century.

                                  L 1 Reply Last reply
                                  0
                                  • P PIEBALDconsult

                                    _Maxxx_ wrote:

                                    you decide how wide you want a tab to be when you are editing

                                    That depends on the tool. Have you tried setting the tabs on a VT100 or emulator? There are historical reasons for using SPACEs. If you insist on TABs you'd better hope to never encounter code from last century.

                                    L Offline
                                    L Offline
                                    Lost User
                                    wrote on last edited by
                                    #24

                                    PIEBALDconsult wrote:

                                    That depends on the tool.

                                    Yes, it does. And if you are using stone age tools, then sure, your particular standards will vary (6 character variable names, all upper case etc.) but we're talking standards here, not archaeology.

                                    PIEBALDconsult wrote:

                                    Have you tried setting the tabs on a VT100

                                    yes, I have. not for a long time, but yes, I have.

                                    PIEBALDconsult wrote:

                                    here are historical reasons for using SPACEs.

                                    Again, yes there are, and if your shop needs to edit code using tools that can't display tabs, then obviously your standards should be not to use tabs. if you're shop uses black and white (or black and green, or even black and amber) text monitors, then you better not be using any sort of colorisation either.

                                    PIEBALDconsult wrote:

                                    If you insist on TABs you'd better hope to never encounter code from last century.

                                    why? If I need to edit code that does not allow the use of tabs, then standards are a rather moot point! If it is code that didn't use tabs when it was written well, I have a choice - live with it or convert to tabs (there's a rather neat VS tool that will do it for you) in short, there are advantages to using tabs (personal preference of layout is easy to achieve with minimal effort, less keytrokes) that, I think, make it an obvious standard, unless in an individual's circumstance it is not possible (e.g. you need to edit the code using vi) in which case it is not possible to use the superior method.

                                    MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

                                    1 Reply Last reply
                                    0
                                    • P PIEBALDconsult

                                      Clifford Nelson wrote:

                                      each developer can have whatever indent size they like

                                      That depends on the tool. SPACEs are always consistent.

                                      L Offline
                                      L Offline
                                      Lost User
                                      wrote on last edited by
                                      #25

                                      not with a proportional font...

                                      MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

                                      1 Reply Last reply
                                      0
                                      • L Lost User

                                        Egg-sactly

                                        MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

                                        C Offline
                                        C Offline
                                        Clifford Nelson
                                        wrote on last edited by
                                        #26

                                        Tabs win where people pay attention. Very easy to convince people to go with tabs. Should be the default.

                                        1 Reply Last reply
                                        0
                                        • P PIEBALDconsult

                                          Clifford Nelson wrote:

                                          each developer can have whatever indent size they like

                                          That depends on the tool. SPACEs are always consistent.

                                          C Offline
                                          C Offline
                                          Clifford Nelson
                                          wrote on last edited by
                                          #27

                                          My groups have had problems when spaces are selected and people have different indent settings. Then you get a real mix of indents which have to be fixed by cntl-K cntl-D. Just go with tabs/

                                          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