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. Style is a subtle thing...

Style is a subtle thing...

Scheduled Pinned Locked Moved The Lounge
questioncsharpc++comcollaboration
37 Posts 29 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.
  • N Nemanja Trifunovic

    A recent StackOverflow discussion got me thinking... Apparently somebody did something like:

    *(*(*(p_member).p_member).p_member).member

    and the other guy said "WTF" and changed it to something like:

    p_member->p_member->p_member->member

    and offended the guy No. 1 who prefers his own style. Now, I don't want to steal the SO thread and discuss what is better - most if not all of us will agree with the guy 2 that operator -> is the preffered approach here. But would you make a change like this and start a war with someone you work with? I mean, the code is still correct, even if ugly, and the customers will never notice any difference. On the other hand, if you turn the development team into a bunch of people who hate each other, everybody is going to suffer. I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

    Programming Blog utf8-cpp

    M Offline
    M Offline
    Maximilien
    wrote on last edited by
    #6

    They are both crappy code. :|

    This signature was proudly tested on animals.

    J N 2 Replies Last reply
    0
    • N Nemanja Trifunovic

      A recent StackOverflow discussion got me thinking... Apparently somebody did something like:

      *(*(*(p_member).p_member).p_member).member

      and the other guy said "WTF" and changed it to something like:

      p_member->p_member->p_member->member

      and offended the guy No. 1 who prefers his own style. Now, I don't want to steal the SO thread and discuss what is better - most if not all of us will agree with the guy 2 that operator -> is the preffered approach here. But would you make a change like this and start a war with someone you work with? I mean, the code is still correct, even if ugly, and the customers will never notice any difference. On the other hand, if you turn the development team into a bunch of people who hate each other, everybody is going to suffer. I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

      Programming Blog utf8-cpp

      J Offline
      J Offline
      Jim Crafton
      wrote on last edited by
      #7

      It depends. In this case it's not worth the hassle. Sometimes "beautiful" code is more than just aesthetics, and if it affects maintainability, etc, then I might push back a little. Luckily I don't have to deal with crap like that anymore! :)

      ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Oh

      1 Reply Last reply
      0
      • M Maximilien

        They are both crappy code. :|

        This signature was proudly tested on animals.

        J Offline
        J Offline
        Jim Crafton
        wrote on last edited by
        #8

        Absolutely. My first thought would be why on earth do you have something like that in the first place.

        ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Oh

        1 Reply Last reply
        0
        • N Nemanja Trifunovic

          A recent StackOverflow discussion got me thinking... Apparently somebody did something like:

          *(*(*(p_member).p_member).p_member).member

          and the other guy said "WTF" and changed it to something like:

          p_member->p_member->p_member->member

          and offended the guy No. 1 who prefers his own style. Now, I don't want to steal the SO thread and discuss what is better - most if not all of us will agree with the guy 2 that operator -> is the preffered approach here. But would you make a change like this and start a war with someone you work with? I mean, the code is still correct, even if ugly, and the customers will never notice any difference. On the other hand, if you turn the development team into a bunch of people who hate each other, everybody is going to suffer. I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

          Programming Blog utf8-cpp

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #9

          Style should be standardised across a code base. So, I'd discuss if I did not agree with the style, then stick to whatever was decided.

          Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

          1 Reply Last reply
          0
          • N Nemanja Trifunovic

            A recent StackOverflow discussion got me thinking... Apparently somebody did something like:

            *(*(*(p_member).p_member).p_member).member

            and the other guy said "WTF" and changed it to something like:

            p_member->p_member->p_member->member

            and offended the guy No. 1 who prefers his own style. Now, I don't want to steal the SO thread and discuss what is better - most if not all of us will agree with the guy 2 that operator -> is the preffered approach here. But would you make a change like this and start a war with someone you work with? I mean, the code is still correct, even if ugly, and the customers will never notice any difference. On the other hand, if you turn the development team into a bunch of people who hate each other, everybody is going to suffer. I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

            Programming Blog utf8-cpp

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

            Nemanja Trifunovic wrote:

            I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

            The relationship with my co-workers depends upon their sex, age and willingness to get drunk at the Xmas party and fool around in the stationery cupboard. The beauty of any code lies in the eye of the beholder, and code, having all the attibutes of a woman, has needs, wants and a particular inner beauty that is at once obvious and indescribable.

            ___________________________________________ .\\axxx (That's an 'M')

            J P 2 Replies Last reply
            0
            • N Nemanja Trifunovic

              A recent StackOverflow discussion got me thinking... Apparently somebody did something like:

              *(*(*(p_member).p_member).p_member).member

              and the other guy said "WTF" and changed it to something like:

              p_member->p_member->p_member->member

              and offended the guy No. 1 who prefers his own style. Now, I don't want to steal the SO thread and discuss what is better - most if not all of us will agree with the guy 2 that operator -> is the preffered approach here. But would you make a change like this and start a war with someone you work with? I mean, the code is still correct, even if ugly, and the customers will never notice any difference. On the other hand, if you turn the development team into a bunch of people who hate each other, everybody is going to suffer. I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

              Programming Blog utf8-cpp

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

              Bah! The -> operator is merely syntactic sugar; only weak developers use it.

              1 Reply Last reply
              0
              • N Nemanja Trifunovic

                A recent StackOverflow discussion got me thinking... Apparently somebody did something like:

                *(*(*(p_member).p_member).p_member).member

                and the other guy said "WTF" and changed it to something like:

                p_member->p_member->p_member->member

                and offended the guy No. 1 who prefers his own style. Now, I don't want to steal the SO thread and discuss what is better - most if not all of us will agree with the guy 2 that operator -> is the preffered approach here. But would you make a change like this and start a war with someone you work with? I mean, the code is still correct, even if ugly, and the customers will never notice any difference. On the other hand, if you turn the development team into a bunch of people who hate each other, everybody is going to suffer. I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

                Programming Blog utf8-cpp

                C Offline
                C Offline
                Chris Maunder
                wrote on last edited by
                #12

                beautiful code.

                cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP

                N 1 Reply Last reply
                0
                • N Nemanja Trifunovic

                  A recent StackOverflow discussion got me thinking... Apparently somebody did something like:

                  *(*(*(p_member).p_member).p_member).member

                  and the other guy said "WTF" and changed it to something like:

                  p_member->p_member->p_member->member

                  and offended the guy No. 1 who prefers his own style. Now, I don't want to steal the SO thread and discuss what is better - most if not all of us will agree with the guy 2 that operator -> is the preffered approach here. But would you make a change like this and start a war with someone you work with? I mean, the code is still correct, even if ugly, and the customers will never notice any difference. On the other hand, if you turn the development team into a bunch of people who hate each other, everybody is going to suffer. I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

                  Programming Blog utf8-cpp

                  R Offline
                  R Offline
                  Rama Krishna Vavilala
                  wrote on last edited by
                  #13

                  Neither they are both train-wreck. Anyway, IMHO the styling should be one thing which should be standardized so that people don't argue on it. There is no right or wrong way so argument is useless. That is why I like StyleCop so much.

                  N 1 Reply Last reply
                  0
                  • M Maximilien

                    They are both crappy code. :|

                    This signature was proudly tested on animals.

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

                    Maximilien wrote:

                    They are both crappy code

                    Hell, I agree - this is not a point, and the original code probably didn't even look like that. The opinion I am seeking is - would you risk the relationship with your coworkers to enforce the coding style you like?

                    Programming Blog utf8-cpp

                    M 1 Reply Last reply
                    0
                    • C Chris Maunder

                      beautiful code.

                      cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP

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

                      Chris Maunder wrote:

                      beautiful code.

                      :~ I wouldn't expect such answer from a good manager, to be honest.

                      Programming Blog utf8-cpp

                      1 Reply Last reply
                      0
                      • R Rama Krishna Vavilala

                        Neither they are both train-wreck. Anyway, IMHO the styling should be one thing which should be standardized so that people don't argue on it. There is no right or wrong way so argument is useless. That is why I like StyleCop so much.

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

                        Rama Krishna Vavilala wrote:

                        Neither they are both train-wreck.

                        Irrelevant for the discussion :) The point is that dev 1 considers sample 1 to be "better" than sample 2, and dev 2 is willing to compromise his work environment to change it to sample 2.

                        Programming Blog utf8-cpp

                        1 Reply Last reply
                        0
                        • N Nemanja Trifunovic

                          Maximilien wrote:

                          They are both crappy code

                          Hell, I agree - this is not a point, and the original code probably didn't even look like that. The opinion I am seeking is - would you risk the relationship with your coworkers to enforce the coding style you like?

                          Programming Blog utf8-cpp

                          M Offline
                          M Offline
                          Maximilien
                          wrote on last edited by
                          #17

                          I ask the person who did the change, just for the sake of curiosity, why the change; maybe there's something in version A that cause some risks vs. version B. If we see together that there is no added risk to the code either by using A or B, then I would just let it go.

                          This signature was proudly tested on animals.

                          1 Reply Last reply
                          0
                          • L Lost User

                            Nemanja Trifunovic wrote:

                            I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

                            The relationship with my co-workers depends upon their sex, age and willingness to get drunk at the Xmas party and fool around in the stationery cupboard. The beauty of any code lies in the eye of the beholder, and code, having all the attibutes of a woman, has needs, wants and a particular inner beauty that is at once obvious and indescribable.

                            ___________________________________________ .\\axxx (That's an 'M')

                            J Offline
                            J Offline
                            Jim Crafton
                            wrote on last edited by
                            #18

                            Maxxx_ wrote:

                            The relationship with my co-workers depends upon their sex, age and willingness to get drunk at the Xmas party and fool around in the stationery cupboard.

                            That's gotta be the best response ever! Though I'm not sure HR would approve...unless of course HR looks like Salma Hayak, and has a serious sex addiction! :)

                            ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Oh

                            L S 2 Replies Last reply
                            0
                            • N Nemanja Trifunovic

                              A recent StackOverflow discussion got me thinking... Apparently somebody did something like:

                              *(*(*(p_member).p_member).p_member).member

                              and the other guy said "WTF" and changed it to something like:

                              p_member->p_member->p_member->member

                              and offended the guy No. 1 who prefers his own style. Now, I don't want to steal the SO thread and discuss what is better - most if not all of us will agree with the guy 2 that operator -> is the preffered approach here. But would you make a change like this and start a war with someone you work with? I mean, the code is still correct, even if ugly, and the customers will never notice any difference. On the other hand, if you turn the development team into a bunch of people who hate each other, everybody is going to suffer. I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

                              Programming Blog utf8-cpp

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

                              I'd change it in a heartbeat. No qualms. I'd expect the same from any co-worker if i wrote such an abomination. And no, i wouldn't stop at using the -> operator either... ;) Kudos on posting this here btw!

                              1 Reply Last reply
                              0
                              • J Jim Crafton

                                Maxxx_ wrote:

                                The relationship with my co-workers depends upon their sex, age and willingness to get drunk at the Xmas party and fool around in the stationery cupboard.

                                That's gotta be the best response ever! Though I'm not sure HR would approve...unless of course HR looks like Salma Hayak, and has a serious sex addiction! :)

                                ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Oh

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

                                It's usually the HR people whose photocopied bits are plastered over the noticeboards after the party's over :)

                                ___________________________________________ .\\axxx (That's an 'M')

                                1 Reply Last reply
                                0
                                • N Nemanja Trifunovic

                                  A recent StackOverflow discussion got me thinking... Apparently somebody did something like:

                                  *(*(*(p_member).p_member).p_member).member

                                  and the other guy said "WTF" and changed it to something like:

                                  p_member->p_member->p_member->member

                                  and offended the guy No. 1 who prefers his own style. Now, I don't want to steal the SO thread and discuss what is better - most if not all of us will agree with the guy 2 that operator -> is the preffered approach here. But would you make a change like this and start a war with someone you work with? I mean, the code is still correct, even if ugly, and the customers will never notice any difference. On the other hand, if you turn the development team into a bunch of people who hate each other, everybody is going to suffer. I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

                                  Programming Blog utf8-cpp

                                  M Offline
                                  M Offline
                                  macu
                                  wrote on last edited by
                                  #21

                                  I definitely avoid this for three reasons: 1. It winds people up, sometimes a lot. 2. You look very stupid when you amend something for style and accidentally introduce a new bug. 3. You introduce changes into the source history in your source code control software that aren't meaningful and actual changes become harder to see. A guy where I work got hold of a copy of resharper and did all of the above in a big way (yep bugs too). I use resharper and it's very good but it's not a good idea to randomly open other people's code with it just to reformat...

                                  N 1 Reply Last reply
                                  0
                                  • N Nemanja Trifunovic

                                    A recent StackOverflow discussion got me thinking... Apparently somebody did something like:

                                    *(*(*(p_member).p_member).p_member).member

                                    and the other guy said "WTF" and changed it to something like:

                                    p_member->p_member->p_member->member

                                    and offended the guy No. 1 who prefers his own style. Now, I don't want to steal the SO thread and discuss what is better - most if not all of us will agree with the guy 2 that operator -> is the preffered approach here. But would you make a change like this and start a war with someone you work with? I mean, the code is still correct, even if ugly, and the customers will never notice any difference. On the other hand, if you turn the development team into a bunch of people who hate each other, everybody is going to suffer. I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

                                    Programming Blog utf8-cpp

                                    U Offline
                                    U Offline
                                    urbane tiger
                                    wrote on last edited by
                                    #22

                                    The following's relationship to your question is somewhat oblique, but nevertheless I think it's germaine. After examining the first module I'd written at what was then my new workplace, the chief code stylist told me, "We do not allow use of computed procedure calls (function pointers) round here". "Why not?" I asked. "Because the compiler has a bug" he replied. "What bug? Show me" I demanded. "This one" he replied, pulling a 15x11 listing from the shelf and referring me to the apparently errant code, which did indeed make use of computed procedure calls. Äfter a few moments of reading I asked "Does it fall over with a bounds error?" "Yes. How did you know that?" he replied with some surprise. "Because there's a GOTO in here that jumps into the middle of a FOR loop" I smugly replied. Needless to say I was able to lift the ban on computed procedure calls, and after that many other constraints on the liberty and freedom of programmers to write the code that they thought best suited the problem. In later years, with some help from the likes Edsger Djikstra and Nicklaus Wirth, I was able to impose an embargo on the use of GOTO, not to be used without prior approval of the then chief code stylist, who was by then -- you can guess who. I had great relationships with my colleagues, especially Deb.... and Elsp... and ...., salad days long gone.

                                    Multi famam, conscientiam pauci verentur.(Pliny)

                                    modified on Wednesday, April 29, 2009 2:56 AM

                                    1 Reply Last reply
                                    0
                                    • N Nemanja Trifunovic

                                      A recent StackOverflow discussion got me thinking... Apparently somebody did something like:

                                      *(*(*(p_member).p_member).p_member).member

                                      and the other guy said "WTF" and changed it to something like:

                                      p_member->p_member->p_member->member

                                      and offended the guy No. 1 who prefers his own style. Now, I don't want to steal the SO thread and discuss what is better - most if not all of us will agree with the guy 2 that operator -> is the preffered approach here. But would you make a change like this and start a war with someone you work with? I mean, the code is still correct, even if ugly, and the customers will never notice any difference. On the other hand, if you turn the development team into a bunch of people who hate each other, everybody is going to suffer. I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

                                      Programming Blog utf8-cpp

                                      L Offline
                                      L Offline
                                      Lonnie R Thomas
                                      wrote on last edited by
                                      #23

                                      code writing is an individual thing. Instead of automatically changing the code or remarking it just talk to the person. Change just for the sake of change is inappropriate. But good communication with your coworkers is the most important issue here. In my case the more experience programmers look at my code and suggest mayber a better looking way but do not hassle me about it. When the end result is the same. Simply talk to each other like adults. ;)

                                      Lonnie R Thomas

                                      1 Reply Last reply
                                      0
                                      • N Nemanja Trifunovic

                                        A recent StackOverflow discussion got me thinking... Apparently somebody did something like:

                                        *(*(*(p_member).p_member).p_member).member

                                        and the other guy said "WTF" and changed it to something like:

                                        p_member->p_member->p_member->member

                                        and offended the guy No. 1 who prefers his own style. Now, I don't want to steal the SO thread and discuss what is better - most if not all of us will agree with the guy 2 that operator -> is the preffered approach here. But would you make a change like this and start a war with someone you work with? I mean, the code is still correct, even if ugly, and the customers will never notice any difference. On the other hand, if you turn the development team into a bunch of people who hate each other, everybody is going to suffer. I guess my question is: would you rather have "beautiful" code or good relationship with your coworkers?

                                        Programming Blog utf8-cpp

                                        B Offline
                                        B Offline
                                        Bob1000
                                        wrote on last edited by
                                        #24

                                        Speaking as a person who has to modify (fix) code many years after the writer may have disappeared (grrr!). Readable and understandable code first!!!!!!! The code writer ought to learn its not just writing the code in the first place it has to be maintained, if nothing is said nothing is learned!

                                        1 Reply Last reply
                                        0
                                        • J Jim Crafton

                                          Maxxx_ wrote:

                                          The relationship with my co-workers depends upon their sex, age and willingness to get drunk at the Xmas party and fool around in the stationery cupboard.

                                          That's gotta be the best response ever! Though I'm not sure HR would approve...unless of course HR looks like Salma Hayak, and has a serious sex addiction! :)

                                          ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Oh

                                          S Offline
                                          S Offline
                                          sketch2002
                                          wrote on last edited by
                                          #25

                                          Jim Crafton wrote:

                                          and has a serious sex addiction!

                                          Unless HR is the one with the... how did he put it... Oh yes:

                                          Jim Crafton wrote:

                                          willingness to get drunk at the Xmas party and fool around in the stationery cupboard.

                                          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