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 Weird and The Wonderful
  4. Somewhat of a jem...

Somewhat of a jem...

Scheduled Pinned Locked Moved The Weird and The Wonderful
7 Posts 6 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.
  • C Offline
    C Offline
    cliran
    wrote on last edited by
    #1

    just look at this beauty:

    m_fooDictionary[m_fooList[p_fooIndex].BarTypeEnum][oldState]--;

    the interesting thing is that this line is repeated numerous times across a 1500+ lines class, sometimes with "++" or "--" at the end.. truly a great way to start off your day

    P L 2 Replies Last reply
    0
    • C cliran

      just look at this beauty:

      m_fooDictionary[m_fooList[p_fooIndex].BarTypeEnum][oldState]--;

      the interesting thing is that this line is repeated numerous times across a 1500+ lines class, sometimes with "++" or "--" at the end.. truly a great way to start off your day

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

      Looks OK, just add some horizontal space.

      _ T 2 Replies Last reply
      0
      • P PIEBALDconsult

        Looks OK, just add some horizontal space.

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        No error checking for array bounds.

        «_Superman_»

        P 1 Reply Last reply
        0
        • _ _Superman_

          No error checking for array bounds.

          «_Superman_»

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

          There might be, just not in that snippet, or maybe that's was a design decision, I can't tell from just that one statement.

          1 Reply Last reply
          0
          • P PIEBALDconsult

            Looks OK, just add some horizontal space.

            T Offline
            T Offline
            Thomas Weller 0
            wrote on last edited by
            #5

            PIEBALDconsult wrote:

            Looks OK

            Yes, if you mean OK as in syntactically correct. But it's not very readable, this statement seems to say: I don't care too much about my team mates and/or maintainability. And if that is repeated many times throughout the class, sometimes with one -, sometimes with two, then it is only a question of time until a problem related to these statements will occur.

            www.thomas-weller.de Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
            Programmer - an organism that turns coffee into software.

            S 1 Reply Last reply
            0
            • T Thomas Weller 0

              PIEBALDconsult wrote:

              Looks OK

              Yes, if you mean OK as in syntactically correct. But it's not very readable, this statement seems to say: I don't care too much about my team mates and/or maintainability. And if that is repeated many times throughout the class, sometimes with one -, sometimes with two, then it is only a question of time until a problem related to these statements will occur.

              www.thomas-weller.de Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
              Programmer - an organism that turns coffee into software.

              S Offline
              S Offline
              supercat9
              wrote on last edited by
              #6

              Thomas Weller wrote:

              And if that is repeated many times throughout the class, sometimes with one -, sometimes with two, then it is only a question of time until a problem related to these statements will occur.

              How could there be one '-'? Would that even parse? (BTW, the inability to parse a single trailing plus minus would seem a reason to favor i++ over ++i when the two operations would otherwise be interchangeable). If there were only one or two such statements in the code, I would probably be inclined to create temporary variables to hold the outputs of the various subexpressions. If the exact bit of code is repeated extremely often, I might be inclined to define a separate method for it. Otherwise I would expect someone parsing the code to example that classes referenced therein and determine what the different methods or properties mean. The expression seems pretty straightforward; if it only appeared once, expanding it to use temporary variables would make it easier to read, but if it appears many times, expanding it in such fashion would make one instance (the first one examined) easier to read and the rest bloated and annoying.

              1 Reply Last reply
              0
              • C cliran

                just look at this beauty:

                m_fooDictionary[m_fooList[p_fooIndex].BarTypeEnum][oldState]--;

                the interesting thing is that this line is repeated numerous times across a 1500+ lines class, sometimes with "++" or "--" at the end.. truly a great way to start off your day

                L Offline
                L Offline
                leppie
                wrote on last edited by
                #7

                Perfect for a Scheme macro, oh wait! You are not using Scheme! ;P

                xacc.ide - now with TabsToSpaces support
                IronScheme - 1.0 beta 2 - out now!
                ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))

                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