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. Code - White Space Survey

Code - White Space Survey

Scheduled Pinned Locked Moved The Lounge
question
47 Posts 20 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.
  • K Kevin McFarlane

    Which style do you use/prefer? 1. if(a==b) 2. if(a == b) 3. if (a==b) 4. if (a == b) I use/prefer 4. But I notice (to my dismay) that 1, 2 and 3 are very common. However, they're not the worst programming sins, i.e., I wouldn't fail a candidate because of them. 1. doIt(a,b,c) 2. doIt(a, b, c) 3. doIt( a, b, c ) 4. doIt (a,b,c) 5. doIt (a, b, c) I use 2, but would prefer to use 5. I don't do so because it's too irregular, whereas 2 is in widespread use and adequately readable. If I were programming in Eiffel I would adopt 5 because, in its context, it's widely used and is the "house style." I used 3 for a while but abandoned it for similar reasons to 5. Kevin

    M Offline
    M Offline
    Member 96
    wrote on last edited by
    #3

    In a project with as many lines of code as mine, extra whitespace probably slows down the build, load, backup and copy etc etc. I say #1 for anything more serious than a hobbyist.


    "Hello, hello, what's all this shouting, we'll have no trouble here! This is a Local Shop for Local People, there's nothing for you here!" -Edward Tattsyrup

    J R K M G 5 Replies Last reply
    0
    • K Kevin McFarlane

      Which style do you use/prefer? 1. if(a==b) 2. if(a == b) 3. if (a==b) 4. if (a == b) I use/prefer 4. But I notice (to my dismay) that 1, 2 and 3 are very common. However, they're not the worst programming sins, i.e., I wouldn't fail a candidate because of them. 1. doIt(a,b,c) 2. doIt(a, b, c) 3. doIt( a, b, c ) 4. doIt (a,b,c) 5. doIt (a, b, c) I use 2, but would prefer to use 5. I don't do so because it's too irregular, whereas 2 is in widespread use and adequately readable. If I were programming in Eiffel I would adopt 5 because, in its context, it's widely used and is the "house style." I used 3 for a while but abandoned it for similar reasons to 5. Kevin

      R Offline
      R Offline
      Robert Rohde
      wrote on last edited by
      #4

      4. and 2. In my opionon the extra space in 5. doesn't enhance readability. There already is an opening bracket which seperates the function name from the arguments.

      J K 2 Replies Last reply
      0
      • M Member 96

        In a project with as many lines of code as mine, extra whitespace probably slows down the build, load, backup and copy etc etc. I say #1 for anything more serious than a hobbyist.


        "Hello, hello, what's all this shouting, we'll have no trouble here! This is a Local Shop for Local People, there's nothing for you here!" -Edward Tattsyrup

        J Offline
        J Offline
        Jorgen Sigvardsson
        wrote on last edited by
        #5

        With that many lines of code, all the more reasons to make it readable, don't you think? Taking care of one whitespace during compilation is a matter of microseconds, if not nanoseconds. Surely, you'd allow an extra couple of seconds extra per milion lines of code when compiling..?
        -- Pictures[^] from my Japan trip.

        M 1 Reply Last reply
        0
        • R Robert Rohde

          4. and 2. In my opionon the extra space in 5. doesn't enhance readability. There already is an opening bracket which seperates the function name from the arguments.

          J Offline
          J Offline
          Jorgen Sigvardsson
          wrote on last edited by
          #6

          Robert Rohde wrote:

          There already is an opening bracket which seperates the function name from the arguments.

          It's the same case with ifs, is it not?
          -- Pictures[^] from my Japan trip.

          R 1 Reply Last reply
          0
          • M Member 96

            In a project with as many lines of code as mine, extra whitespace probably slows down the build, load, backup and copy etc etc. I say #1 for anything more serious than a hobbyist.


            "Hello, hello, what's all this shouting, we'll have no trouble here! This is a Local Shop for Local People, there's nothing for you here!" -Edward Tattsyrup

            R Offline
            R Offline
            Robert Rohde
            wrote on last edited by
            #7

            Is this some kind of joke Im not getting? Please tell me you are not serious with that... :~

            M 1 Reply Last reply
            0
            • K Kevin McFarlane

              Which style do you use/prefer? 1. if(a==b) 2. if(a == b) 3. if (a==b) 4. if (a == b) I use/prefer 4. But I notice (to my dismay) that 1, 2 and 3 are very common. However, they're not the worst programming sins, i.e., I wouldn't fail a candidate because of them. 1. doIt(a,b,c) 2. doIt(a, b, c) 3. doIt( a, b, c ) 4. doIt (a,b,c) 5. doIt (a, b, c) I use 2, but would prefer to use 5. I don't do so because it's too irregular, whereas 2 is in widespread use and adequately readable. If I were programming in Eiffel I would adopt 5 because, in its context, it's widely used and is the "house style." I used 3 for a while but abandoned it for similar reasons to 5. Kevin

              J Offline
              J Offline
              Jorgen Sigvardsson
              wrote on last edited by
              #8

              2 and 2. Mainly because that's how I've always done it, and I see no reasons to change my coding style. I've never heard of people complaining about it [edit], until now[/edit]. Especially after the invention of syntax highlighting editors.
              -- Pictures[^] from my Japan trip. -- modified at 11:50 Saturday 17th December, 2005

              K 1 Reply Last reply
              0
              • M Member 96

                In a project with as many lines of code as mine, extra whitespace probably slows down the build, load, backup and copy etc etc. I say #1 for anything more serious than a hobbyist.


                "Hello, hello, what's all this shouting, we'll have no trouble here! This is a Local Shop for Local People, there's nothing for you here!" -Edward Tattsyrup

                K Offline
                K Offline
                Kevin McFarlane
                wrote on last edited by
                #9

                I think 1. is the worst of the lot. Kevin

                1 Reply Last reply
                0
                • R Robert Rohde

                  4. and 2. In my opionon the extra space in 5. doesn't enhance readability. There already is an opening bracket which seperates the function name from the arguments.

                  K Offline
                  K Offline
                  Kevin McFarlane
                  wrote on last edited by
                  #10

                  Robert Rohde wrote:

                  5. doesn't enhance readability.

                  I think it does slightly. But it's not a big deal. Kevin

                  1 Reply Last reply
                  0
                  • J Jorgen Sigvardsson

                    Robert Rohde wrote:

                    There already is an opening bracket which seperates the function name from the arguments.

                    It's the same case with ifs, is it not?
                    -- Pictures[^] from my Japan trip.

                    R Offline
                    R Offline
                    Robert Rohde
                    wrote on last edited by
                    #11

                    Got me! When using ifs I would also always put a whitespace in between. :) I think it's really a matter of personal taste.

                    1 Reply Last reply
                    0
                    • J Jorgen Sigvardsson

                      2 and 2. Mainly because that's how I've always done it, and I see no reasons to change my coding style. I've never heard of people complaining about it [edit], until now[/edit]. Especially after the invention of syntax highlighting editors.
                      -- Pictures[^] from my Japan trip. -- modified at 11:50 Saturday 17th December, 2005

                      K Offline
                      K Offline
                      Kevin McFarlane
                      wrote on last edited by
                      #12

                      I can live with that. [smile] At least it's not 1 and 1, which are the worst IMO. Kevin

                      1 Reply Last reply
                      0
                      • K Kevin McFarlane

                        Which style do you use/prefer? 1. if(a==b) 2. if(a == b) 3. if (a==b) 4. if (a == b) I use/prefer 4. But I notice (to my dismay) that 1, 2 and 3 are very common. However, they're not the worst programming sins, i.e., I wouldn't fail a candidate because of them. 1. doIt(a,b,c) 2. doIt(a, b, c) 3. doIt( a, b, c ) 4. doIt (a,b,c) 5. doIt (a, b, c) I use 2, but would prefer to use 5. I don't do so because it's too irregular, whereas 2 is in widespread use and adequately readable. If I were programming in Eiffel I would adopt 5 because, in its context, it's widely used and is the "house style." I used 3 for a while but abandoned it for similar reasons to 5. Kevin

                        S Offline
                        S Offline
                        Shog9 0
                        wrote on last edited by
                        #13

                        3 or 4 (no big preference) 1 or 2 (depending on length and complexity of arguments) The only thing i really care about is that [if|for|while] always are followed by a space. They're not functions, and shouldn't look like function calls. Similarly, function names should never be followed by a space - i want to recognize it as a function call immediately.

                        ---- Scripts i've known... CPhog 0.9.9 - make CP better. Forum Bookmark 0.2.1 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums

                        G 1 Reply Last reply
                        0
                        • K Kevin McFarlane

                          Which style do you use/prefer? 1. if(a==b) 2. if(a == b) 3. if (a==b) 4. if (a == b) I use/prefer 4. But I notice (to my dismay) that 1, 2 and 3 are very common. However, they're not the worst programming sins, i.e., I wouldn't fail a candidate because of them. 1. doIt(a,b,c) 2. doIt(a, b, c) 3. doIt( a, b, c ) 4. doIt (a,b,c) 5. doIt (a, b, c) I use 2, but would prefer to use 5. I don't do so because it's too irregular, whereas 2 is in widespread use and adequately readable. If I were programming in Eiffel I would adopt 5 because, in its context, it's widely used and is the "house style." I used 3 for a while but abandoned it for similar reasons to 5. Kevin

                          P Offline
                          P Offline
                          Paul Conrad
                          wrote on last edited by
                          #14

                          Kevin McFarlane wrote:

                          Which style do you use/prefer?

                          I like to use and do prefer #4. Also, #2 or #3 for functions and their parameters. PC

                          1 Reply Last reply
                          0
                          • K Kevin McFarlane

                            Which style do you use/prefer? 1. if(a==b) 2. if(a == b) 3. if (a==b) 4. if (a == b) I use/prefer 4. But I notice (to my dismay) that 1, 2 and 3 are very common. However, they're not the worst programming sins, i.e., I wouldn't fail a candidate because of them. 1. doIt(a,b,c) 2. doIt(a, b, c) 3. doIt( a, b, c ) 4. doIt (a,b,c) 5. doIt (a, b, c) I use 2, but would prefer to use 5. I don't do so because it's too irregular, whereas 2 is in widespread use and adequately readable. If I were programming in Eiffel I would adopt 5 because, in its context, it's widely used and is the "house style." I used 3 for a while but abandoned it for similar reasons to 5. Kevin

                            R Offline
                            R Offline
                            Ray Cassick
                            wrote on last edited by
                            #15

                            2 on both counts.


                            George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things." Jörgen Sigvardsson wrote: If the physicists find a universal theory describing the laws of universe, I'm sure the asshole constant will be an integral part of that theory.
                            My Blog[^]


                            1 Reply Last reply
                            0
                            • K Kevin McFarlane

                              Which style do you use/prefer? 1. if(a==b) 2. if(a == b) 3. if (a==b) 4. if (a == b) I use/prefer 4. But I notice (to my dismay) that 1, 2 and 3 are very common. However, they're not the worst programming sins, i.e., I wouldn't fail a candidate because of them. 1. doIt(a,b,c) 2. doIt(a, b, c) 3. doIt( a, b, c ) 4. doIt (a,b,c) 5. doIt (a, b, c) I use 2, but would prefer to use 5. I don't do so because it's too irregular, whereas 2 is in widespread use and adequately readable. If I were programming in Eiffel I would adopt 5 because, in its context, it's widely used and is the "house style." I used 3 for a while but abandoned it for similar reasons to 5. Kevin

                              N Offline
                              N Offline
                              Nemanja Trifunovic
                              wrote on last edited by
                              #16

                              4 and 2


                              My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.

                              K 1 Reply Last reply
                              0
                              • M Member 96

                                In a project with as many lines of code as mine, extra whitespace probably slows down the build, load, backup and copy etc etc. I say #1 for anything more serious than a hobbyist.


                                "Hello, hello, what's all this shouting, we'll have no trouble here! This is a Local Shop for Local People, there's nothing for you here!" -Edward Tattsyrup

                                M Offline
                                M Offline
                                Marc Clifton
                                wrote on last edited by
                                #17

                                Oh great, now every VB programmer out there is going to read your post and take you seriously. :rolleyes: Marc VS2005 Tips & Tricks -- contributions welcome!

                                M 1 Reply Last reply
                                0
                                • M Mircea Grelus

                                  Same here. 4 for the first, 2 for second. regards, Mircea Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.

                                  J Offline
                                  J Offline
                                  Jim A Johnson
                                  wrote on last edited by
                                  #18

                                  4 and 2 here 2

                                  1 Reply Last reply
                                  0
                                  • J Jorgen Sigvardsson

                                    With that many lines of code, all the more reasons to make it readable, don't you think? Taking care of one whitespace during compilation is a matter of microseconds, if not nanoseconds. Surely, you'd allow an extra couple of seconds extra per milion lines of code when compiling..?
                                    -- Pictures[^] from my Japan trip.

                                    M Offline
                                    M Offline
                                    Member 96
                                    wrote on last edited by
                                    #19

                                    It would be an interesting test to find out, maybe some sort of macro in vs that can get rid of any possible unnecessary whitespace and compare side by side. I comment liberally, but when you're looking at a huge screen full of code it's nice to be able to see it all at once rather than scrolling all over "hell's half acre" to find it. (which, when you think about it adds a *lot* more than a few seconds, probably hours to days over the life of a project)


                                    "Hello, hello, what's all this shouting, we'll have no trouble here! This is a Local Shop for Local People, there's nothing for you here!" -Edward Tattsyrup

                                    1 Reply Last reply
                                    0
                                    • R Robert Rohde

                                      Is this some kind of joke Im not getting? Please tell me you are not serious with that... :~

                                      M Offline
                                      M Offline
                                      Member 96
                                      wrote on last edited by
                                      #20

                                      Serious about saving time compiling - no, serious about saving time scrolling all over the place when it could as easily fit on one screen and still be readable - yes. I *do* opt for the most compact code possible. I'm not crazy about it, for example a property has one line for the declaration, one line below for the get and one line below for the set, not all on one line, but not broken out with a single line for a parenthesis {, that's just a waste of visual acuity.


                                      "Hello, hello, what's all this shouting, we'll have no trouble here! This is a Local Shop for Local People, there's nothing for you here!" -Edward Tattsyrup

                                      1 Reply Last reply
                                      0
                                      • M Marc Clifton

                                        Oh great, now every VB programmer out there is going to read your post and take you seriously. :rolleyes: Marc VS2005 Tips & Tricks -- contributions welcome!

                                        M Offline
                                        M Offline
                                        Member 96
                                        wrote on last edited by
                                        #21

                                        I bet there *is* some factor there though. My current project has hundreds of thousands of lines of code all pretty compact, but I bet if I put the whole solution through some sort of cruncher to eliminate any possible whitespace and another to format it out in full so called "readable" (I would say the opposite personally, wading through page after page looking for a part of a method when there is a line dedicated to ever parenthesis etc is not my idea of readable) format I bet there would be a noticeable difference loading, backing up, compiling etc etc.


                                        "Hello, hello, what's all this shouting, we'll have no trouble here! This is a Local Shop for Local People, there's nothing for you here!" -Edward Tattsyrup

                                        1 Reply Last reply
                                        0
                                        • N Nemanja Trifunovic

                                          4 and 2


                                          My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.

                                          K Offline
                                          K Offline
                                          Kevin McFarlane
                                          wrote on last edited by
                                          #22

                                          Same as me then. :) Kevin

                                          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