• (cs)

    That code looks awfully familiar...

  • jvm (unregistered) in reply to bigr

    neat.

  • (cs) in reply to bigr
    bigr:
    That code looks awfully familiar...


    Translation: I wrote this some time in the distant past and am embarassed to admit its mine.

  • (cs)

    What's wrong with a business logic color coding scheme?  If it's good enough for the Dept. of Homeland Security....er....I mean......nevermind. 

  • Colin (unregistered)

    I knew there had to be a better way then model classes!


    I KNEW IT.  Here I was using the phases of the moon.... and the pressure of the mouse clicks.  (Everyone knows new people click with less pressure....)

  • (cs)

    So the problem here is using magic numbers, right?

  • (cs)

    I swear some people are writing code on acid.  I'd love to be there when someone wants to change the color scheme.

    [manager] We've been asked to update the color scheme to fit the corporae standard.  I've got the intern on it.

    [developer] Wait, the logic depends on the RGB values of the components.

    [manager] What?  Why?!

    Now here's the game, kind of like madlibs:  What's the developers response?  I'd get it going but I can't even think of a reason.  I need to eat.

  • (cs) in reply to Mung Kee
    Mung Kee:
    What's wrong with a business logic color coding scheme?  If it's good enough for the Dept. of Homeland Security....er....I mean......nevermind. 


    If Form1.Picture1.Color = RGB(255,0,0) Then
        MessageBox "Warning: Terror Alert Red!", vbIconExclamation
    End If

    Probably not proper VB, but good enough for TDWTF
  • BSP (unregistered) in reply to loneprogrammer

    This isn't a WTF: it's obvious that the programmer was working in a low memory environment so he reused the members of the UI classes as state variables rather than bloating memory with some of his own. Commendable!

  • (cs) in reply to BSP
    Anonymous:
    This isn't a WTF: it's obvious that the programmer was working in a low memory environment so he reused the members of the UI classes as state variables rather than bloating memory with some of his own. Commendable!


    There's just one flaw with that: It's VB!!!! the only programming language I know of that requres four floppies of runtime for a simple measly "Hello World" app.
  • (cs) in reply to Mike R

    <font size="2">

    Mike R:
    Anonymous:
    This isn't a WTF: it's obvious that the programmer was working in a low memory environment so he reused the members of the UI classes as state variables rather than bloating memory with some of his own. Commendable!



    There's just one flaw with that: It's VB!!!! the only programming language I know of that requres four floppies of runtime for a simple measly "Hello World" app.


    what's a "floppy"?</font>
  • (cs) in reply to loneprogrammer

    loneprogrammer:
    So the problem here is using magic numbers, right?

    The concern is that there is a set amount of magic numbers (256 * 256 * 256).  It is just a matter of time before all possibilities are used up.  The developer then will have to use window position or frame size for additional options.  Appears to have painted himself in a corner on this one.

  • (cs) in reply to BSP

    Anonymous:
    This isn't a WTF: it's obvious that the programmer was working in a low memory environment so he reused the members of the UI classes as state variables rather than bloating memory with some of his own. Commendable!

    Yes, this is obvious.  Obviously bullshit.

  • (cs) in reply to John Smallberries
    John Smallberries:
    <font size="2">
    what's a "floppy"?</font>


    Its like a compact flash card, but bigger, suceptible to magnetic fields, and easily damaged. They generally hold a lot less than compact flash cards, too. See http://www.webopedia.com/TERM/f/floppy_disk.html for additional information, or simply refer to google.com
  • (cs) in reply to Mike R

    Mike R:
    Anonymous:
    This isn't a WTF: it's obvious that the programmer was working in a low memory environment so he reused the members of the UI classes as state variables rather than bloating memory with some of his own. Commendable!


    There's just one flaw with that: It's VB!!!! the only programming language I know of that requres four floppies of runtime for a simple measly "Hello World" app.

    Really?  Then you really aren't all that perceptive.  Runtime files (usually known as Dynamic Link Libraries...you know dll files?) have been around for ages.  Most OS interpretations of C++ required a few core DLLs to function.  The only reason you didn't need to distribute them is that they included them with the OS usually.  Do you think Pearl runs without a runtime?  Java?  Have you TRIED to run java without the JVM?  How about Python? 

    Is there some magic I'm unaware of that I've been missing for all these years? 

    Hell, the only reason that VB had P-Code to start with was because it was actually once considered ADVANTAGEOUS.  Moore's Law hadn't really taken off in the business world yet and p-code with a runtime takes less space than a compiled app on a harddrive.  Now that's a moot point, but then it was big.

    Now, I'm not saying VB is a stellar language, but if you are going to make a blanket statement, please don't make one that obviously makes you look like a complete and total idiot.

    Do they even teach these kids anything in school these days?  Yeesh.

  • Adam Courtney (unregistered) in reply to Mike R

    Mike R:
    Anonymous:
    This isn't a WTF: it's obvious that the programmer was working in a low memory environment so he reused the members of the UI classes as state variables rather than bloating memory with some of his own. Commendable!


    There's just one flaw with that: It's VB!!!! the only programming language I know of that requres four floppies of runtime for a simple measly "Hello World" app.

    Actually it's Fox Pro,  and the quilty party was long gone before I got here.

  • (cs)

    <font size="1">

    Alex Papadimoulis:
    </font>

    
    MsgBox "There was an error creating the client. " & _
    "Please ensure all required fields were entered."
    <font size="1">

    Yeah, don't validate the input or anything...wait for it fail, then change the control color.</font>

  • (cs) in reply to dubwai
    dubwai:

    I swear some people are writing code on acid.  I'd love to be there when someone wants to change the color scheme.

    [manager] We've been asked to update the color scheme to fit the corporae standard.  I've got the intern on it.

    [developer] Wait, the logic depends on the RGB values of the components.

    [manager] What?  Why?!

    Now here's the game, kind of like madlibs:  What's the developers response?  I'd get it going but I can't even think of a reason.  I need to eat.

    [developer]  Because that's what marketing put in the requirements!
    or
    [Paula]  I'm Brillant!

  • (cs) in reply to Adam Courtney
    Anonymous:

    Actually it's Fox Pro,  and the quilty party was long gone before I got here.

    Hmmm.  I wouldn't describe this as quilty.  More of a highly-flammable, fuzzy, poly-blend blanket.

  • (cs)

    I think this is my favorite WTF ever.  I think I want to use this concept in my current code, except I program IVRs, so I'd have to use tone of voice...

  • (cs)

    My guess: everything was so tightly seperated that the coder found no other way to determine whether or not the operation was successfull without changing that other, probably not-at-all better code.

  • (cs) in reply to John Smallberries
    John Smallberries:
    <font size="1">
    Alex Papadimoulis:
    </font>

    
    MsgBox "There was an error creating the client. " & _
    "Please ensure all required fields were entered."
    <font size="1">

    Yeah, don't validate the input or anything...wait for it fail, then change the control color.</font>


    Meanwhile, the labels on the client are changing to every color in the RGB scale so the user is wondering WTF is going on.  I hope they have a color legend.
  • (cs) in reply to BSP

    Anonymous:
    This isn't a WTF: it's obvious that the programmer was working in a low memory environment so he reused the members of the UI classes as state variables rather than bloating memory with some of his own. Commendable!

    What's really sad about this is that this is exactly the kind of thinking that many developers use when trying to minimize memory footprints.  Yeah, get rid of that one byte.  That's going to really make a huge difference in a GUI application. Ignore all the real memory usage problems.  Totally commendable, for sure.

  • aslkdfjhg (unregistered)

    And its data storage mechanism is based on the popular MPG database framework!

  • KEncho (unregistered)

    I remember seeing the same, but using images instead of colours. If the image was an "OK" icon, then it was ok. If it was a "wrong" icon, it was not ok  lol

  • Adam Courtney (unregistered) in reply to dubwai
    dubwai:

    Anonymous:
    This isn't a WTF: it's obvious that the programmer was working in a low memory environment so he reused the members of the UI classes as state variables rather than bloating memory with some of his own. Commendable!

    What's really sad about this is that this is exactly the kind of thinking that many developers use when trying to minimize memory footprints.  Yeah, get rid of that one byte.  That's going to really make a huge difference in a GUI application. Ignore all the real memory usage problems.  Totally commendable, for sure.

    This coder did not have any memory considerations when creating this.

     

  • (cs) in reply to ammoQ

    ammoQ:
    My guess: everything was so tightly seperated that the coder found no other way to determine whether or not the operation was successfull without changing that other, probably not-at-all better code.

    I think it's pretty obvious that this code's problem it has no model.  The internal state and the view of it are completely coupled in unholy matrimony.  I've dealt with this kind of 'design' before and it's a nightmare to maintain.  Change the text of a selection and about dozen bugs appear.

  • (cs) in reply to Adam Courtney
    Anonymous:
    dubwai:

    Anonymous:
    This isn't a WTF: it's obvious that the programmer was working in a low memory environment so he reused the members of the UI classes as state variables rather than bloating memory with some of his own. Commendable!

    What's really sad about this is that this is exactly the kind of thinking that many developers use when trying to minimize memory footprints.  Yeah, get rid of that one byte.  That's going to really make a huge difference in a GUI application. Ignore all the real memory usage problems.  Totally commendable, for sure.

    This coder did not have any memory considerations when creating this.

    I didn't think so. I was more directing that at the person who thought this was 'clearly' for memory savings.

  • Cheddar (unregistered) in reply to ammoQ

    "tightly seperated". I think I'll use this in my next presentation. My app is tightly seperated  to provide context sensetive error reporting.

  • (cs) in reply to scheky
    scheky:

    Mike R:
    Anonymous:
    This isn't a WTF: it's obvious that the programmer was working in a low memory environment so he reused the members of the UI classes as state variables rather than bloating memory with some of his own. Commendable!


    There's just one flaw with that: It's VB!!!! the only programming language I know of that requres four floppies of runtime for a simple measly "Hello World" app.

    Really?  Then you really aren't all that perceptive.  Runtime files (usually known as Dynamic Link Libraries...you know dll files?) have been around for ages.  Most OS interpretations of C++ required a few core DLLs to function.  The only reason you didn't need to distribute them is that they included them with the OS usually.  Do you think Pearl runs without a runtime?  Java?  Have you TRIED to run java without the JVM?  How about Python? 


    Of course, I'd say Java was piggish, as well. And Yes, I realise a windows app won't run without windows. But when a windows app won't run without the 4-5MB of extra garbage tacked along with it, there's something wrong. Anyway, its been established that its FoxPro, so this argument is moot.


    Is there some magic I'm unaware of that I've been missing for all these years?

    I could go into how DOS COM files fit into 64k, needed next to nothing and could be written to not only not rely on the OS, but also no rely on the system or video ROMs. But, that would be pointless.


    Hell, the only reason that VB had P-Code to start with was because it was actually once considered ADVANTAGEOUS.  Moore's Law hadn't really taken off in the business world yet and p-code with a runtime takes less space than a compiled app on a harddrive.  Now that's a moot point, but then it was big.

    Can you please tell me the advantage to this? There is only ONE advantage I can think of and it surely wasn't about to pan out in VB, and that would be one of portability.


    Now, I'm not saying VB is a stellar language, but if you are going to make a blanket statement, please don't make one that obviously makes you look like a complete and total idiot.

    I'm not the only one to do that, believe me.


    Do they even teach these kids anything in school these days?  Yeesh.

    You're likely younger than I am. So, do they?


  • Daniel T (unregistered)

    I get it - the WTF is that the colors don't match.  And that everything is primary colors, which would make your eyes hurt after a while...

    --Daniel T

  • (cs) in reply to Mike R
    Mike R:
    scheky:

    Mike R:
    Anonymous:
    This isn't a WTF: it's obvious that the programmer was working in a low memory environment so he reused the members of the UI classes as state variables rather than bloating memory with some of his own. Commendable!


    There's just one flaw with that: It's VB!!!! the only programming language I know of that requres four floppies of runtime for a simple measly "Hello World" app.

    Really?  Then you really aren't all that perceptive.  Runtime files (usually known as Dynamic Link Libraries...you know dll files?) have been around for ages.  Most OS interpretations of C++ required a few core DLLs to function.  The only reason you didn't need to distribute them is that they included them with the OS usually.  Do you think Pearl runs without a runtime?  Java?  Have you TRIED to run java without the JVM?  How about Python? 


    Of course, I'd say Java was piggish, as well. And Yes, I realise a windows app won't run without windows. But when a windows app won't run without the 4-5MB of extra garbage tacked along with it, there's something wrong. Anyway, its been established that its FoxPro, so this argument is moot.


    Is there some magic I'm unaware of that I've been missing for all these years?

    I could go into how DOS COM files fit into 64k, needed next to nothing and could be written to not only not rely on the OS, but also no rely on the system or video ROMs. But, that would be pointless.


    Hell, the only reason that VB had P-Code to start with was because it was actually once considered ADVANTAGEOUS.  Moore's Law hadn't really taken off in the business world yet and p-code with a runtime takes less space than a compiled app on a harddrive.  Now that's a moot point, but then it was big.

    Can you please tell me the advantage to this? There is only ONE advantage I can think of and it surely wasn't about to pan out in VB, and that would be one of portability.


    Now, I'm not saying VB is a stellar language, but if you are going to make a blanket statement, please don't make one that obviously makes you look like a complete and total idiot.

    I'm not the only one to do that, believe me.


    Do they even teach these kids anything in school these days?  Yeesh.

    You're likely younger than I am. So, do they?




    FLAME ON!

    Great response - bravo, bravo.
  • (cs) in reply to dubwai
    dubwai:

    ammoQ:
    My guess: everything was so tightly seperated that the coder found no other way to determine whether or not the operation was successfull without changing that other, probably not-at-all better code.

    I think it's pretty obvious that this code's problem it has no model.  The internal state and the view of it are completely coupled in unholy matrimony.  I've dealt with this kind of 'design' before and it's a nightmare to maintain.  Change the text of a selection and about dozen bugs appear.



    We all know, sometimes a well-meaning SW designer hides just too much of the (supposedly) internal state of a module, so other modules have to rely on side effects to find out what's actually going on. Of course the right way to solve that would be to change the model, but there may be other constraints (like: no time left) that make it difficult to do so; the coder of this WTF obviously thought that relying on the color is less problematic (less likely to change) than relying on the text of the label.
  • (cs) in reply to El Duderino
    El Duderino:
    dubwai:

    I swear some people are writing code on acid.  I'd love to be there when someone wants to change the color scheme.

    [manager] We've been asked to update the color scheme to fit the corporae standard.  I've got the intern on it.

    [developer] Wait, the logic depends on the RGB values of the components.

    [manager] What?  Why?!

    Now here's the game, kind of like madlibs:  What's the developers response?  I'd get it going but I can't even think of a reason.  I need to eat.

    [developer]  Because that's what marketing put in the requirements!
    or
    [Paula]  I'm Brillant!



    [developer] Because I'm a genius, Seriously.

    [manager] Brillant!


        dZ.
  • David (unregistered) in reply to Daniel T

    Anonymous:
    I get it - the WTF is that the colors don't match.  And that everything is primary colors, which would make your eyes hurt after a while...

    --Daniel T

     

    Indeed.  I would have preferred a nice Mauve.  Or Taupe.  Lavender would also be quite soothing. 

  • (cs) in reply to ammoQ
    ammoQ:
    dubwai:

    ammoQ:
    My guess: everything was so tightly seperated that the coder found no other way to determine whether or not the operation was successfull without changing that other, probably not-at-all better code.

    I think it's pretty obvious that this code's problem it has no model.  The internal state and the view of it are completely coupled in unholy matrimony.  I've dealt with this kind of 'design' before and it's a nightmare to maintain.  Change the text of a selection and about dozen bugs appear.



    We all know, sometimes a well-meaning SW designer hides just too much of the (supposedly) internal state of a module, so other modules have to rely on side effects to find out what's actually going on. Of course the right way to solve that would be to change the model, but there may be other constraints (like: no time left) that make it difficult to do so; the coder of this WTF obviously thought that relying on the color is less problematic (less likely to change) than relying on the text of the label.

    Generally, it's difficult for a view to render something that the model is hiding unless your model is a Holub-esque 'render yourself' model.  So I'm wagering that there is no internal model.  The business code is embedded in the controls.  There is no state other than that of the gui components.  I've seen it too many times to count.

  • (cs)

    I think you folks missed the boat on this one. The WTF is that it is not accessibility enabled. What if the use is color-blind? Then what is the code supposed to do? [;)]

  • Just another WTF (unregistered) in reply to Richard Nixon

    As pointed out previously the obvious problem is that some silly manager might want to change the color of the error dialog to better match the new clock behind his desk.  So obviously the best solution would be make all the colors involved configuration settings that way the maintainer can change the color of the dialogs and the color senstivity of these brillant programmic responses at the same time with out destroying the program logic.  Something on the lines of :

        If lblClientNum.ForeColor = wftPendingColor Then
            MsgBox "Client was created but is pending activation."
        ElseIf lblClientNum.ForeColor = wtfItWorkedColor Then
            MsgBox "Client was created and was successfully activated."
        ElseIf lblClientNum.ForeColor = wtfTotalScrewUpColor _
                And lblClientNum.Caption = "999999" Then
            MsgBox "There was an error creating the client. " & _
                   "Please ensure all required fields were entered."
        End If

  • (cs) in reply to David
    Anonymous:

    Anonymous:
    I get it - the WTF is that the colors don't match.  And that everything is primary colors, which would make your eyes hurt after a while...

    --Daniel T

     

    Indeed.  I would have preferred a nice Mauve.  Or Taupe.  Lavender would also be quite soothing. 

    That's probably how this was discovered.  The colors were deemed offensive but when changed, the code stopped working.

  • (cs) in reply to jeremydwill

    Aargh! *User*, not *use*!

    Stupid EBKAC.

  • (cs) in reply to ammoQ
    ammoQ:
    dubwai:

    ammoQ:
    My guess: everything was so tightly seperated that the coder found no other way to determine whether or not the operation was successfull without changing that other, probably not-at-all better code.

    I think it's pretty obvious that this code's problem it has no model.  The internal state and the view of it are completely coupled in unholy matrimony.  I've dealt with this kind of 'design' before and it's a nightmare to maintain.  Change the text of a selection and about dozen bugs appear.



    We all know, sometimes a well-meaning SW designer hides just too much of the (supposedly) internal state of a module, so other modules have to rely on side effects to find out what's actually going on. Of course the right way to solve that would be to change the model, but there may be other constraints (like: no time left) that make it difficult to do so; the coder of this WTF obviously thought that relying on the color is less problematic (less likely to change) than relying on the text of the label.

    Nice try, but you just can't justify this level of WTFery.
    Simply changing
    Call SaveNewClientData

    <font size="3">to</font>
    result =  SaveNewClientData()

    would go a long way.

  • (cs)

    This is about as scary a code as I've seen.
    I would really like to hear the justification for this one.

  • (cs) in reply to Daniel T
    Anonymous:
    I get it - the WTF is that the colors don't match.  And that everything is primary colors, which would make your eyes hurt after a while...

    --Daniel T

    Green is a primary color?

    (sorry, sometimes I can't help being an asshole...)
  • (cs) in reply to Just another WTF

    Anonymous:
    ElseIf lblClientNum.ForeColor = wtfTotalScrewUpColor _

    Finally, a sensible use for Hungarian notation. [:D]

  • (cs)

    Rohhh, nice one, background color-based logic, definitly brillant [:D]

  • Adam Courtney (unregistered) in reply to Ayende Rahien

    Ayende Rahien:
    This is about as scary a code as I've seen.
    I would really like to hear the justification for this one.

    There is none.

  • (cs) in reply to John Smallberries
    John Smallberries:
    ammoQ:

    We all know, sometimes a well-meaning SW designer hides just too much of the (supposedly) internal state of a module, so other modules have to rely on side effects to find out what's actually going on. Of course the right way to solve that would be to change the model, but there may be other constraints (like: no time left) that make it difficult to do so; the coder of this WTF obviously thought that relying on the color is less problematic (less likely to change) than relying on the text of the label.

    Nice try, but you just can't justify this level of WTFery.
    Simply changing
    Call SaveNewClientData

    <font size="3">to</font>
    result =  SaveNewClientData()

    would go a long way



    But this requires access to the source of the SaveNewClientData procedure, which may not be the case in this project.

    dubwai:

    Generally, it's difficult for a view to render something that the model is hiding unless your model is a Holub-esque 'render yourself' model.  So I'm wagering that there is no internal model.  The business code is embedded in the controls.  There is no state other than that of the gui components.  I've seen it too many times to count.



    I aggree that this software definitely does not follow the MVC paradigm. Anyway, there could be some part of the program which could generously be considered "internal model" although it somehow has access to the controls, so it sets text and color of a label according to the result of the operation.
  • (cs) in reply to Ayende Rahien
    Ayende Rahien:
    This is about as scary a code as I've seen.
    I would really like to hear the justification for this one.

    Let's assume the programer decided to take the label as an indicator of the success of the operation because he has no easy way to directly find out.
    Relying on the color might be safer than relying on the text of the label, since the label text could be translated, corrected, contain variable parts etc. while the color is always the same for a result.
  • (cs) in reply to dubwai
    dubwai:

    I swear some people are writing code on acid.  I'd love to be there when someone wants to change the color scheme.

    [manager] We've been asked to update the color scheme to fit the corporae standard.  I've got the intern on it.

    [developer] Wait, the logic depends on the RGB values of the components.

    [manager] What?  Why?!

    Now here's the game, kind of like madlibs:  What's the developers response?  I'd get it going but I can't even think of a reason.  I need to eat.

    Ita erat quando hic adveni    (It was that way when I got here...)

     

  • ReligousFlameWarrior (unregistered)

    AmmoQ - with all of the defense of these WTFs the past couple of days, I beginning to think you authored quite a few yourself.

    No really, why are defending such code.  If what you speculate is true, then this code, and code like it, should never see the light of day.

Leave a comment on “Colored Logic”

Log In or post as a guest

Replying to comment #:

« Return to Article