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. Other Discussions
  3. The Insider News
  4. Clean code principles: everything's relative

Clean code principles: everything's relative

Scheduled Pinned Locked Moved The Insider News
comdevops
11 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Kent Sharkey

    IT Pro Today[^]:

    When you start to break down clean code principles, what counts as clean code to one person may not to another.

    "All will come out in the washing."

    realJSOPR Offline
    realJSOPR Offline
    realJSOP
    wrote on last edited by
    #2

    From the article: _For example, most programmers know what “i++” means, and prefer to use it to increment integers instead of writing out a more tedious phrase like “i=i+1.” But i++ is a shorthand, and shorthands breed ambiguity and uncertainty._ If "most programmers" know what it means, is it really an ambiguity? Follow-up question - at what point does an "ambiguity" fall into the realm of "common practice", and when you're classing code as ambiguous, what is the target audience for the classification? Lastly, reasonably enforced coding standards go a long way towards developing clean code, especially in a team environment, because as a member of a team with said standards, at least you can expect the code to look a certain way.

    ".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
    -----
    When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

    J 1 Reply Last reply
    0
    • K Kent Sharkey

      IT Pro Today[^]:

      When you start to break down clean code principles, what counts as clean code to one person may not to another.

      "All will come out in the washing."

      M Offline
      M Offline
      Mark_Wallace
      wrote on last edited by
      #3

      Quote:

      Christopher Tozzi, who does not write code, but just looks at it, said:

      Here are some guidelines that are almost universally accepted

      ... And then demanded that everyone follow guidelines that he prefers, and not follow "almost universally accepted" guidelines that are not to his preference. As John said, his declaring the almost universally accepted i++ as being "ambiguous" is ridiculous -- it has one and only one meaning, and everyone knows that meaning. Perhaps this non-coding "writer" should learn how to use a dictionary, before opening his mouth, and focus on doing his own job properly, before bitching at the way professional coders do theirs.

      I wanna be a eunuchs developer! Pass me a bread knife!

      H 1 Reply Last reply
      0
      • realJSOPR realJSOP

        From the article: _For example, most programmers know what “i++” means, and prefer to use it to increment integers instead of writing out a more tedious phrase like “i=i+1.” But i++ is a shorthand, and shorthands breed ambiguity and uncertainty._ If "most programmers" know what it means, is it really an ambiguity? Follow-up question - at what point does an "ambiguity" fall into the realm of "common practice", and when you're classing code as ambiguous, what is the target audience for the classification? Lastly, reasonably enforced coding standards go a long way towards developing clean code, especially in a team environment, because as a member of a team with said standards, at least you can expect the code to look a certain way.

        ".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
        -----
        When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

        J Offline
        J Offline
        jesarg
        wrote on last edited by
        #4

        The author briefly touched a large topic: Excessive shorthand. Excessive shorthand is: - Well-known in one subculture (such as C-style language devs) - Initially confusing to outsiders - Problematic for far-off future devs who don't know past languages and frameworks A better example: Lots of C# shorthand in one statement:

        public long MyDistance { get; set; } = 0L;

        Long-time C# devs know instantly what it means. It looks like garbage to outsiders.

        H 1 Reply Last reply
        0
        • J jesarg

          The author briefly touched a large topic: Excessive shorthand. Excessive shorthand is: - Well-known in one subculture (such as C-style language devs) - Initially confusing to outsiders - Problematic for far-off future devs who don't know past languages and frameworks A better example: Lots of C# shorthand in one statement:

          public long MyDistance { get; set; } = 0L;

          Long-time C# devs know instantly what it means. It looks like garbage to outsiders.

          H Offline
          H Offline
          honey the codewitch
          wrote on last edited by
          #5

          to be fair, most of the stuff they've added with C# 8 looks like garbage to me.

          When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

          1 Reply Last reply
          0
          • M Mark_Wallace

            Quote:

            Christopher Tozzi, who does not write code, but just looks at it, said:

            Here are some guidelines that are almost universally accepted

            ... And then demanded that everyone follow guidelines that he prefers, and not follow "almost universally accepted" guidelines that are not to his preference. As John said, his declaring the almost universally accepted i++ as being "ambiguous" is ridiculous -- it has one and only one meaning, and everyone knows that meaning. Perhaps this non-coding "writer" should learn how to use a dictionary, before opening his mouth, and focus on doing his own job properly, before bitching at the way professional coders do theirs.

            I wanna be a eunuchs developer! Pass me a bread knife!

            H Offline
            H Offline
            honey the codewitch
            wrote on last edited by
            #6

            ++i must send him into fits. I just want to code for loops at him to see how long it takes him to have an aneurysm.

            for(int ic=list.Count,i=0;i

            TAKE THAT MISTER NAGGY MAN!

            or one of my favorite C# iteration constructs

            string line;
            while(null!=(line=reader.ReadLine());

            i'm sure everyone hates me for that.

            When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

            R 1 Reply Last reply
            0
            • H honey the codewitch

              ++i must send him into fits. I just want to code for loops at him to see how long it takes him to have an aneurysm.

              for(int ic=list.Count,i=0;i

              TAKE THAT MISTER NAGGY MAN!

              or one of my favorite C# iteration constructs

              string line;
              while(null!=(line=reader.ReadLine());

              i'm sure everyone hates me for that.

              When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

              R Offline
              R Offline
              Rick York
              wrote on last edited by
              #7

              Well, seeing how it violates at least two typical coding standard tenets I can see why. :cool:

              "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

              H 1 Reply Last reply
              0
              • R Rick York

                Well, seeing how it violates at least two typical coding standard tenets I can see why. :cool:

                "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                H Offline
                H Offline
                honey the codewitch
                wrote on last edited by
                #8

                only two? rules were made to be broken.

                When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                R 1 Reply Last reply
                0
                • H honey the codewitch

                  only two? rules were made to be broken.

                  When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                  R Offline
                  R Offline
                  Rick York
                  wrote on last edited by
                  #9

                  You rebel, you. :)

                  "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                  1 Reply Last reply
                  0
                  • K Kent Sharkey

                    IT Pro Today[^]:

                    When you start to break down clean code principles, what counts as clean code to one person may not to another.

                    "All will come out in the washing."

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

                    In other words it comes down to community standards, just like pornography. One person's art is another person's smut.

                    Software Zen: delete this;

                    K 1 Reply Last reply
                    0
                    • G Gary Wheeler

                      In other words it comes down to community standards, just like pornography. One person's art is another person's smut.

                      Software Zen: delete this;

                      K Offline
                      K Offline
                      Kent Sharkey
                      wrote on last edited by
                      #11

                      Except for Perl. That's always smut :)

                      TTFN - Kent

                      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