3 ms·
Reminded of a time I took the code of our Data Scientists (2 physicists that "coded". They decided to make their own ORM in Ruby (called "Mondongo") instead of
by xtracto 7y ago
Reminded of a time I took the code of our Data Scientists (2 physicists that "coded". They decided to make their own ORM in Ruby (called "Mondongo") instead of using one available. No wonder, the code was a real mess...
For example, they needed to get a numeric value from a dropdown box that got several text options. The way they did it was:
fieldVal = textField.gsub('text string 1',0).gsub('another string 2',1).gsub('anotherstring3',3).....
and so on with all the options. And in theory they looked for a 0, 1, 2... etc.
Another WTF was that, when we told them we would be upgrading from Ruby 1.8 to 2.0, they told us that they were not sure, because 2.0 did not work that well... As it happens, at some point in the code they were using the .object_id property of a boolean value and testing it == 2 or 0. Well... ruby 2.0 made true.object_id == 20 , so things did not work as expected.
- bryanrasmussen 7y agoI have actually done a similar WTF myself when I had been programming professionally for about a year, I had to do a validation on SOAP requests for some EU project in ASP in 1999-2000 (thankfully only one of the acronyms in that statement are still relevant) and the parameters for doing it had changed a couple days before. There was a requirement that we had to deliver all validation code in VBScript that would run in the ASP but also should handle possible future changes to the request, and I had examples of all valid possible requests (which as I said had just been changed a couple days before), so I wrote an XSLT that went over all the XML templates and generated a bunch of VBScript if statements and for loops for each possible valid request and if it didn't find it returned an error message that it was invalid. So anyway based on the theory that I can understand any stupid coding wtf I myself have done - if the wtf code is generated by some other better code I understand why the code is so awful, but if it is handwritten I still don't understand. And my guy handwrote his code. I'm guessing yours too. crazy.