- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I'm not believing this WTF unless Remy can prove that this code also runs TDWTF
Admin
code written in cobol runs the world
Admin
Except for the parts that are written in Fortran, or System/370 assembler.
Admin
I'm pretty sure the back-end of the nodebb forum has been doing something with CQ attrs for the past week or so
Admin
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
Admin
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.
Admin
Only if CQ_SHORT_STRING_TYPE and CQ_MULTILINE_STRING_TYPE are different!
Admin
Meh, I worked for companies where certain parts of data were stored 4-5 times. 2 systems is nothing.
Admin
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).
Admin
RPG runs the remaining part of the world.
Admin
It's certainly a Trek into some starry-eyed code...
Admin
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?
Admin
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.
Admin
From my recall, x.compareTo(y) returns: == 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.
Admin
From my recall, x.compareTo(y) returns:
so the condition
could be represented as:
i.e.:
i.e.:
i.e.:
I think? Quite uncertain here.
Admin
TRWTF is that code is in C# and not JAVA!
Java runs the world. All major banking applications (customer-centric) are built with Java.
Admin
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."
Admin
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.
Admin
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.
Admin
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.
Admin
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.
Admin
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.