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. What is good code?

What is good code?

Scheduled Pinned Locked Moved The Lounge
questiondiscussion
104 Posts 39 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.
  • R realJSOP

    When you're on a tight schedule, if it was what it's supposed to do, it's "good" code. You guys are merely being pedantic, and are ignoring (or ignorant of) the realities of real-world development...

    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
    -----
    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
    -----
    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

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

    John Simmons / outlaw programmer wrote:

    ignoring (or ignorant of) the realities of real-world development

    I don't think so. In real world development, sure a schedule may be tight and it may be necessary to write code that is not 'as good as it could be' just to get it out the door, or to fix an urgent bug. But that still isn't good code, it is just working code. If it is left as-is, and the code base is modified over time, then such code can cause more and more issues (as you must know) If you're a good, experienced, programmer, then the likelihood of quickly developed code being poor is less, but we all know we sometimes cut corners to get the job done - and we all know it comes back to bite us (or our successor) in the bum when that happens. If someone writes hundreds of lines of spaghetti code to achieve what could have been written in a few lines of well structured code, by your measure, it is good code if the output is as required. But a part of the output should be the codes longevity and maintainability, not just the function return value.

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

    Z 1 Reply Last reply
    0
    • S Slacker007

      Who determines if your code is good? What is good code and what are the precise criteria for giving it a status of "good"? Since most of your code will never be reviewed by your peers (outside of work) then how do you know it is worth a damn, really? If I think your code sucks but the next guy thinks it is good, then who is right? This kind of goes in line with my other thoughts about the "greatness" of an individual programmer. Who determines that a person is a great programmer and that person writes some damn good code? You? Me? None of the above? We obviously cannot make this determination about ourselves or our code. So who does?

      "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
      "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

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

      this is good code according to JSOP (to save you compiling and building it, it is a flight simulator) and it works.

      #include
      #include
      #include
      #include
      double L ,o ,P
      ,_=dt,T,Z,D=1,d,
      s[999],E,h= 8,I,
      J,K,w[999],M,m,O
      ,n[999],j=33e-3,i=
      1E3,r,t, u,v ,W,S=
      74.5,l=221,X=7.26,
      a,B,A=32.2,c, F,H;
      int N,q, C, y,p,U;
      Window z; char f[52]
      ; GC k; main(){ Display*e=
      XOpenDisplay( 0); z=RootWindow(e,0); for (XSetForeground(e,k=XCreateGC (e,z,0,0),BlackPixel(e,0))
      ; scanf("%lf%lf%lf",y +n,w+y, y+s)+1; y ++); XSelectInput(e,z= XCreateSimpleWindow(e,z,0,0,400,400,
      0,0,WhitePixel(e,0) ),KeyPressMask); for(XMapWindow(e,z); ; T=sin(O)){ struct timeval G={ 0,dt*1e6}
      ; K= cos(j); N=1e4; M+= H*_; Z=D*K; F+=_*P; r=E*K; W=cos( O); m=K*W; H=K*T; O+=D*_*F/ K+d/K*E*_; B=
      sin(j); a=B*T*D-E*W; XClearWindow(e,z); t=T*E+ D*B*W; j+=d*_*D-_*F*E; P=W*E*B-T*D; for (o+=(I=D*W+E
      *T*B,E*d/K *B+v+B/K*F*D)*_; p K)N=1e4; else{ q=W/K *4E2+2e2; C= 2E2+4e2/ K
      *D; N-1E4&& XDrawLine(e ,z,k,N ,U,q,C); N=q; U=C; } ++p; } L+=_* (X*t +P*M+m*l); T=X*X+ l*l+M *M;
      XDrawString(e,z,k ,20,380,f,17); D=v/l*15; i+=(B *l-M*r -X*Z)*_; for(; XPending(e); u *=CS!=N){
      XEvent z; XNextEvent(e ,&z);
      ++*((N=XLookupKeysym
      (&z.xkey,0))-IT?
      N-LT? UP-N?& E:&
      J:& u: &h); --*(
      DN -N? N-DT ?N==
      RT?&u: & W:&h:&J
      ); } m=15*F/l;
      c+=(I=M/ l,l*H
      +I*M+a*X)*_; H
      =A*

      S 1 Reply Last reply
      0
      • S Slacker007

        Who determines if your code is good? What is good code and what are the precise criteria for giving it a status of "good"? Since most of your code will never be reviewed by your peers (outside of work) then how do you know it is worth a damn, really? If I think your code sucks but the next guy thinks it is good, then who is right? This kind of goes in line with my other thoughts about the "greatness" of an individual programmer. Who determines that a person is a great programmer and that person writes some damn good code? You? Me? None of the above? We obviously cannot make this determination about ourselves or our code. So who does?

        "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
        "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

        V Offline
        V Offline
        Vivi Chellappa
        wrote on last edited by
        #70

        Slacker007 wrote:

        We obviously cannot make this determination about ourselves or our code. So who does?

        Good Houskeeping magazine. They hand out the Seal of Approval for all sorts of things. So you could write to them. ;P

        1 Reply Last reply
        0
        • S Slacker007

          Who determines if your code is good? What is good code and what are the precise criteria for giving it a status of "good"? Since most of your code will never be reviewed by your peers (outside of work) then how do you know it is worth a damn, really? If I think your code sucks but the next guy thinks it is good, then who is right? This kind of goes in line with my other thoughts about the "greatness" of an individual programmer. Who determines that a person is a great programmer and that person writes some damn good code? You? Me? None of the above? We obviously cannot make this determination about ourselves or our code. So who does?

          "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
          "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

          W Offline
          W Offline
          wizardzz
          wrote on last edited by
          #71

          If you copy and paste good developers' code, then you have yourself good code.

          "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

          1 Reply Last reply
          0
          • S Slacker007

            Who determines if your code is good? What is good code and what are the precise criteria for giving it a status of "good"? Since most of your code will never be reviewed by your peers (outside of work) then how do you know it is worth a damn, really? If I think your code sucks but the next guy thinks it is good, then who is right? This kind of goes in line with my other thoughts about the "greatness" of an individual programmer. Who determines that a person is a great programmer and that person writes some damn good code? You? Me? None of the above? We obviously cannot make this determination about ourselves or our code. So who does?

            "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
            "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

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

            Not being a professional programmer myself; only a hobbyist, I would say that good code is code that gets the job done in the most efficient (from a performance point of view), understandable (from a readability point of view) manner and that this will be self evident to anyone viewing the code.

            1 Reply Last reply
            0
            • S Slacker007

              Who determines if your code is good? What is good code and what are the precise criteria for giving it a status of "good"? Since most of your code will never be reviewed by your peers (outside of work) then how do you know it is worth a damn, really? If I think your code sucks but the next guy thinks it is good, then who is right? This kind of goes in line with my other thoughts about the "greatness" of an individual programmer. Who determines that a person is a great programmer and that person writes some damn good code? You? Me? None of the above? We obviously cannot make this determination about ourselves or our code. So who does?

              "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
              "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

              Sander RosselS Offline
              Sander RosselS Offline
              Sander Rossel
              wrote on last edited by
              #73

              Reread your code next week, if you still understand what is going on it has potential to be good. Reread your code next month, if you still understand what is going on your code might be pretty allright. Reread your code after six months, if you still understand what is going on you probably have a winner. Reread your code after a year, if you still understand what is going on your code is good. Now have a colleague read your code. If he can't understand it he is in desperate need for some schooling (after all, your code is good). Now have your boss read your code. If he can't understand it your code wasn't good after all (even if your boss isn't a programmer, he makes the rules). Now have someone outside of your company read it. If he can't understand it who cares? His opinion doesn't matter anyway. Code that gets older than approximately five years (perhaps probably less) is bad code by definition. I think really very few people have written good code, ever :)

              It's an OO world.

              public class Naerling : Lazy<Person>{
              public void DoWork(){ throw new NotImplementedException(); }
              }

              S L 2 Replies Last reply
              0
              • S Slacker007

                Who determines if your code is good? What is good code and what are the precise criteria for giving it a status of "good"? Since most of your code will never be reviewed by your peers (outside of work) then how do you know it is worth a damn, really? If I think your code sucks but the next guy thinks it is good, then who is right? This kind of goes in line with my other thoughts about the "greatness" of an individual programmer. Who determines that a person is a great programmer and that person writes some damn good code? You? Me? None of the above? We obviously cannot make this determination about ourselves or our code. So who does?

                "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

                F Offline
                F Offline
                Fran Porretto
                wrote on last edited by
                #74

                "Good" is an evaluation. An evaluation must rest on explicit criteria of goodness / badness. These are often personal.

                My criteria for "Is it good code?" are:

                1. Does it fulfill the requirements of the application?
                2. Is it stable under the worst projected loads?
                3. Is it legible and maintainable by a competent engineer other than the originator?

                Code that incorporates assorted ingenuities can meet criteria 1 and 2 but fail criterion 3. And criterion 3 is just as important as the others.

                Not long ago a subordinate of mine wrote exactly that sort of program. His product was massively ingenious. It was even visually impressive. But it was effectively unmaintainable -- "effectively," because this particular program is one that, by its very nature, requires rapid modification, and requires it frequently, at that. My first two attempts to alter it proved that conclusively. So at the earliest politic opportunity, despite the impact to my regular responsibilities, I "spent five hours to save five minutes," as the saying goes, and rewrote the thing from the requirements, making maximally sure that any moderately competent engineer could easily understand its workings.

                I still have the predecessor program. I go back to it now and then, just to remind myself of what too much cleverness can cost, down the maintenance road.

                (This message is programming you in ways you cannot detect. Be afraid.)

                1 Reply Last reply
                0
                • Sander RosselS Sander Rossel

                  Reread your code next week, if you still understand what is going on it has potential to be good. Reread your code next month, if you still understand what is going on your code might be pretty allright. Reread your code after six months, if you still understand what is going on you probably have a winner. Reread your code after a year, if you still understand what is going on your code is good. Now have a colleague read your code. If he can't understand it he is in desperate need for some schooling (after all, your code is good). Now have your boss read your code. If he can't understand it your code wasn't good after all (even if your boss isn't a programmer, he makes the rules). Now have someone outside of your company read it. If he can't understand it who cares? His opinion doesn't matter anyway. Code that gets older than approximately five years (perhaps probably less) is bad code by definition. I think really very few people have written good code, ever :)

                  It's an OO world.

                  public class Naerling : Lazy<Person>{
                  public void DoWork(){ throw new NotImplementedException(); }
                  }

                  S Offline
                  S Offline
                  Slacker007
                  wrote on last edited by
                  #75

                  Naerling wrote:

                  I think really very few people have written good code, ever

                  The whole point of my question, really. :)

                  "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                  "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

                  1 Reply Last reply
                  0
                  • L Lost User

                    this is good code according to JSOP (to save you compiling and building it, it is a flight simulator) and it works.

                    #include
                    #include
                    #include
                    #include
                    double L ,o ,P
                    ,_=dt,T,Z,D=1,d,
                    s[999],E,h= 8,I,
                    J,K,w[999],M,m,O
                    ,n[999],j=33e-3,i=
                    1E3,r,t, u,v ,W,S=
                    74.5,l=221,X=7.26,
                    a,B,A=32.2,c, F,H;
                    int N,q, C, y,p,U;
                    Window z; char f[52]
                    ; GC k; main(){ Display*e=
                    XOpenDisplay( 0); z=RootWindow(e,0); for (XSetForeground(e,k=XCreateGC (e,z,0,0),BlackPixel(e,0))
                    ; scanf("%lf%lf%lf",y +n,w+y, y+s)+1; y ++); XSelectInput(e,z= XCreateSimpleWindow(e,z,0,0,400,400,
                    0,0,WhitePixel(e,0) ),KeyPressMask); for(XMapWindow(e,z); ; T=sin(O)){ struct timeval G={ 0,dt*1e6}
                    ; K= cos(j); N=1e4; M+= H*_; Z=D*K; F+=_*P; r=E*K; W=cos( O); m=K*W; H=K*T; O+=D*_*F/ K+d/K*E*_; B=
                    sin(j); a=B*T*D-E*W; XClearWindow(e,z); t=T*E+ D*B*W; j+=d*_*D-_*F*E; P=W*E*B-T*D; for (o+=(I=D*W+E
                    *T*B,E*d/K *B+v+B/K*F*D)*_; p K)N=1e4; else{ q=W/K *4E2+2e2; C= 2E2+4e2/ K
                    *D; N-1E4&& XDrawLine(e ,z,k,N ,U,q,C); N=q; U=C; } ++p; } L+=_* (X*t +P*M+m*l); T=X*X+ l*l+M *M;
                    XDrawString(e,z,k ,20,380,f,17); D=v/l*15; i+=(B *l-M*r -X*Z)*_; for(; XPending(e); u *=CS!=N){
                    XEvent z; XNextEvent(e ,&z);
                    ++*((N=XLookupKeysym
                    (&z.xkey,0))-IT?
                    N-LT? UP-N?& E:&
                    J:& u: &h); --*(
                    DN -N? N-DT ?N==
                    RT?&u: & W:&h:&J
                    ); } m=15*F/l;
                    c+=(I=M/ l,l*H
                    +I*M+a*X)*_; H
                    =A*

                    S Offline
                    S Offline
                    Slacker007
                    wrote on last edited by
                    #76

                    _Maxxx_ wrote:

                    this is good code according to JSOP

                    You and I both know what JSOP meant. ;) ...nice plane.

                    "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                    "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

                    L 1 Reply Last reply
                    0
                    • S Slacker007

                      Who determines if your code is good? What is good code and what are the precise criteria for giving it a status of "good"? Since most of your code will never be reviewed by your peers (outside of work) then how do you know it is worth a damn, really? If I think your code sucks but the next guy thinks it is good, then who is right? This kind of goes in line with my other thoughts about the "greatness" of an individual programmer. Who determines that a person is a great programmer and that person writes some damn good code? You? Me? None of the above? We obviously cannot make this determination about ourselves or our code. So who does?

                      "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                      "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

                      P Offline
                      P Offline
                      Polinia
                      wrote on last edited by
                      #77

                      The good code in my opinion is one that regardless of whether the developer is junior or senior it will look and understand more easily.

                      Sorry for my english is bad. I used the google translator.

                      M 1 Reply Last reply
                      0
                      • L Lost User

                        John Simmons / outlaw programmer wrote:

                        ignoring (or ignorant of) the realities of real-world development

                        I don't think so. In real world development, sure a schedule may be tight and it may be necessary to write code that is not 'as good as it could be' just to get it out the door, or to fix an urgent bug. But that still isn't good code, it is just working code. If it is left as-is, and the code base is modified over time, then such code can cause more and more issues (as you must know) If you're a good, experienced, programmer, then the likelihood of quickly developed code being poor is less, but we all know we sometimes cut corners to get the job done - and we all know it comes back to bite us (or our successor) in the bum when that happens. If someone writes hundreds of lines of spaghetti code to achieve what could have been written in a few lines of well structured code, by your measure, it is good code if the output is as required. But a part of the output should be the codes longevity and maintainability, not just the function return value.

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

                        Z Offline
                        Z Offline
                        ZurdoDev
                        wrote on last edited by
                        #78

                        Quote:

                        But that still isn't good code, it is just working code.

                        Precisely said. There is a big difference between working code and good code. I am working on a project now that "works" but the code is so bad maintenance is a nightmare.

                        There are only 10 types of people in the world, those who understand binary and those who don't.

                        1 Reply Last reply
                        0
                        • R realJSOP

                          When you're on a tight schedule, if it was what it's supposed to do, it's "good" code. You guys are merely being pedantic, and are ignoring (or ignorant of) the realities of real-world development...

                          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                          -----
                          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                          -----
                          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                          Z Offline
                          Z Offline
                          ZurdoDev
                          wrote on last edited by
                          #79

                          Quote:

                          if it was what it's supposed to do, it's "good" code.

                          As said below, it is working code, not good code. There is a big difference between working code and good code and anyone who has spent enough time doing"realities of real-world development" would have known that.

                          There are only 10 types of people in the world, those who understand binary and those who don't.

                          1 Reply Last reply
                          0
                          • S Slacker007

                            John Simmons / outlaw programmer wrote:

                            When you're on a tight schedule, if it was what it's supposed to do, it's "good" code.
                             
                            You guys are merely being pedantic, and are ignoring (or ignorant of) the realities of real-world development...

                            well said.

                            "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                            "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

                            Z Offline
                            Z Offline
                            ZurdoDev
                            wrote on last edited by
                            #80

                            Well said by a slacker. Slackers think working code is good code. Because they are too lazy to have to maintain it. :)

                            There are only 10 types of people in the world, those who understand binary and those who don't.

                            1 Reply Last reply
                            0
                            • S Slacker007

                              _Maxxx_ wrote:

                              this is good code according to JSOP

                              You and I both know what JSOP meant. ;) ...nice plane.

                              "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                              "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

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

                              Yep - I know what he meant - and he s wrong.

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

                              S 1 Reply Last reply
                              0
                              • S Slacker007

                                Who determines if your code is good? What is good code and what are the precise criteria for giving it a status of "good"? Since most of your code will never be reviewed by your peers (outside of work) then how do you know it is worth a damn, really? If I think your code sucks but the next guy thinks it is good, then who is right? This kind of goes in line with my other thoughts about the "greatness" of an individual programmer. Who determines that a person is a great programmer and that person writes some damn good code? You? Me? None of the above? We obviously cannot make this determination about ourselves or our code. So who does?

                                "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                                "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

                                A Offline
                                A Offline
                                andreah
                                wrote on last edited by
                                #82

                                "...We obviously cannot make this determination about ourselves or our code. So who does?..." The next guy who has to maintain it, of course! That is works (or at least that you think it does) goes without saying. Kind of amazed that this discussion has been all about functionality and appearance, and not about maintainability. Anecdote#1: Worked with an arrogant jerk. After having to enhance his code, I forgave him. It was clear as a bell. Anecdote#2: Had to add a third parallel feature to some code. Boss said, no problem, should be quick because the last guy in there was supposed to make that easy - object oriented blah blah. Well, he cut & pasted the original code, changed the bits that needed to be different and forced me to rewrite his code in addition to adding mine, quadrupling the project time estimate. HIS code "worked." It just made what followed more trouble time and expense. (Oh, and made ME look bad, because although his project was "on time" mine was not!)

                                1 Reply Last reply
                                0
                                • C CPallini

                                  V. wrote:

                                  but in the end, if the client is happy and the application works, it is not bad code

                                  It may be ugly, though.

                                  Veni, vidi, vici.

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

                                  being ugly does not, by itself, make it bad, as long as it is WORKING code

                                  L M 2 Replies Last reply
                                  0
                                  • L Lost User

                                    Yep - I know what he meant - and he s wrong.

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

                                    S Offline
                                    S Offline
                                    Slacker007
                                    wrote on last edited by
                                    #84

                                    _Maxxx_ wrote:

                                    and he s wrong.

                                    your opinion. Many great programmers responded to my question, all with different ideas and answers. Many of them share the same view as John. Are they wrong as well? One of the points of my question was, who determines good code? Which person's determination is really correct. You have an opinion but your opinion is not fact.

                                    "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                                    "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

                                    L L 2 Replies Last reply
                                    0
                                    • L Lost User

                                      being ugly does not, by itself, make it bad, as long as it is WORKING code

                                      L Offline
                                      L Offline
                                      Layinka
                                      wrote on last edited by
                                      #85

                                      Working code has to be reusable too,if not 6 months later

                                      1 Reply Last reply
                                      0
                                      • S SSEAR

                                        public int Add(int num1, int num2)
                                        {
                                        return num1 + num2;
                                        }

                                        public int Add(int num1, int num2)
                                        {
                                        return num1 + num2 - 0;
                                        }

                                        Both code will work as it designed for. But which one is the best code?

                                        L Offline
                                        L Offline
                                        Layinka
                                        wrote on last edited by
                                        #86

                                        But if we write code like that we are gonna end up wasting proccesors, so of course option1 is true.

                                        1 Reply Last reply
                                        0
                                        • L Lost User

                                          being ugly does not, by itself, make it bad, as long as it is WORKING code

                                          M Offline
                                          M Offline
                                          Marbry Hardin
                                          wrote on last edited by
                                          #87

                                          Actually it can. Just because something is working, right here, right now does not mean that it's good code. It simply means that it was adequate in the moment. People leave, move to different positions etc... so the chances are high that someone else will have to follow along and attempt to update or add to your code. If they can't figure it out, or unknowingly spawn bugs because it's so difficult to follow the horrible mess you left then I don't think that fits what one would call good code. When there are pressing business reasons driving those changes or additions, that "good code" suddenly looks much less "good". Even changing your own code, if you don't design it well it's very easy to get caught with your pants down when unexpected requests make you realize that you need to rewrite a large part of an application. This also seems to be one of the harder concepts to communicate to business people, the need for time to structure seemingly simple things properly. Sweat more now, bleed less later and all that. Still, sometimes you just have to hack it up and get something working, but it shouldn't be the default approach.

                                          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