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 aesthetics

code aesthetics

Scheduled Pinned Locked Moved The Lounge
comquestiondiscussion
103 Posts 42 Posters 8 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 leppie

    C# is easy, delete the last curly brace in the file, and just create it again. Voila, code formatted :)

    xacc.ide - now with TabsToSpaces support
    IronScheme - 1.0 alpha 4a out now (29 May 2008)

    E Offline
    E Offline
    El Corazon
    wrote on last edited by
    #22

    leppie wrote:

    C# is easy, delete the last curly brace in the file, and just create it again. Voila, code formatted

    C++ is easy, with astyle integrated into your IDE, just type your code and it is formatted. ;P you don't even have to delete your last curly brace. ;P

    _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb) John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others."

    D 1 Reply Last reply
    0
    • S Scott Dorman

      El Corazon wrote:

      we tried for 2.5 years in meetings ( ) to get a consensus, it was unreachable

      You spent way too long debating it then. Best rule of thumb (especially if management has bought in to the concept of a standard and is willing to enforce it somehow) is to let it argue out for an hour or two, suggest some compromises (for the tab size issue, 3 generally works well) and if no one can still agree, make it a mandate.

      El Corazon wrote:

      I personally think every programmer on his own should write clean looking code, whether by beautifier or 1st time out writing I don't care.

      The problem with that is you then loose the psychological aspects of writing "clean" code: The developer feels better about their skills because the code is easier to understand, works better the first time out, etc., so they want to take more ownership of the code. The more ownership they take, the less likely they will be to introduce new bugs in that code. Eventually it becomes a type of self fulfilling prophecy.

      El Corazon wrote:

      A team should have a tool to either verify consistency or beautify to consistant format.

      Absolutely, but that isn't always possible depending on the language.

      Scott Dorman

      Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA [Blog][Articles][Forum Guidelines]


      Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

      E Offline
      E Offline
      El Corazon
      wrote on last edited by
      #23

      Scott Dorman wrote:

      You spent way too long debating it then.

      That is obvious from all of our meetings. Without demands from above, diverging interests, fears, or misconseptions drive the individuals in different directions. Our previous meeting before the last one was 4 hours... this last one was 6 hours. I imagine the next one will be all day. After that we might have to pay overtime for meetings.... obviously something is wrong when this happens. :) Thus lunar illumination. ;) ;) with the intent on expansion to permanent in intent. :-D

      _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb) John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others."

      T 1 Reply Last reply
      0
      • M Marc Clifton

        I take care to ensure the aesthetics of my code. That spacing and formatting is consistent. I don't care if I'm writing throw away code or production code. The code should always look neat and tidy. Why don't other programmers do the same??? OK, I'm sure there are some out there. And yes, there are code beautifiers, so who really cares, right? What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.? Marc

        Thyme In The Country Interacx My Blog

        C Offline
        C Offline
        code frog 0
        wrote on last edited by
        #24

        Standards There should be a convention that is followed by the development group. That standard should be enforced in the same spirit as dress code or curfew. It's a standard. Now if it's code you inherited from some developer you don't know and it's ugly and it sucks. I'm sorry about that. I must have let that slip out somewhere. :-\

        1 Reply Last reply
        0
        • M Marc Clifton

          I take care to ensure the aesthetics of my code. That spacing and formatting is consistent. I don't care if I'm writing throw away code or production code. The code should always look neat and tidy. Why don't other programmers do the same??? OK, I'm sure there are some out there. And yes, there are code beautifiers, so who really cares, right? What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.? Marc

          Thyme In The Country Interacx My Blog

          V Offline
          V Offline
          Vikram A Punathambekar
          wrote on last edited by
          #25

          I wish VS had a similar shortcut for stripping out Hungarian notation! :sigh:

          Cheers, Vıkram.


          "if abusing me makes you a credible then i better give u the chance which didnt get in real" - Adnan Siddiqi.

          J 1 Reply Last reply
          0
          • E El Corazon

            Marc Clifton wrote:

            OK, I'm sure there are some out there. And yes, there are code beautifiers, so who really cares, right? What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.?

            What I see is that every programmer has their own way of doing "good formatting" we tried for 2.5 years in meetings ( :rolleyes: ) to get a consensus, it was unreachable. We finally agreed on a format through a document forced into the chain, but no one will enforce it, so we still have the same status quo. I personally think every programmer on his own should write clean looking code, whether by beautifier or 1st time out writing I don't care. A team should have a tool to either verify consistency or beautify to consistant format. :)

            _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb) John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others."

            M Offline
            M Offline
            MidwestLimey
            wrote on last edited by
            #26

            El Corazon wrote:

            we tried for 2.5 years in meetings

            912 days of meetings? Damn! That must have been a bitch. I hope they provided lunch.

            Bar fomos edo pariyart gedeem, agreo eo dranem abal edyero eyrem kalm kareore

            E 1 Reply Last reply
            0
            • S stephen hazel

              Ooooooo - that strikes a nerve with ME alright. I am a column nazi. People. Can't we at least agree that code shouldn't be wider than 120 columns? (I prefer a width of 80 myself). And for GOD'S SAKE why won't some of you indent your code????? I don't care if it's 3 spaces or 4 or a tab or what, but PLEEEASE! I'm BEGGING YOUuuuuuuu......... Why? Why can't you just keep it on one screen and indent? Is the reason because it takes time to write it that way? (once) And it's just as easy for YOU to read it that way? (80 times) Whyyyyyyy??? I really wanna know...

              T Offline
              T Offline
              Todd Smith
              wrote on last edited by
              #27

              120 columns? Are you still stuck on a CRT?

              Todd Smith

              D L S 3 Replies Last reply
              0
              • E El Corazon

                Scott Dorman wrote:

                You spent way too long debating it then.

                That is obvious from all of our meetings. Without demands from above, diverging interests, fears, or misconseptions drive the individuals in different directions. Our previous meeting before the last one was 4 hours... this last one was 6 hours. I imagine the next one will be all day. After that we might have to pay overtime for meetings.... obviously something is wrong when this happens. :) Thus lunar illumination. ;) ;) with the intent on expansion to permanent in intent. :-D

                _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb) John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others."

                T Offline
                T Offline
                Todd Smith
                wrote on last edited by
                #28

                There are tools that can check formatting during checkin to systems like SVN. If the formatting isn't correct the file can either be rejected or the build marked as broken.

                Todd Smith

                1 Reply Last reply
                0
                • M MidwestLimey

                  El Corazon wrote:

                  we tried for 2.5 years in meetings

                  912 days of meetings? Damn! That must have been a bitch. I hope they provided lunch.

                  Bar fomos edo pariyart gedeem, agreo eo dranem abal edyero eyrem kalm kareore

                  E Offline
                  E Offline
                  El Corazon
                  wrote on last edited by
                  #29

                  someone 5 this for me! I can't on this phone. :) lunch? that would be illegal. I know a project (not ours) that was tri-service unification for one specific piece of hardware that was already in use by all 3 major groups, but without any common standard. They spent 10 years in meetings trying for consensus, never got it. But buying lunch would be a gift which is illegal to provide or accept. :-P

                  _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb) John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others."

                  D 1 Reply Last reply
                  0
                  • M Marc Clifton

                    I take care to ensure the aesthetics of my code. That spacing and formatting is consistent. I don't care if I'm writing throw away code or production code. The code should always look neat and tidy. Why don't other programmers do the same??? OK, I'm sure there are some out there. And yes, there are code beautifiers, so who really cares, right? What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.? Marc

                    Thyme In The Country Interacx My Blog

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

                    Marc Clifton wrote:

                    What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.?

                    Together with cool syntax highlighting, well laid out code makes you want to eat it. ;P

                    1 Reply Last reply
                    0
                    • M Marc Clifton

                      I take care to ensure the aesthetics of my code. That spacing and formatting is consistent. I don't care if I'm writing throw away code or production code. The code should always look neat and tidy. Why don't other programmers do the same??? OK, I'm sure there are some out there. And yes, there are code beautifiers, so who really cares, right? What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.? Marc

                      Thyme In The Country Interacx My Blog

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

                      BTW, I just finished 'slotting' new code into a decompiled ASP.NET application. It's so neat, but so truly ugly. This being urgent maintenance, I followed the existing coding style: dynamically adding HTML to a Label control for the report, filtered for a dynamically built SQL query, directly off user input. But wait, there is more; they used manual control-break code for grouping. :~

                      1 Reply Last reply
                      0
                      • T Todd Smith

                        120 columns? Are you still stuck on a CRT?

                        Todd Smith

                        D Offline
                        D Offline
                        Dan Neely
                        wrote on last edited by
                        #32

                        CRT, 140 columns in VS203. Somewhat less in 2k8 because of how I have the sidebars sized. I also have an LCD but missed the switch from buying 1280x1024 to 1680x1050 screens by a few months. :doh: I'm not sure if LCDs are on the same 4 year upgrade cycle as laptops, or how my having a midcycle swap when my old laptop had issues will affect it. I'd be dual CRT except the 2nd dock port is DVI-D only.

                        Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall

                        1 Reply Last reply
                        0
                        • S stephen hazel

                          Ooooooo - that strikes a nerve with ME alright. I am a column nazi. People. Can't we at least agree that code shouldn't be wider than 120 columns? (I prefer a width of 80 myself). And for GOD'S SAKE why won't some of you indent your code????? I don't care if it's 3 spaces or 4 or a tab or what, but PLEEEASE! I'm BEGGING YOUuuuuuuu......... Why? Why can't you just keep it on one screen and indent? Is the reason because it takes time to write it that way? (once) And it's just as easy for YOU to read it that way? (80 times) Whyyyyyyy??? I really wanna know...

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

                          It must suck to be you! :omg:

                          S 1 Reply Last reply
                          0
                          • E El Corazon

                            leppie wrote:

                            C# is easy, delete the last curly brace in the file, and just create it again. Voila, code formatted

                            C++ is easy, with astyle integrated into your IDE, just type your code and it is formatted. ;P you don't even have to delete your last curly brace. ;P

                            _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb) John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others."

                            D Offline
                            D Offline
                            Dan Neely
                            wrote on last edited by
                            #34

                            C# does that for new code without an IDE plugin. Zapping and replacing a } forces a reformat of everything inside the block.

                            Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall

                            1 Reply Last reply
                            0
                            • M martin_hughes

                              Marc Clifton wrote:

                              What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.?

                              It's a must. I like to be able to squint at code and see pretty patterns in the text, which is as near as dammit impossible if due care and attention has not been taken by the monkey bashing the keys (or if it's written in Perl :) ).

                              Top Secret Plan for World Domination

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

                              You too? :laugh:

                              1 Reply Last reply
                              0
                              • E El Corazon

                                Marc Clifton wrote:

                                OK, I'm sure there are some out there. And yes, there are code beautifiers, so who really cares, right? What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.?

                                What I see is that every programmer has their own way of doing "good formatting" we tried for 2.5 years in meetings ( :rolleyes: ) to get a consensus, it was unreachable. We finally agreed on a format through a document forced into the chain, but no one will enforce it, so we still have the same status quo. I personally think every programmer on his own should write clean looking code, whether by beautifier or 1st time out writing I don't care. A team should have a tool to either verify consistency or beautify to consistant format. :)

                                _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb) John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others."

                                D Offline
                                D Offline
                                Dan Neely
                                wrote on last edited by
                                #36

                                What we need is an IDE that does autoformat on opening a file, and diff tools that do the same *before* doing the comparison. That way everyone can have his/her favorite happy format, always see that format, and not crap all over the diff results in source control. Given the dollar cost of your futile meetings in a sane world you should be able to convince the PTB to authorize developing said tool on overhead.

                                Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall

                                1 Reply Last reply
                                0
                                • E El Corazon

                                  someone 5 this for me! I can't on this phone. :) lunch? that would be illegal. I know a project (not ours) that was tri-service unification for one specific piece of hardware that was already in use by all 3 major groups, but without any common standard. They spent 10 years in meetings trying for consensus, never got it. But buying lunch would be a gift which is illegal to provide or accept. :-P

                                  _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb) John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others."

                                  D Offline
                                  D Offline
                                  Dan Neely
                                  wrote on last edited by
                                  #37

                                  AIUI it's only illegal if you're giving it tor govt employees for free, not for internal use.

                                  Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall

                                  E 1 Reply Last reply
                                  0
                                  • M Marc Clifton

                                    I take care to ensure the aesthetics of my code. That spacing and formatting is consistent. I don't care if I'm writing throw away code or production code. The code should always look neat and tidy. Why don't other programmers do the same??? OK, I'm sure there are some out there. And yes, there are code beautifiers, so who really cares, right? What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.? Marc

                                    Thyme In The Country Interacx My Blog

                                    D Offline
                                    D Offline
                                    David Crow
                                    wrote on last edited by
                                    #38

                                    Marc Clifton wrote:

                                    What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.?

                                    I'm right there with you, Marc.

                                    "Love people and use things, not love things and use people." - Unknown

                                    "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                                    1 Reply Last reply
                                    0
                                    • M Marc Clifton

                                      I take care to ensure the aesthetics of my code. That spacing and formatting is consistent. I don't care if I'm writing throw away code or production code. The code should always look neat and tidy. Why don't other programmers do the same??? OK, I'm sure there are some out there. And yes, there are code beautifiers, so who really cares, right? What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.? Marc

                                      Thyme In The Country Interacx My Blog

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

                                      Of course it should... but only my style looks good. :-D I've only worked at one place that published (and enforced) a coding standard, and because it was followed maintaining the code was a snap. This is one of the areas where a new graduate can really benefit from working for a large shop.

                                      1 Reply Last reply
                                      0
                                      • D Dan Neely

                                        AIUI it's only illegal if you're giving it tor govt employees for free, not for internal use.

                                        Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall

                                        E Offline
                                        E Offline
                                        El Corazon
                                        wrote on last edited by
                                        #40

                                        dan neely wrote:

                                        not for internal use.

                                        true, but the company only does what the government provides. :) so they don't we don't. :) simple. And if they were to try, we couldn't, because that would not be good. :) so we can't. :) keeps things logical. ;)

                                        _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb) John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others."

                                        D 1 Reply Last reply
                                        0
                                        • E El Corazon

                                          dan neely wrote:

                                          not for internal use.

                                          true, but the company only does what the government provides. :) so they don't we don't. :) simple. And if they were to try, we couldn't, because that would not be good. :) so we can't. :) keeps things logical. ;)

                                          _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb) John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others."

                                          D Offline
                                          D Offline
                                          Dan Neely
                                          wrote on last edited by
                                          #41

                                          Sucks to be you. SOP here is that if you're required to say in for a working lunch (not billable time) the manager(s) responsible buy a meal (typically pizza). Which naturally triggers griping about management equating 1hr of work with $5 of pizza whenever they do it for something we don't want to attend. :rolleyes:

                                          Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall

                                          E 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