• P (unregistered)

    I'm not believing this WTF unless Remy can prove that this code also runs TDWTF

  • bvs23bkv33 (unregistered)

    code written in cobol runs the world

  • (nodebb) in reply to bvs23bkv33

    code written in cobol runs the world

    Except for the parts that are written in Fortran, or System/370 assembler.

  • Qazwsx (unregistered) in reply to P

    I'm pretty sure the back-end of the nodebb forum has been doing something with CQ attrs for the past week or so

  • Vilx- (unregistered)

    And that's how you know it's a good code that's handling those hazardous materials and everything is safe and there's no chance of a Resonance Cascade. None. At. All. :D

  • Simon Clarkstone (unregistered)
        if (csAttrtype.compareTo(CQConstants.CQ_SHORT_STRING_TYPE) != 0
            || csAttrtype.compareTo(CQConstants.CQ_MULTILINE_STRING_TYPE) != 0)
    

    That looks suspiciously like it's always true, unless there is a very funny compareTo() or I've got the logic wrong.

    Also, the log messages use a C++ syntax for method calls even though this code is in is Java.

  • Always assume (unregistered) in reply to Simon Clarkstone

    Only if CQ_SHORT_STRING_TYPE and CQ_MULTILINE_STRING_TYPE are different!

  • (nodebb)

    Meh, I worked for companies where certain parts of data were stored 4-5 times. 2 systems is nothing.

  • (nodebb)

    And to think this code hasn't even been pulled through the 'How to write unmaintainable code'-guidelines (And yes, I still posses a 20 year old hardcopy somewhere in a drawer).

  • Ruthless_Proofreader (unregistered) in reply to Steve_The_Cynic

    RPG runs the remaining part of the world.

  • (nodebb)

    It's certainly a Trek into some starry-eyed code...

  • jay (unregistered) in reply to Simon Clarkstone

    It can be neither string type and both values == 0. The next condition is where it catches all other cases because all it cares about is that it is not a short string type (if (csAttrtype.compareTo(CQConstants.CQ_SHORT_STRING_TYPE) == 0)), which includes all types which are neither short strings nor multi-line strings. That means it never even gets to the condition for date types.

    Has this code been validated to make sure all logic paths can be reached?

  • Splatmandeux (unregistered) in reply to Steve_The_Cynic

    I have first hand knowledge that the main software that keeps freight trains (in the US) from colliding with other trains, running over construction crews, not derailing around curves, etc... is a million line Visual Basic application that originated in COBOL.

  • Simon Clarkstone (unregistered) in reply to jay

    From my recall, x.compareTo(y) returns: == 0 for x == y < 0 for x < y

    0 for x > y

    so the condition if (csAttrtype.compareTo(CQConstants.CQ_SHORT_STRING_TYPE) != 0 || csAttrtype.compareTo(CQConstants.CQ_MULTILINE_STRING_TYPE) != 0) could be represented as: type != SS || type != MS i.e.: !(type == SS) || !(type == MS) i.e.: !(type == SS && type == MS) i.e.: !(false) // Assuming that compareTo() isn't insane.

    I think? Quite uncertain here.

  • Simon Clarkstone (unregistered)

    From my recall, x.compareTo(y) returns:

    == 0 for x == y
    < 0 for x < y
    > 0 for x > y
    

    so the condition

    if (csAttrtype.compareTo(CQConstants.CQ_SHORT_STRING_TYPE) != 0 || csAttrtype.compareTo(CQConstants.CQ_MULTILINE_STRING_TYPE) != 0)
    

    could be represented as:

    type != SS || type != MS
    

    i.e.:

    !(type == SS) || !(type == MS)
    

    i.e.:

    !(type == SS && type == MS)
    

    i.e.:

    !(false)  // Assuming that compareTo() isn't insane.
    

    I think? Quite uncertain here.

  • Hey All (unregistered)

    TRWTF is that code is in C# and not JAVA!

    Java runs the world. All major banking applications (customer-centric) are built with Java.

  • Bruce W (unregistered)

    Enterprise organizations often don’t know what their business processes are: the software which encodes the process is older than most anyone working in the organization, and it must work that way, because that’s the process (even though no one knows why).

    Ah, I love these processes. About 8 years ago I was revamping all of the data feeds for the department I was in. There was one data feed from another department we wanted changed. We contacted them and they were very excited to talk with us because our data feed had become mythical for them. Turns out they had no documentation for the feed to the point that they didn't even know exactly how it was generated - they just knew it worked. They called it the "magic data feed."

  • Simon Clarkstone (unregistered) in reply to Hey All

    Are you sure it's in C#? The first characters of methods are lowercase, it uses "getClass()" rather than "GetType()", and "String" starts with a capital S, all of which strongly suggest this is Java.

  • sizer99 (google) in reply to Hey All

    Not C# - C# doesn't have a 'throws' keyword, for example. Or getClass (as Simon pointed out). However, C# does have a 'String' (and a 'string') as part of the very confusing lexical vs base type thing - 'string' is a shortcut for 'System.String', but if you're 'using System;' you can just refer to 'String'. So that wouldn't be enough to tell. But the first two things are smoking guns.

    And yep, Giant Enterprisey stuff runs on Java, because Java is the new COBOL. Its primary purpose is to keep legions of corporate drudge programmers from stepping on each others feet too badly, for example by making things super verbose. But there's only so far it can go.

  • Brian Boorman (google) in reply to Splatmandeux

    It's not working very well. Norfolk Southern has derailed 2 trains in 3 weeks this summer at the Horseshoe Curve in Altoona PA. Seems your software can't get it straight that you put the light, empty T-bar lumber cars behind the heavy, loaded freight/tanker cars.

  • doubting_poster (unregistered)

    So the WTFs are stringified data, three conditional paths but only one is ever used, and the log messages are wrong, probably due to copy-pasting. Other than that though, there's been much worse on this site. Just look at the Date part (which isn't ever used), they actually use java date formatting! The logging seems sensible too, except for the copy paste error.

  • jay (unregistered) in reply to Simon Clarkstone

    Assuming you are correct, the first condition is catching all cases where both string type flags are not true, so the only case that falls through would be SS is true and MS is true, which makes it even worse but the last condition for dates is still not reached.

Leave a comment on “Yesterday's Enterprise”

Log In or post as a guest

Replying to comment #:

« Return to Article