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. The dev was fired but the havoc is left for us to fix...

The dev was fired but the havoc is left for us to fix...

Scheduled Pinned Locked Moved The Lounge
helpquestion
25 Posts 17 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.
  • A Alberto Bar Noy

    [rant] If forecolor red then disable(control) else if forecolor black then enable(control) [/rant] :mad::mad::mad:

    Alberto Bar-Noy --------------- “The city’s central computer told you? R2D2, you know better than to trust a strange computer!” (C3PO)

    I Offline
    I Offline
    ii_noname_ii
    wrote on last edited by
    #14

    lol, if it works, it works. If you're alone on the project, and get fired, your replacements deserve to go through hell.

    D 1 Reply Last reply
    0
    • A Alberto Bar Noy

      [rant] If forecolor red then disable(control) else if forecolor black then enable(control) [/rant] :mad::mad::mad:

      Alberto Bar-Noy --------------- “The city’s central computer told you? R2D2, you know better than to trust a strange computer!” (C3PO)

      P Offline
      P Offline
      PhilLenoir
      wrote on last edited by
      #15

      My favourite was "delete this" in a class destructor. Hours of ROFL on that one.

      Life is like a s**t sandwich; the more bread you have, the less s**t you eat.

      1 Reply Last reply
      0
      • A Alberto Bar Noy

        [rant] If forecolor red then disable(control) else if forecolor black then enable(control) [/rant] :mad::mad::mad:

        Alberto Bar-Noy --------------- “The city’s central computer told you? R2D2, you know better than to trust a strange computer!” (C3PO)

        E Offline
        E Offline
        englebart
        wrote on last edited by
        #16

        Color-blind users need not apply... It seems that just introducing constants for the colors could help with readability. public const Color NotApplicable = Color.Red but I am pretty sure that this one liner just scrapes the surface.

        A 1 Reply Last reply
        0
        • E englebart

          Color-blind users need not apply... It seems that just introducing constants for the colors could help with readability. public const Color NotApplicable = Color.Red but I am pretty sure that this one liner just scrapes the surface.

          A Offline
          A Offline
          Alberto Bar Noy
          wrote on last edited by
          #17

          It is beyond that. Who bases control state based upon its adjacent text color?????

          Alberto Bar-Noy --------------- “The city’s central computer told you? R2D2, you know better than to trust a strange computer!” (C3PO)

          D M B 3 Replies Last reply
          0
          • G Gizz

            "If forecolor red then disable(control) else if forecolor black then enable(control)" Oooh sounds like a system I had to suffer/work on; not the Credit Derivative VB code at a certain north American bank?! Except, that used colour to denote state, so the controls could be any one of about 6 different colours...

            A Offline
            A Offline
            Alberto Bar Noy
            wrote on last edited by
            #18

            Nope not even close.

            Alberto Bar-Noy --------------- “The city’s central computer told you? R2D2, you know better than to trust a strange computer!” (C3PO)

            1 Reply Last reply
            0
            • I ii_noname_ii

              lol, if it works, it works. If you're alone on the project, and get fired, your replacements deserve to go through hell.

              D Offline
              D Offline
              Dominic Amann
              wrote on last edited by
              #19

              Ah, so it WAS you!

              1 Reply Last reply
              0
              • A Alberto Bar Noy

                It is beyond that. Who bases control state based upon its adjacent text color?????

                Alberto Bar-Noy --------------- “The city’s central computer told you? R2D2, you know better than to trust a strange computer!” (C3PO)

                D Offline
                D Offline
                devenneym
                wrote on last edited by
                #20

                I'm afraid to answer because it forces me into thinking about *why* someone would do this in the first place... ugh.

                1 Reply Last reply
                0
                • A Alberto Bar Noy

                  It is beyond that. Who bases control state based upon its adjacent text color?????

                  Alberto Bar-Noy --------------- “The city’s central computer told you? R2D2, you know better than to trust a strange computer!” (C3PO)

                  M Offline
                  M Offline
                  Michael A Cochran
                  wrote on last edited by
                  #21

                  I'm sure I'll take heat for this but, honestly, I don't think it's that bad. One boolean is (almost) as good as another. Without seeing the rest of the code, it's hard to tell what the intention was. Certainly I would try not to do this but perhaps the developer was attempting to avoid a global variable to hold control state? Or perhaps there are a number of controls who's state has to be managed and the dev wanted to avoid an array or a hash? Perhaps the control state is set from a disconnected object and there is no mechanism to transfer state? I dunno? But it's pretty common to do things like if $('#myid').hasClass('enabled') { // do something }. Other than string processsing to get a boolean, it doesn't seem that far different to me. shrug.

                  A 1 Reply Last reply
                  0
                  • M Michael A Cochran

                    I'm sure I'll take heat for this but, honestly, I don't think it's that bad. One boolean is (almost) as good as another. Without seeing the rest of the code, it's hard to tell what the intention was. Certainly I would try not to do this but perhaps the developer was attempting to avoid a global variable to hold control state? Or perhaps there are a number of controls who's state has to be managed and the dev wanted to avoid an array or a hash? Perhaps the control state is set from a disconnected object and there is no mechanism to transfer state? I dunno? But it's pretty common to do things like if $('#myid').hasClass('enabled') { // do something }. Other than string processsing to get a boolean, it doesn't seem that far different to me. shrug.

                    A Offline
                    A Offline
                    agolddog
                    wrote on last edited by
                    #22

                    Here's the thing though: it's not obvious to some future developer why all of a sudden the control is disabled or enabled. When Alberto finds this, it's still not obvious. If you had something like: if (someBadCondition) { disableControl(); setTextRed(); } [one might abstract more, but you get the idea], then the intention of the developer is exposed. Also, as others have mentioned, it's far too easy to introduce unintentional side-effects: "Oh, you want the red to change to blue? Coming right up..." because new developer doesn't realize that (en)disability of said control is dependent on color (why would it be?). @Alberto: on the plus side, at least your organization got the first part right: you fired the dev.

                    M 1 Reply Last reply
                    0
                    • A Alberto Bar Noy

                      It is beyond that. Who bases control state based upon its adjacent text color?????

                      Alberto Bar-Noy --------------- “The city’s central computer told you? R2D2, you know better than to trust a strange computer!” (C3PO)

                      B Offline
                      B Offline
                      Br Bill
                      wrote on last edited by
                      #23

                      Chameleons?

                      1 Reply Last reply
                      0
                      • A agolddog

                        Here's the thing though: it's not obvious to some future developer why all of a sudden the control is disabled or enabled. When Alberto finds this, it's still not obvious. If you had something like: if (someBadCondition) { disableControl(); setTextRed(); } [one might abstract more, but you get the idea], then the intention of the developer is exposed. Also, as others have mentioned, it's far too easy to introduce unintentional side-effects: "Oh, you want the red to change to blue? Coming right up..." because new developer doesn't realize that (en)disability of said control is dependent on color (why would it be?). @Alberto: on the plus side, at least your organization got the first part right: you fired the dev.

                        M Offline
                        M Offline
                        Michael A Cochran
                        wrote on last edited by
                        #24

                        Yes, the unintentional side-effect is definitely an issue. I guess I'm just being magnamous today but I would want to see more of the code before I fired the developer over it. :-D

                        1 Reply Last reply
                        0
                        • A Alberto Bar Noy

                          [rant] If forecolor red then disable(control) else if forecolor black then enable(control) [/rant] :mad::mad::mad:

                          Alberto Bar-Noy --------------- “The city’s central computer told you? R2D2, you know better than to trust a strange computer!” (C3PO)

                          R Offline
                          R Offline
                          rjemp
                          wrote on last edited by
                          #25

                          It is strange, and something I would never do. However, without knowing the full context I can see that it might be somewhat logical. For example, if a variable was used to store the state (instead of the color) and the color was required to be changed at the same time, you could argue the variable is redundant and why not just use the color. Particularly if it is a small piece of self contained code that has no coupling or external influence. In that case, who cares, if it works move on.

                          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