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. A Question of Style

A Question of Style

Scheduled Pinned Locked Moved The Lounge
question
67 Posts 29 Posters 63 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.
  • L lepipele

    VS.NET is the best IDE.

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

    Uuuuuhhhh... so? :confused:

    1 Reply Last reply
    0
    • L Luc Pattyn

      I've never really used LSE, I trust it does everything EDT did/does. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      I use ListBoxes for line-oriented text, and PictureBoxes for pictures, not drawings.


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

      Every time I've accidently gotten into it I've had to Ctrl-C out because I couldn't figure out the right way. :sigh:

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

        The backspace key. Spaces are great for non-modern and cross platform editors where the actual tab may not align correctly allowing properly formatted code to be the same in all editors. However, if you are exclusively using one editor it would be silly to not use tabs. There is nothing worse than having to hit the backspace key n-4 times.

        Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
        Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
        Most of this sig is for Google, not ego.

        N Offline
        N Offline
        Naruki 0
        wrote on last edited by
        #23

        Isn't that for people who make mistakes? ;P Another plus for spaces is that I use more than one tool for viewing code. When I am manually scanning documents in a folder, I use Total Commander's viewer for really quick perusal, but it doesn't support configurable tabs. But sometimes I am editing with an IDE. Other times with TextPad. And then I switch to my VirtualBox Ubuntu session and use whatever the hell I find on that thing. Forgetting other people (hey, what geek actually cares about others?), using spaces ensures my own accesses to a file are as consistent as possible.

        Don't let my name fool you. That's my job.

        1 Reply Last reply
        0
        • P PIEBALDconsult

          Every time I've accidently gotten into it I've had to Ctrl-C out because I couldn't figure out the right way. :sigh:

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #24

          Doh. Don't they offer their letter-sized binders full of fancy manuals anymore? :doh:

          Luc Pattyn [Forum Guidelines] [My Articles]


          I use ListBoxes for line-oriented text, and PictureBoxes for pictures, not drawings.


          P 1 Reply Last reply
          0
          • Richard Andrew x64R Richard Andrew x64

            What, if any, is the practical reason for preferring spaces over tabs? I use tabs because when I need to increase or decrease an indent, it's only a single character that must be added or deleted. I noticed that the Google Guidelines disallow tabs, and use only spaces. What have they got against tabs?

            P Offline
            P Offline
            peterchen
            wrote on last edited by
            #25

            so if you like to do the following: switch (foo) { case fooEasy: return 77; case fooVeryHardIndeed: return 88; default: return 11; } different tab settings screw you up royally. In other words, tabs at the beginning of the line are ok, tabs on the middle of the text are not, but such a rule would be to complicated :) Second, there is "movement through tabs". Moving the caret right over a tab - does it move one space, or one tab? I prefer the current "visualize as spaces" for consistency (another in-depth discussion). If you do that, tabs become mere space savers, which is pointless today.


            Burning Chrome ^ | Linkify!| FoldWithUs! | sighist

            P 1 Reply Last reply
            0
            • L Luc Pattyn

              Doh. Don't they offer their letter-sized binders full of fancy manuals anymore? :doh:

              Luc Pattyn [Forum Guidelines] [My Articles]


              I use ListBoxes for line-oriented text, and PictureBoxes for pictures, not drawings.


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

              I've downloaded a bunch of PDFs, LSE is part of DECset now (with CMS and MMS), so it's in there I expect. I didn't see one for EDT.

              1 Reply Last reply
              0
              • E Ennis Ray Lynch Jr

                The backspace key. Spaces are great for non-modern and cross platform editors where the actual tab may not align correctly allowing properly formatted code to be the same in all editors. However, if you are exclusively using one editor it would be silly to not use tabs. There is nothing worse than having to hit the backspace key n-4 times.

                Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
                Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
                Most of this sig is for Google, not ego.

                M Offline
                M Offline
                Mike Marynowski
                wrote on last edited by
                #27

                If you are using Visual Studio, you don't have to hit backspace multiple times...that's the beauty of shift+tab. You get the advantage of readable code in any editor, with the ease of formatting tabs.

                H 1 Reply Last reply
                0
                • P peterchen

                  so if you like to do the following: switch (foo) { case fooEasy: return 77; case fooVeryHardIndeed: return 88; default: return 11; } different tab settings screw you up royally. In other words, tabs at the beginning of the line are ok, tabs on the middle of the text are not, but such a rule would be to complicated :) Second, there is "movement through tabs". Moving the caret right over a tab - does it move one space, or one tab? I prefer the current "visualize as spaces" for consistency (another in-depth discussion). If you do that, tabs become mere space savers, which is pointless today.


                  Burning Chrome ^ | Linkify!| FoldWithUs! | sighist

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

                  I also recall helping a fellow student debug a COBOL program (1989, VAX/VMS, VT100), it turned out he had a TAB within some string data and couldn't figure why the system (I forget whether or not it was a run-time error) said it didn't have enough characters.

                  1 Reply Last reply
                  0
                  • E Ennis Ray Lynch Jr

                    The backspace key. Spaces are great for non-modern and cross platform editors where the actual tab may not align correctly allowing properly formatted code to be the same in all editors. However, if you are exclusively using one editor it would be silly to not use tabs. There is nothing worse than having to hit the backspace key n-4 times.

                    Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
                    Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
                    Most of this sig is for Google, not ego.

                    D Offline
                    D Offline
                    dmitri_sps
                    wrote on last edited by
                    #29

                    That is why there is a "Format Document" command (Under Edit | Advanced in VS, and in context menu in NetBeans) - so you can forget about spaces and tabs: do whatever you like to the source, than reformat entire file :-D And in multi-user environments (was Google mentioned?) spaces are the only common denominator between all editors' interpretations of what is a tab.

                    1 Reply Last reply
                    0
                    • Richard Andrew x64R Richard Andrew x64

                      What, if any, is the practical reason for preferring spaces over tabs? I use tabs because when I need to increase or decrease an indent, it's only a single character that must be added or deleted. I noticed that the Google Guidelines disallow tabs, and use only spaces. What have they got against tabs?

                      S Offline
                      S Offline
                      sashoalm
                      wrote on last edited by
                      #30

                      At first I used tabs, but then I switched to spaces because I had to write some tables (arrays of structs actually) inside a source file which had multiple columns and a lot of rows, and tabs just made that more difficult IMO.

                      There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition. Blaise Pascal

                      1 Reply Last reply
                      0
                      • Richard Andrew x64R Richard Andrew x64

                        What, if any, is the practical reason for preferring spaces over tabs? I use tabs because when I need to increase or decrease an indent, it's only a single character that must be added or deleted. I noticed that the Google Guidelines disallow tabs, and use only spaces. What have they got against tabs?

                        R Offline
                        R Offline
                        Roger Stoltz
                        wrote on last edited by
                        #31

                        If the decision is up to me I prefer tabs (and tab size 4). The reason is that in any decent editor it's possible to configure the tab size so everyone can view and edit the source code with their own preferred tab size. Most document viewers have the same possibility, e.g. the viewer and compare tool in ClearCase. Naturally, if I encounter source code I have to edit and the indentation is based on spaces, I continue to use spaces in order not to mess up the source code. At my current assignment the coding guidelines states that spaces should be used and the "indentation size" is 2(!) spaces. In my opinion that indentation size is too small and makes the source code hard to read and follow. However, I only use tabs for indentation and possibly preceding comments at the end of a line. In all other cases I use spaces.

                        "It's supposed to be hard, otherwise anybody could do it!" - selfquote
                        "High speed never compensates for wrong direction!" - unknown

                        F P 2 Replies Last reply
                        0
                        • L Lost User

                          Must admit, I prefer tabs, so I can indent 4 spaces, my colleague can indent 2 spaces - without changing source. All is well if using the same editor - but sometimes using notepad etc. stuffs up the tabs

                          If I knew then what I know today, then I'd know the same now as I did then - then what would be the point? .\\axxx (That's an 'M')

                          B Offline
                          B Offline
                          Brady Kelly
                          wrote on last edited by
                          #32

                          TheArtistFormallyKnownAsMaxxx wrote:

                          I can indent 4 spaces, my colleague can indent 2 spaces

                          Different indents in the same source? :~

                          All Sorted

                          R L 2 Replies Last reply
                          0
                          • B Brady Kelly

                            TheArtistFormallyKnownAsMaxxx wrote:

                            I can indent 4 spaces, my colleague can indent 2 spaces

                            Different indents in the same source? :~

                            All Sorted

                            R Offline
                            R Offline
                            Russell Jones
                            wrote on last edited by
                            #33

                            Yeah, because the editor interprets the tab to mean different things for different people. The underlying file consistently has 1 tab for an indent.

                            B 1 Reply Last reply
                            0
                            • R Russell Jones

                              Yeah, because the editor interprets the tab to mean different things for different people. The underlying file consistently has 1 tab for an indent.

                              B Offline
                              B Offline
                              Brady Kelly
                              wrote on last edited by
                              #34

                              :doh: I was thinking of tabs expanded to spaces.

                              All Sorted

                              1 Reply Last reply
                              0
                              • L Lost User

                                Take an anvil and a desert spoon. Place both in freezer overnight. Remove from freezer. Place one or more of your testicles on the anvil. Have a friend/colleague/significant other rap, sharply, on your testicle with the spoon. Still think

                                There is nothing worse than having to hit the backspace key n-4 times.

                                ?

                                If I knew then what I know today, then I'd know the same now as I did then - then what would be the point? .\\axxx (That's an 'M')

                                N Offline
                                N Offline
                                Naruki 0
                                wrote on last edited by
                                #35

                                I am pretty sure I don't want to party with you. ;-)

                                Don't let my name fool you. That's my job.

                                G 1 Reply Last reply
                                0
                                • P PIEBALDconsult

                                  Not this again :rolleyes: Ramblings in no particular order: Because Windows and WYSIWYG and such are new-tech. I began programming with a dumb terminal, and the tabs were set there (not in software), and that remains true when I use OpenVMS (except now I use a terminal emulator). I've opened too many files only to find the code misaligned because the last person to touch it used TABs. On Windows I mostly use Edit, which gives four SPACEs per tab. I generally avoid Notepad because it keeps the TABs (eight SPACEs wide X| ). Of course, as long as a file uses one or the other and not a mixture of both it should be OK, but it's easier to untabbify than to tabbify. With SPACEs you know what you're getting.

                                  J Offline
                                  J Offline
                                  jsc42
                                  wrote on last edited by
                                  #36

                                  I used to use 3 spaces for indenting when I worked with punched cards and paper tape. That way, you could still have reasonable levels of nesting within the 80 chars on a card. Now that I have disc files, I use the TAB key - it is only one key stroke (which saves on storage) and it does not matter so much if I exceed 80 chars per line. I even allow myself to reach the 80th column when writing comment lines - in the punch card days, cols 73 to 80 were saved for sequence numbers so you could resort your deck after dropping them; I even (shock horror) allow in-line comments to slightly break the 80 column rule; if more than slightly, the comment goes on its own line with the code underneath. To preserve visual formatting regardless of how different editors display TAB, I use TAB for indenting but then I use spaces inside the code / comments after the first non-TAB character. This keeps tables / type declarations etc lined up.

                                  P 1 Reply Last reply
                                  0
                                  • N Naruki 0

                                    I am pretty sure I don't want to party with you. ;-)

                                    Don't let my name fool you. That's my job.

                                    G Offline
                                    G Offline
                                    Gary Wheeler
                                    wrote on last edited by
                                    #37

                                    Given that he's into testicles and anvils, probably not.

                                    Software Zen: delete this;

                                    L 1 Reply Last reply
                                    0
                                    • M Mike Marynowski

                                      If you are using Visual Studio, you don't have to hit backspace multiple times...that's the beauty of shift+tab. You get the advantage of readable code in any editor, with the ease of formatting tabs.

                                      H Offline
                                      H Offline
                                      Henry Minute
                                      wrote on last edited by
                                      #38

                                      Mike Marynowski wrote:

                                      that's the beauty of shift+tab

                                      The problem is, at least at first, remembering the shift part, the thing can end up looking like a dogs breakfast if you are a non-touch typist.

                                      Henry Minute If you open a can of worms, any viable solution *MUST* involve a larger can.

                                      P 1 Reply Last reply
                                      0
                                      • Richard Andrew x64R Richard Andrew x64

                                        What, if any, is the practical reason for preferring spaces over tabs? I use tabs because when I need to increase or decrease an indent, it's only a single character that must be added or deleted. I noticed that the Google Guidelines disallow tabs, and use only spaces. What have they got against tabs?

                                        P Offline
                                        P Offline
                                        Peter Mulholland
                                        wrote on last edited by
                                        #39

                                        I used to be a tab fan, cause of the one backspace instead of 4. But over the last few years i've opened too many code files that have been edited by several people. Even when there's a 'standard' within a team to use 4 spaces or use tabs or whatever, some people insist on being different. If you can get everyone using spaces then there's a better chance that your indentation will stay aligned after several people have edited the same code. IMHO

                                        Pete If minds had anuses, blogging would be what your mind would do when it had to take a dump Maddox

                                        P 1 Reply Last reply
                                        0
                                        • P PIEBALDconsult

                                          After all the years of having to press the SPACE bar four times, having the editor insert four SPACEs for a TAB is a vast relief; having to press DELETE four times is not that big a deal.

                                          Ennis Ray Lynch, Jr. wrote:

                                          non-modern and cross platform editors

                                          That's what I use primarily.

                                          A Offline
                                          A Offline
                                          aquatarian
                                          wrote on last edited by
                                          #40

                                          When I'm not writing in a .NET language I use a cross platform editor too, Vim. It has a "modeline" feature where you can put a special line in (beginning with your language's comment char) that specifies the tab stop

                                          :: Windows batch/cmd script example, typically the last line in a file
                                          :: shiftwidth specifies the width of auto-indenting
                                          :: vim:tabstop=4:shiftwidth=4:noexpandtab

                                          # Perl example

                                          vim:tabstop=4:shiftwidth=4:noexpandtab

                                          Another popular cross platform editor (probably friendlier than Vim for a VS user), emacs, has a substantially similar capability though I personally do not know its syntax. Happily, vim also has the "retab" command so if someone sends me a file indented with spaces I can typically fix that in an instant :-\ Vin also has all number of features for auto expanding tabs with spaces, making the backspace key delete n number of spaces, etc... (and I'm reasonably confident that emacs mirrors this capability) so my main point is people should use whatever they want and fix the indenting to the project's code formatting rules before commit. Let your editor empower you! Hopefully someday I will figure out how to embed vim into VS which it can supposedly do.:cool:

                                          P E 2 Replies 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