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. I don't like code reviews

I don't like code reviews

Scheduled Pinned Locked Moved The Lounge
csharpcomperformancetutorialquestion
74 Posts 33 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.
  • G Gary R Wheeler

    I use descriptive names, which tend to be long. Short names in my code depend upon context. Here's an example:

    for (int JMi = 0; JMi < JettingModules.Length; JMi++)
    {
    JettingModules[JMi].DoStuff(...);
    }

    I will occasionally use short names synonymously to long names in order to make a complex expression simpler to understand or read:

    bool ready = StitchCalibration.Context.Ready(...);
    bool online = Framework.Online && DFE.Service.Connected;
    int retry = 0;
    while (ready && online && (retry < 3))
    {
    //...
    }

    My names are chosen to tie related concepts together and for clarity of expression.

    Software Zen: delete this;

    B Offline
    B Offline
    BillWoodruff
    wrote on last edited by
    #45

    "depends on context" Amen !

    «The mind is not a vessel to be filled but a fire to be kindled» Plutarch

    1 Reply Last reply
    0
    • K kmoorevs

      In 23 years, I've never had my code reviewed. I feel lucky! :)

      "Go forth into the source" - Neal Morse "Hope is contagious"

      B Offline
      B Offline
      BernardIE5317
      wrote on last edited by
      #46

      Greetings I have never had my code reviewed either but wouldn't mind if it were I might learn something or perhaps teach the reviewer a thing or two - Cheerio PS As for coding styles I also prefer long descriptive names for identifiers which set the context and short for those in context Also I have always used different naming conventions to indicate scope i.e. local class global This varies though I always utilize snake for local and am tending to camel for class and 'g' prefix for the rare global "I once put instant coffee into the microwave and went back in time." - Steven Wright "Shut up and calculate" - apparently N. David Mermin possibly Richard Feynman

      1 Reply Last reply
      0
      • S Super Lloyd

        ok, sometimes there are very good comments... but every time the reviews are waaaaay too slow. and very often there are comments which are both useless, antagonistic and a big waste of time... for example I don't see the point of long variable name nor do I like them, particularly for a short liner like

        double Value
        {
        get
        {
        var x = Calculation();
        return flag ? x : 2 * x;
        }
        }

        And have to wait a few more hours because I was told 'not to use short variable name'. Unsure I renamed 'x' to 'aNumber', but that irks me... On top of that, that might be just me with my bad memory, but I find long variable name harder to read! :omg: For example a simple expression like a = b + c can confuse me if you write instead myobjectBlu = aCycleValueOrdinal + meteorStrikeOffsetTime. Why they not care about making the code easier to understand?! :(( ok, ok, I need to get over it. just venting here! :laugh: Joke aside, you might like long variable name, but you won't convince me. save everyone's time and let's just agree to disagree. Or disagree to disagree, if you prefer... EDIT Upon reflection, I might be part of a minority of people with reading disability.. :(( When reading long sentence I am skipping words and filling in by guess. Similarly long line of C# requires me multiple reading. And it kind of depends on the overall number of character, not words... So I guess normal people comes with their usually suck it up, I am fine... :sigh:

        A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

        B Offline
        B Offline
        BernardIE5317
        wrote on last edited by
        #47

        Greetings My code has never been reviewed but am curious if it were I might learn something or teach the reviewer a thing or two Wouldn't mind reviewing others' for the same reason- Cheerio PS As for naming It seems obvious names should be as long as necessary to indicate intent when they set context Short is fine once context is set Also the name can indicate the type and value range of the identifier e.g. "calculateWidth_ofImpendingMeteorStroke" will never return a negative value Further have some sympathy for the poor chap who will maintain the code or for yourself many months or years hence Further I like to utilize different naming conventions to indicate the scope of the identifier I always utilize snake for local and now tend to camel for class and prefix with a 'g' for the rare global "I once put instant coffee into the microwave and went back in time." - Steven Wright "Shut up and calculate" - apparently N. David Mermin possibly Richard Feynman

        S 1 Reply Last reply
        0
        • B BernardIE5317

          Greetings My code has never been reviewed but am curious if it were I might learn something or teach the reviewer a thing or two Wouldn't mind reviewing others' for the same reason- Cheerio PS As for naming It seems obvious names should be as long as necessary to indicate intent when they set context Short is fine once context is set Also the name can indicate the type and value range of the identifier e.g. "calculateWidth_ofImpendingMeteorStroke" will never return a negative value Further have some sympathy for the poor chap who will maintain the code or for yourself many months or years hence Further I like to utilize different naming conventions to indicate the scope of the identifier I always utilize snake for local and now tend to camel for class and prefix with a 'g' for the rare global "I once put instant coffee into the microwave and went back in time." - Steven Wright "Shut up and calculate" - apparently N. David Mermin possibly Richard Feynman

          S Offline
          S Offline
          Super Lloyd
          wrote on last edited by
          #48

          If you use Git you are likely, but not necessarily, to have review. (not using Git here thought) At any rate, certainly, every now and then there is very good feedback in review. However every single time it waste a lot of time.

          A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

          1 Reply Last reply
          0
          • S Super Lloyd

            so we disagree to disagree then? I find the later no easier.. In fact some interesting brain chemistry must be at work here... I was reflecting how physicist (that's my background), prefer short name too, i.e. it'e E=mc^2, not Energy = Mass * SpeedOfLight^2, to vindicate me... Anyway, regardless, it's more interesting to consider what psychological factor lead from one to another. I know that for me, bad work memory favor short variable names. Long variable names are just too hard, I have to read the statement 2 or 3 times to get it. 1 or 2 time to get all the variables involved, and one more time to get the computation. I can get all that in one go/read with shorter text - i.e. short variable names and simple math. Maybe I have some sort of dyslexia or something, I tend to not read big wall of text very accurately. Not just in code but also in plain English... Hence for me shorter variable name increasing my accuracy / understanding... :sigh:

            A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

            H Offline
            H Offline
            harvyk0
            wrote on last edited by
            #49

            We have a rule, if an acronym is well known, then we use it (eg url rather than universal resource locator), otherwise we spell out the full words. A few years ago we where working on a system which had a limitation on some names, but we needed those names to be descriptive of the keys. We ended up with a jumble of 3 letter acronyms everywhere. Sure enough, the parts we touched frequently where easy enough to deal with, but gee looking at some of the sections which remained fairly static was a nightmare to determine what was going on and what held what data.

            S 1 Reply Last reply
            0
            • H harvyk0

              We have a rule, if an acronym is well known, then we use it (eg url rather than universal resource locator), otherwise we spell out the full words. A few years ago we where working on a system which had a limitation on some names, but we needed those names to be descriptive of the keys. We ended up with a jumble of 3 letter acronyms everywhere. Sure enough, the parts we touched frequently where easy enough to deal with, but gee looking at some of the sections which remained fairly static was a nightmare to determine what was going on and what held what data.

              S Offline
              S Offline
              Super Lloyd
              wrote on last edited by
              #50

              you missed the part where I was talking about a variable.. inside a method...

              A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

              H 1 Reply Last reply
              0
              • S Super Lloyd

                ok, sometimes there are very good comments... but every time the reviews are waaaaay too slow. and very often there are comments which are both useless, antagonistic and a big waste of time... for example I don't see the point of long variable name nor do I like them, particularly for a short liner like

                double Value
                {
                get
                {
                var x = Calculation();
                return flag ? x : 2 * x;
                }
                }

                And have to wait a few more hours because I was told 'not to use short variable name'. Unsure I renamed 'x' to 'aNumber', but that irks me... On top of that, that might be just me with my bad memory, but I find long variable name harder to read! :omg: For example a simple expression like a = b + c can confuse me if you write instead myobjectBlu = aCycleValueOrdinal + meteorStrikeOffsetTime. Why they not care about making the code easier to understand?! :(( ok, ok, I need to get over it. just venting here! :laugh: Joke aside, you might like long variable name, but you won't convince me. save everyone's time and let's just agree to disagree. Or disagree to disagree, if you prefer... EDIT Upon reflection, I might be part of a minority of people with reading disability.. :(( When reading long sentence I am skipping words and filling in by guess. Similarly long line of C# requires me multiple reading. And it kind of depends on the overall number of character, not words... So I guess normal people comes with their usually suck it up, I am fine... :sigh:

                A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                W Offline
                W Offline
                Wizard of Sleeves
                wrote on last edited by
                #51

                Right, tell your maths lecturer to use long variable names, instead of x and y.

                Nothing succeeds like a budgie without teeth.

                S 1 Reply Last reply
                0
                • S Super Lloyd

                  so we disagree to disagree then? I find the later no easier.. In fact some interesting brain chemistry must be at work here... I was reflecting how physicist (that's my background), prefer short name too, i.e. it'e E=mc^2, not Energy = Mass * SpeedOfLight^2, to vindicate me... Anyway, regardless, it's more interesting to consider what psychological factor lead from one to another. I know that for me, bad work memory favor short variable names. Long variable names are just too hard, I have to read the statement 2 or 3 times to get it. 1 or 2 time to get all the variables involved, and one more time to get the computation. I can get all that in one go/read with shorter text - i.e. short variable names and simple math. Maybe I have some sort of dyslexia or something, I tend to not read big wall of text very accurately. Not just in code but also in plain English... Hence for me shorter variable name increasing my accuracy / understanding... :sigh:

                  A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                  M Offline
                  M Offline
                  Mike Winiberg
                  wrote on last edited by
                  #52

                  In an IT class I had to help someone who was a competent coder, but had a similar problem (he was dyslexic). The course specified that you should use descriptive variable names (fortunately not hungarian though). We reached a compromise: he could use short variable names wherever possible (eg inside small functional units of code - as per your example) but had to add a comment at the start of the code that explained what the variables represented. This had to be only in code that could fit on the screen so it could be read in one hit. Ignoring - for now - the fact that no developer I've ever met (including me!) is good at keeping comments in step with the code, nevertheless this seemed a workable compromise: He could write code he could follow and there was at least a reasonable chance that the comments would give a good hint as to what was going on.

                  1 Reply Last reply
                  0
                  • S Super Lloyd

                    you missed the part where I was talking about a variable.. inside a method...

                    A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                    H Offline
                    H Offline
                    harvyk0
                    wrote on last edited by
                    #53

                    I've also seen enough var x = 1; var y = 2; var z = 3; type code in methods to know that single letter / acronym variable names can be bad, especially that method has grown a little too big. Whilst variable names should never be war and piece, they should be somewhat descriptive enough so that as a developer you know what values you're likely to see in there, and how they should be used. That said, I'll happily use for (var i = 0; i < 10; i++) {} without thinking twice, so you know I'm not 100% dedicated to the no small variable names cause.

                    1 Reply Last reply
                    0
                    • S Super Lloyd

                      ok, sometimes there are very good comments... but every time the reviews are waaaaay too slow. and very often there are comments which are both useless, antagonistic and a big waste of time... for example I don't see the point of long variable name nor do I like them, particularly for a short liner like

                      double Value
                      {
                      get
                      {
                      var x = Calculation();
                      return flag ? x : 2 * x;
                      }
                      }

                      And have to wait a few more hours because I was told 'not to use short variable name'. Unsure I renamed 'x' to 'aNumber', but that irks me... On top of that, that might be just me with my bad memory, but I find long variable name harder to read! :omg: For example a simple expression like a = b + c can confuse me if you write instead myobjectBlu = aCycleValueOrdinal + meteorStrikeOffsetTime. Why they not care about making the code easier to understand?! :(( ok, ok, I need to get over it. just venting here! :laugh: Joke aside, you might like long variable name, but you won't convince me. save everyone's time and let's just agree to disagree. Or disagree to disagree, if you prefer... EDIT Upon reflection, I might be part of a minority of people with reading disability.. :(( When reading long sentence I am skipping words and filling in by guess. Similarly long line of C# requires me multiple reading. And it kind of depends on the overall number of character, not words... So I guess normal people comes with their usually suck it up, I am fine... :sigh:

                      A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                      M Offline
                      M Offline
                      Member 9167057
                      wrote on last edited by
                      #54

                      I personally like descriptive names. atoi is way less readable, than StringToInt, for example. But that's a library function (I'm working polyglot, but not everyone is), what about own functions? When I write code, I like writing it in a way that makes clear what it does. Sure, I could litter it with comments, but too much of a good thing is real. So I have functions named DecodeL7 (with L standing for "layer" which, I admit, may be not explanatory enough). My variable to hold the L7 buffer is named accordingly, L7Buffer. Inside the DecodeL7 function, the variable name is just L7, it being a buffer is kinda obvious from context. The example above however is a bad one. Calculation() does exactly 0 to tell the maintainer (who may be another person, or oneself in 10 years) what the code does, so it may just as well be DoIt() or frob() or just f(). With every modern programming environment supporting unicode, there's a plethora of one-letter identifiers. ä(µ) isn't readable though. At all. If it's not code I'm working on daily, I know I'll forget what it's doing after taking care of another product for a month. As for my reading habits, I indeed parse whole words at once, both in code and in text. As for useless code review comments, a co-worker of mine is the kind of guy saying, almost verbatim, "I've learned it that way half a century ago and I'll never learn anything ever again". Needless to say, his comments during code reviews are utter shite.

                      1 Reply Last reply
                      0
                      • W Wizard of Sleeves

                        Right, tell your maths lecturer to use long variable names, instead of x and y.

                        Nothing succeeds like a budgie without teeth.

                        S Offline
                        S Offline
                        Super Lloyd
                        wrote on last edited by
                        #55

                        Haha... 25 years and 20,000km too far and too late

                        A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                        1 Reply Last reply
                        0
                        • S Super Lloyd

                          ok, sometimes there are very good comments... but every time the reviews are waaaaay too slow. and very often there are comments which are both useless, antagonistic and a big waste of time... for example I don't see the point of long variable name nor do I like them, particularly for a short liner like

                          double Value
                          {
                          get
                          {
                          var x = Calculation();
                          return flag ? x : 2 * x;
                          }
                          }

                          And have to wait a few more hours because I was told 'not to use short variable name'. Unsure I renamed 'x' to 'aNumber', but that irks me... On top of that, that might be just me with my bad memory, but I find long variable name harder to read! :omg: For example a simple expression like a = b + c can confuse me if you write instead myobjectBlu = aCycleValueOrdinal + meteorStrikeOffsetTime. Why they not care about making the code easier to understand?! :(( ok, ok, I need to get over it. just venting here! :laugh: Joke aside, you might like long variable name, but you won't convince me. save everyone's time and let's just agree to disagree. Or disagree to disagree, if you prefer... EDIT Upon reflection, I might be part of a minority of people with reading disability.. :(( When reading long sentence I am skipping words and filling in by guess. Similarly long line of C# requires me multiple reading. And it kind of depends on the overall number of character, not words... So I guess normal people comes with their usually suck it up, I am fine... :sigh:

                          A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                          M Offline
                          M Offline
                          Matthew Wilcoxson
                          wrote on last edited by
                          #56

                          Agreed. Can't stand them either. Just let me do my job. You don't need to be included. Go away and do your job. If you have a problem with my code, you are welcome to fix it on YOUR OWN time. And FYI, I might have a problem with your code too, but I'm not arrogant/rude/petty/anal enough to tell you. I'm not here to look over your shoulder, you need to be able to work on your own. If you are happy that the code works, the team are happy too. That felt good.

                          B 1 Reply Last reply
                          0
                          • S Super Lloyd

                            ok, sometimes there are very good comments... but every time the reviews are waaaaay too slow. and very often there are comments which are both useless, antagonistic and a big waste of time... for example I don't see the point of long variable name nor do I like them, particularly for a short liner like

                            double Value
                            {
                            get
                            {
                            var x = Calculation();
                            return flag ? x : 2 * x;
                            }
                            }

                            And have to wait a few more hours because I was told 'not to use short variable name'. Unsure I renamed 'x' to 'aNumber', but that irks me... On top of that, that might be just me with my bad memory, but I find long variable name harder to read! :omg: For example a simple expression like a = b + c can confuse me if you write instead myobjectBlu = aCycleValueOrdinal + meteorStrikeOffsetTime. Why they not care about making the code easier to understand?! :(( ok, ok, I need to get over it. just venting here! :laugh: Joke aside, you might like long variable name, but you won't convince me. save everyone's time and let's just agree to disagree. Or disagree to disagree, if you prefer... EDIT Upon reflection, I might be part of a minority of people with reading disability.. :(( When reading long sentence I am skipping words and filling in by guess. Similarly long line of C# requires me multiple reading. And it kind of depends on the overall number of character, not words... So I guess normal people comes with their usually suck it up, I am fine... :sigh:

                            A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                            E Offline
                            E Offline
                            Eric R Johansson
                            wrote on last edited by
                            #57

                            How about double Value => Calculation() * (flag ? 1 : 2); Now you don't need to deal with any variable names. =) // E

                            S 1 Reply Last reply
                            0
                            • E Eric R Johansson

                              How about double Value => Calculation() * (flag ? 1 : 2); Now you don't need to deal with any variable names. =) // E

                              S Offline
                              S Offline
                              Super Lloyd
                              wrote on last edited by
                              #58

                              in my real case there were 4 if statement that return either, 0, 0, w, 2 * w. except w was not good. was asked to change it 3 times through afternoon long message ping pong. first to something else. then from aNumber to number. then from number to width.

                              A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                              E 1 Reply Last reply
                              0
                              • S Super Lloyd

                                in my real case there were 4 if statement that return either, 0, 0, w, 2 * w. except w was not good. was asked to change it 3 times through afternoon long message ping pong. first to something else. then from aNumber to number. then from number to width.

                                A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                                E Offline
                                E Offline
                                Eric R Johansson
                                wrote on last edited by
                                #59

                                Yeah sorry, my comment was pretty OT. I really don't like codereviews either but they do serve a purpose, when they're done properly. Fussing over the name of a variable is not doing it properly. // E

                                1 Reply Last reply
                                0
                                • S Super Lloyd

                                  ok, sometimes there are very good comments... but every time the reviews are waaaaay too slow. and very often there are comments which are both useless, antagonistic and a big waste of time... for example I don't see the point of long variable name nor do I like them, particularly for a short liner like

                                  double Value
                                  {
                                  get
                                  {
                                  var x = Calculation();
                                  return flag ? x : 2 * x;
                                  }
                                  }

                                  And have to wait a few more hours because I was told 'not to use short variable name'. Unsure I renamed 'x' to 'aNumber', but that irks me... On top of that, that might be just me with my bad memory, but I find long variable name harder to read! :omg: For example a simple expression like a = b + c can confuse me if you write instead myobjectBlu = aCycleValueOrdinal + meteorStrikeOffsetTime. Why they not care about making the code easier to understand?! :(( ok, ok, I need to get over it. just venting here! :laugh: Joke aside, you might like long variable name, but you won't convince me. save everyone's time and let's just agree to disagree. Or disagree to disagree, if you prefer... EDIT Upon reflection, I might be part of a minority of people with reading disability.. :(( When reading long sentence I am skipping words and filling in by guess. Similarly long line of C# requires me multiple reading. And it kind of depends on the overall number of character, not words... So I guess normal people comes with their usually suck it up, I am fine... :sigh:

                                  A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                                  C Offline
                                  C Offline
                                  Cpichols
                                  wrote on last edited by
                                  #60

                                  Code should be easy to skim for the easy bits, so using descriptive variables is helpful, as is insertion of concise comments, but descriptive needn't be long. Also, as long as you keep in mind the scope of each variable and are doing any trash collection that is needed by your language choice, then short names are fine, especially as iterators. Just don't be lazy and leave a variable living longer than it is needed.

                                  S 1 Reply Last reply
                                  0
                                  • S Super Lloyd

                                    ok, sometimes there are very good comments... but every time the reviews are waaaaay too slow. and very often there are comments which are both useless, antagonistic and a big waste of time... for example I don't see the point of long variable name nor do I like them, particularly for a short liner like

                                    double Value
                                    {
                                    get
                                    {
                                    var x = Calculation();
                                    return flag ? x : 2 * x;
                                    }
                                    }

                                    And have to wait a few more hours because I was told 'not to use short variable name'. Unsure I renamed 'x' to 'aNumber', but that irks me... On top of that, that might be just me with my bad memory, but I find long variable name harder to read! :omg: For example a simple expression like a = b + c can confuse me if you write instead myobjectBlu = aCycleValueOrdinal + meteorStrikeOffsetTime. Why they not care about making the code easier to understand?! :(( ok, ok, I need to get over it. just venting here! :laugh: Joke aside, you might like long variable name, but you won't convince me. save everyone's time and let's just agree to disagree. Or disagree to disagree, if you prefer... EDIT Upon reflection, I might be part of a minority of people with reading disability.. :(( When reading long sentence I am skipping words and filling in by guess. Similarly long line of C# requires me multiple reading. And it kind of depends on the overall number of character, not words... So I guess normal people comes with their usually suck it up, I am fine... :sigh:

                                    A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                                    R Offline
                                    R Offline
                                    RooN3y
                                    wrote on last edited by
                                    #61

                                    One thing not mentioned in the other replies is the readability from the very first word. In your example of

                                    a = b + c

                                    If a was named better then I wouldn't need to read the rest of the code to understand what I'm dealing with. So in the long run I can gain general understanding at a glance. You should only need to dig deeper if you need to, and with each well described method and variable I can gain a better understanding. Personally a = b + c is a bit lazy and I wouldn't want to have to maintain your code. This talk on Clean code really hits the nail on the head for me when it comes to clean code - JeremyBytes Live! - Clean Code: Homicidal Maniacs Read Code, Too! - YouTube[^]

                                    1 Reply Last reply
                                    0
                                    • S Super Lloyd

                                      ok, sometimes there are very good comments... but every time the reviews are waaaaay too slow. and very often there are comments which are both useless, antagonistic and a big waste of time... for example I don't see the point of long variable name nor do I like them, particularly for a short liner like

                                      double Value
                                      {
                                      get
                                      {
                                      var x = Calculation();
                                      return flag ? x : 2 * x;
                                      }
                                      }

                                      And have to wait a few more hours because I was told 'not to use short variable name'. Unsure I renamed 'x' to 'aNumber', but that irks me... On top of that, that might be just me with my bad memory, but I find long variable name harder to read! :omg: For example a simple expression like a = b + c can confuse me if you write instead myobjectBlu = aCycleValueOrdinal + meteorStrikeOffsetTime. Why they not care about making the code easier to understand?! :(( ok, ok, I need to get over it. just venting here! :laugh: Joke aside, you might like long variable name, but you won't convince me. save everyone's time and let's just agree to disagree. Or disagree to disagree, if you prefer... EDIT Upon reflection, I might be part of a minority of people with reading disability.. :(( When reading long sentence I am skipping words and filling in by guess. Similarly long line of C# requires me multiple reading. And it kind of depends on the overall number of character, not words... So I guess normal people comes with their usually suck it up, I am fine... :sigh:

                                      A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                                      B Offline
                                      B Offline
                                      BryanFazekas
                                      wrote on last edited by
                                      #62

                                      Super Lloyd wrote:

                                      And have to wait a few more hours because I was told 'not to use short variable name'. Unsure I renamed 'x' to 'aNumber', but that irks me...

                                      A huge mistake many developers make is thinking of the code as "my code". It is not. It is your employer's code which you are paid to write. As with most other jobs, you are paid to do what your employer wants, not what you want. If the coding standard is to not use 1 character variable names, then it's the programmer's job to do what they are paid to do. That said, the feedback provided was useless. Making an assumption, the feedback should have been "use variable names descriptive of the situation". I've suffered the good, the bad, and the ugly with code reviews. The truly bad was sitting in a room for 8 hours with 10 developers, literally reading and critiquing EVERY line of code. The lead developer had no understanding of what the goal was and he was not one to accept anything remotely resembling criticism. The best? Reviewers were provided with the code and instructions to identify violations of the coding standard, places where the processing was not clear, and suggest corrections. Review of 1,000 lines of C took about 30 minutes with 3 reviewers, as the few problems identified were diagnosed before the meeting so in meeting it was a matter of reach agreement.

                                      1 Reply Last reply
                                      0
                                      • C Cpichols

                                        Code should be easy to skim for the easy bits, so using descriptive variables is helpful, as is insertion of concise comments, but descriptive needn't be long. Also, as long as you keep in mind the scope of each variable and are doing any trash collection that is needed by your language choice, then short names are fine, especially as iterators. Just don't be lazy and leave a variable living longer than it is needed.

                                        S Offline
                                        S Offline
                                        Super Lloyd
                                        wrote on last edited by
                                        #63

                                        see.. you obviously didn't read what I said. I said it is much harder for me to read those long names. I am cool though, however strange, I believe you when you said you find long names easier... I just beg, don't make me suffer for your personal convenience...

                                        A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                                        C 1 Reply Last reply
                                        0
                                        • OriginalGriffO OriginalGriff

                                          I have to agree with David O'Neal - short names are a bad idea. There isn't just the "Understandability" factor, though that is very significant - especially when you look at the code for the first time, or after a long break from it. More significantly one character names are more prone to error, because it's very easy to hit the wrong key and get a valid variable name. While Intellisense can make that happen with more descriptive names as well, it's a lot more obvious that it's wrong. To use your example:

                                          Quote:

                                          it'e E=mc^2, not Energy = Mass * SpeedOfLight^2, to vindicate me...

                                          E=nc^2

                                          Looks vaguely right and it's easy to miss the mistake when skimming, but the longer form:

                                          Energy = numberOfCatsInTheBox * SpeedOfLight^2

                                          Is immediately wrong. And ... if you are anything like me you read what you meant to write, rather than what you did type. So short names make life harder for you, me, and everyone else who has to work with the code - so yes, code reviews should pick them up! I'm not saying that all short names are bad, it's pointless to use a long name here:

                                          for (int i = 0; i < rooms.Count; i++)
                                          {
                                          rooms[i] = new Room();
                                          }

                                          But in general, they are a PITA!

                                          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                                          E Offline
                                          E Offline
                                          Eric Lapouge
                                          wrote on last edited by
                                          #64

                                          for (int room = 0, roomCount = rooms.Count; room < roomCount; room++)
                                          {
                                          rooms[room] = new Room();
                                          }

                                          Il just refuse anything else than something like this, my point of view

                                          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