• airdrik (unregistered) in reply to boog
    boog:
    frits:
    I would replace this with a call to a local instance of Excel. Perhaps I'd be even more creative and use a JavaScript ScriptEngine to evaluate the string.
    Why not integrate it into the workflow?

    Make calculateCostSQL a "Human Task", so whenever invoked an automated email containing the parameters is sent to a Senior Arithmetic Analyst, who prints the e-mail, places it on a wooden table, OCRs the equation which is then processed by a perl script that inserts the result into the database. He then runs a batch process which displays the result in a windows form which he reads, pulls up the Subtraction Response form, and submits the difference, which is then placed in the Cost Calculation queue for the application to receive.

    Sure, it needlessly slows processing time, but it evenly distributes the work over more company resources.

    FTFY

  • by (unregistered) in reply to airdrik
    airdrik:
    boog:
    frits:
    I would replace this with a call to a local instance of Excel. Perhaps I'd be even more creative and use a JavaScript ScriptEngine to evaluate the string.
    Why not integrate it into the workflow?

    Make calculateCostSQL a "Human Task", so whenever invoked an automated email containing the parameters is sent to a Senior Arithmetic Analyst, who prints the e-mail, places it on a wooden table, OCRs the equation which is then processed by a perl script that inserts the result into the database. He then runs a batch process which displays the result in a windows form which he reads, pulls up the Subtraction Response form, and submits the difference, which is then placed in the Cost Calculation queue for the application to receive.

    Sure, it needlessly slows processing time, but it evenly distributes the work over more company resources.

    FTFY

    Now that's just silly... Why would anybody EVER use perl for anything other then driving normally sane individuals crazy, or worse, into marketing!

    Clearly it should be VBS, right?

  • (cs) in reply to airdrik
    airdrik:
    boog:
    frits:
    I would replace this with a call to a local instance of Excel. Perhaps I'd be even more creative and use a JavaScript ScriptEngine to evaluate the string.
    Why not integrate it into the workflow?

    Make calculateCostSQL a "Human Task", so whenever invoked an automated email containing the parameters is sent to a Senior Arithmetic Analyst, who prints the e-mail, places it on a wooden table, OCRs the equation which is then processed by a perl script that inserts the result into the database. He then runs a batch process which displays the result in a windows form which he reads, pulls up the Subtraction Response form, and submits the difference, which is then placed in the Cost Calculation queue for the application to receive.

    Sure, it needlessly slows processing time, but it evenly distributes the work over more company resources.

    FTFY
    That's how you justify that PhD pay. You can't expect some minion to be able to manage such a complex process, can you?

  • F (unregistered) in reply to dpm
    dpm:
    Cantabrigian:
    Example: the (fortunately now obsolete) C/UNIX "creat()" function. Why? Who thought that was a good idea?
    http://en.wikiquote.org/wiki/Kenneth_Thompson

    Ken Thompson was once asked what he would do differently if he were redesigning the UNIX system. His reply: "I'd spell creat with an e."

    But it already has one ...

  • (cs) in reply to Ollie Jones
    Ollie Jones:
    Get with the enterprisey times! Do it in the cloud! Use Google Calculator!

    Yeah, I think there's an app for that.

  • Cowboy BeBop (unregistered)

    I SQL because I am.

  • stu (unregistered)

    But... I wanted to know what else did Eli have to do at his new job!

  • (cs) in reply to TST
    TST:
    Looks like code that once needed something from the database (e.g. tax information) which was subsequently removed so just the substraction was left. I guess there was no source control information about it, so the history is unknown.

    Seconded.

  • (cs) in reply to Loren Pechtel
    Loren Pechtel:
    TST:
    Looks like code that once needed something from the database (e.g. tax information) which was subsequently removed so just the substraction was left. I guess there was no source control information about it, so the history is unknown.

    Seconded.

    That particular refactoring would remain a WTF, no matter what excuses you can marshal for it.
  • (cs) in reply to hoodaticus
    hoodaticus:
    Loren Pechtel:
    TST:
    Looks like code that once needed something from the database (e.g. tax information) which was subsequently removed so just the substraction was left.

    Seconded.

    That particular refactoring would remain a WTF, no matter what excuses you can marshal for it.
    Indeed. I don't understand the recurring obsession with understanding how the WTF came to be. Whoever left it in this state prior to Eli finding it was an imbecile, plain and simple. Do people really think we can learn that much by speculating what was going on in the author's stupid, stupid head?
  • Krishna (unregistered) in reply to TST
    TST:
    Looks like code that once needed something from the database (e.g. tax information) which was subsequently removed so just the substraction was left. I guess there was no source control information about it, so the history is unknown.

    We require all arithmetic operations be performed by database engine, on database server. This way, we only need certify one specific hardware and one specific software to implement those operations correctly. Imagine the chaos if any worker could add or subtract on his desktop? Who will sign off, to ensure correctness of results?

  • Demo (unregistered)

    What cracks me up is that, as far as I know that stuff, the ressource handling code with a try/catch inside a try/catch/finally block is basically the (only) correct way to to this in java. At least until Java 7.

  • Kaso (unregistered) in reply to Severity One
    Severity One:
    Once, I had to replace her code to do 128-bit DES3 encryption (yes, that's not a typo) by Java code, which was quite an interesting challenge, especially so because DES encryption is usually 64-bit (DES) or 192-bit (DES3). This was something like, DES2?

    The best bit of this is that 3DES uses three rounds of DES because if you use just two there's a meet-in-the-middle attack which makes it not much more secure than just a single round of DES

  • lomendil (unregistered) in reply to Cantabrigian
    Cantabrigian:
    Smitty:
    There's nothing I hate worse than random abbreviations in variable names. Why 'String quer = null'? Is 'String query = null' simply too much to type? I see this kind of thing all the time.

    Hear, hear. Example: the (fortunately now obsolete) C/UNIX "creat()" function. Why? Who thought that was a good idea?

    I always wondered the same about resolv.conf

  • (cs) in reply to boog
    boog:
    hoodaticus:
    Loren Pechtel:
    TST:
    Looks like code that once needed something from the database (e.g. tax information) which was subsequently removed so just the substraction was left.

    Seconded.

    That particular refactoring would remain a WTF, no matter what excuses you can marshal for it.
    Indeed. I don't understand the recurring obsession with understanding how the WTF came to be. Whoever left it in this state prior to Eli finding it was an imbecile, plain and simple. Do people really think we can learn that much by speculating what was going on in the author's stupid, stupid head?

    Only if we work in psychology ;)

  • casinator (unregistered) in reply to Oracle Marketer

    math is hard

  • Neville Flynn (unregistered)

    Eli shouldn't have changed the code.

    return cost-discount
    might tell you the cost, but the original function tells you what you need to hear.

  • (cs)

    I can picture this. Boss give assignment and states that the higher-ups have decided to move to Oracle, therfore your application must use Oracle. He may even have gone so far as to say that since the point of Oracle is to give the same answers to everyone, that you must perform your calculations on Oracle to get accurate results.

    That, or the coder could not figure out whay his answers didn't match the database's due to his using the double datatype.

  • (cs) in reply to Kaso
    Kaso:
    Severity One:
    Once, I had to replace her code to do 128-bit DES3 encryption (yes, that's not a typo) by Java code, which was quite an interesting challenge, especially so because DES encryption is usually 64-bit (DES) or 192-bit (DES3). This was something like, DES2?

    The best bit of this is that 3DES uses three rounds of DES because if you use just two there's a meet-in-the-middle attack which makes it not much more secure than just a single round of DES

    DES with 128-bit key is actually 3DES with a repeated key. Encrypt with K1, decrypt with K2, encrypt with K1 again.

  • Anon (unregistered)

    calculateCostSQL: Powered by Oracle.

  • ike (unregistered)

    The original is probably closer to something like

    sprintf("%.5f", cost) - sprintf("%.5f", discount)

    or

    sprintf("%.5f", sprintf("%.5f", cost) - sprintf("%.5f", discount))

  • Dazed (unregistered) in reply to no name
    no name:
    For anyone who doesn't know, DUAL is a stupidly-named built-in read-only table ...
    Yes, I reckon it started off as DUMMY, and someone objected to the name, so they hunted around for another word starting with the same first couple of letters. At least, that's the only way I've managed to make any slight sense of it.

    Still, if you think that's bad, try the SAP data-model some time.

  • (cs) in reply to no name
    no name:
    For anyone who doesn't know, DUAL is a stupidly-named built-in read-only table containing exactly one row and column, for use in situations like this.

    It's not stupidly named. It is the dual of the top of the lattice of relations defined by the tables in any database. It could be called "bottom" too, I guess.

    Shouldn't "developers" know their craft?

  • Satisfyed Customer (unregistered)

    Is it just me, or have we had a huge reduction in trolling recently (accepting the boog and frits posts)?

  • Tater Tots (unregistered) in reply to Satisfyed Customer
    Satisfyed Customer:
    Is it just me, or have we had a huge reduction in trolling recently (accepting the boog and frits posts)?
    Not counting this one?
  • airdrik (unregistered)

    TRWTF is requiring a FROM clause in all select queries: SELECT a - b; which is totally legal in SQL Server At the very least the piece of the database (driver?) which parses the SQL string could detect that there isn't a FROM clause and add the FROM DUAL if the engine itself requires it (which I would imagine the database engine should be able to optimize out the FROM DUAL clause and just create the unnecessary, unused data on-the-fly)

  • (cs) in reply to airdrik
    airdrik:
    TRWTF is requiring a FROM clause in all select queries: SELECT a - b; which is totally legal in SQL Server At the very least the piece of the database (driver?) which parses the SQL string could detect that there isn't a FROM clause and add the FROM DUAL if the engine itself requires it (which I would imagine the database engine should be able to optimize out the FROM DUAL clause and just create the unnecessary, unused data on-the-fly)

    I don't know, I guess it is vaguely a WTF. But the whole point of the relational database model is to compute joins and meets in a lattice of relations. Creating an unnecessary extra case instead of sticking to the data model could be called a WTF too.

  • (cs) in reply to Satisfyed Customer
    Satisfyed Customer:
    Is it just me, or have we had a huge redaction in trolling recently (accepting the boog and frits posts)?
    FTFY
  • Herby (unregistered) in reply to dpm
    dpm:
    Cantabrigian:
    Example: the (fortunately now obsolete) C/UNIX "creat()" function. Why? Who thought that was a good idea?
    http://en.wikiquote.org/wiki/Kenneth_Thompson

    Ken Thompson was once asked what he would do differently if he were redesigning the UNIX system. His reply: "I'd spell creat with an e."

    You used the wrong quote. The quote that applies to this code is: One of my most productive days was throwing away 1000 lines of code.

  • splat (unregistered) in reply to boog

    Why not integrate it into the workflow?

    This indeed should be incorporated into a custom Oracle Workflow. Oracle Appls R12 may be a pre-requisite for this type of process. A notification that a calculation is to be requested should go to the Senior Arithmetic Analyst who could then approve that indeed the calculation should occur. The workflow would then do the subtraction and return the results a second time to the Analyst to confirm the results, also in this step the SarBox IT compliance officer should be notified so as to approve that the Analyst is authorized to approve this calculation.

    My team could get this process implemented in around 300 hours at industry standard consulting rates ;)

    I've actually implemented things almost this crazy especially when the phrase 'Sarbanes Oxley' is involved in the requirements..... ~splat

  • (cs) in reply to Satisfyed Customer
    Satisfyed Customer:
    Is it just me, or have we had a huge reduction in trolling recently (accepting the boog and frits posts)?
    They've been deleting posts by trolls. Except, as noted, from boog, frits, frits's secret admirer, and me.
  • (cs) in reply to Krishna
    Krishna:
    TST:
    Looks like code that once needed something from the database (e.g. tax information) which was subsequently removed so just the substraction was left. I guess there was no source control information about it, so the history is unknown.

    We require all arithmetic operations be performed by database engine, on database server. This way, we only need certify one specific hardware and one specific software to implement those operations correctly. Imagine the chaos if any worker could add or subtract on his desktop? Who will sign off, to ensure correctness of results?

    Nope; nothing sarcastic there!

  • Matt (unregistered) in reply to boog

    Don't forget to include the CFO since all database-generated finance accounting needs to pass through him too.

  • syskill (unregistered) in reply to Pytry

    Good point. There are other cases where the results of trivial computations might change unexpectedly that are best handled by a database, e.g. "SELECT COUNT(*) FROM Lights".

  • (cs) in reply to Matt
    Matt:
    Don't forget to include the CFO since all database-generated finance accounting needs to pass through him too.
    Good catch. This workflow should also generate a log of its actions, then send an Employee Address Request form to the inter-office mail department, receive the office address for the CFO (and his secretary) in a spreadsheet, convert the spreadsheet into XML, then back to a spreadsheet, back to XML, then to a CSV (which can be imported into Excel), and finally it should run the workflow log through a mail merger and forward printed copies to the CFO and his secretary, to be hand-delivered by the Inter-Office Mail Delivery Officer.

    Sure, it needlessly introduces additional points of potential failure, but keeping management informed of trivial operations like subtraction is almost as important as connecting to a database for the sole purpose of performing said subtraction.

  • Spike (unregistered) in reply to TST
    TST:
    Looks like code that once needed something from the database (e.g. tax information) which was subsequently removed so just the substraction was left. I guess there was no source control information about it, so the history is unknown.

    I find it much more likely that someone drank the oracle cool-aid and made an expensive oracle purchase. Since they bought it you have to use it, and this was one developers way to fulfill management's demand to use oracle, even though he had no need for a RDBMS.

  • EmperorOfCanada (unregistered)

    I would have created a cluster of servers to service this request via custom protocol via some obscure port.

  • Sudo (unregistered) in reply to Captain Oblivious
    Captain Oblivious:
    no name:
    For anyone who doesn't know, DUAL is a stupidly-named built-in read-only table containing exactly one row and column, for use in situations like this.

    It's not stupidly named. It is the dual of the top of the lattice of relations defined by the tables in any database. It could be called "bottom" too, I guess.

    Shouldn't "developers" know their craft?

    Surely there's a difference between "knowing your craft", and "knowing why or how your tools got their names"?

  • Luiz Felipe (unregistered)

    Bah, needs XML kill frenzly!!!!!!!!!!!

  • moz (unregistered) in reply to airdrik
    airdrik:
    TRWTF is requiring a FROM clause in all select queries: SELECT a - b; which is totally legal in SQL Server
    I sometimes feel the same way when I'm confronted by an error message telling me to add a "group by" clause to a query, rather than a set of results based on a reasonable guess.

    But I don't suppose this is the sort of thing which sells database systems.

  • junior (unregistered)

    For crying out load kids, there was 15 years when it was standard, normal, ordinary to use Double for currency.

    OK, so you don't use floating point currency values. And you don't understand how anyone could make floating point currency values work. And you don't know anyone who uses floating point currency values.

    And you are MUCH smarter and know MUCH more than your parentsz, or 'old' people. They didn't even have cell phones!

    But get a grip! There was a time when the cost of producing beer or spending a night in hospital was calculated using floating-point currency, and the world didn't end.

  • (cs) in reply to Qvazar
    Qvazar:
    But the original returns 0 if the DUAL table is empty... :S

    I'm attempting to work out if you do use Oracle and that's satire or if you don't and you don't know about the magic that is the DUAL table.

  • (cs) in reply to Sudo
    Sudo:
    Captain Oblivious:
    no name:
    For anyone who doesn't know, DUAL is a stupidly-named built-in read-only table containing exactly one row and column, for use in situations like this.

    It's not stupidly named. It is the dual of the top of the lattice of relations defined by the tables in any database. It could be called "bottom" too, I guess.

    Shouldn't "developers" know their craft?

    Surely there's a difference between "knowing your craft", and "knowing why or how your tools got their names"?

    It's called DUAL because it used to have two rows in it. Now it just has a single row with a single VARCHAR2(1) column that contains a value of "X".

    It was created to let you return two rows for every one row in your table via a JOIN.

  • Brendan (unregistered)

    Reminds me of some real WTF code I once saw. On the first day of my job I had to make a change, blah, blah, blah...

    So imagine my horror when I saw that in order to sort a list of strings for a listbox the previous developer created a temp table in the DB with one column, inserted the list of strings into the table and then ran a select with an ORDER BY and then inserted the result set into the listbox.

    sigh

    That crushing feeling that you have made a terrible mistake taking on a new job on the first day is one of the worst in the world.

  • UserK (unregistered)

    Database is also great when it comes to accessing immutable arrays of blobs (1.2 MiB total). Why to just have a search loop when you can have a much more professionally looking SQL query? Don't you get it?

    I don't.

  • some former coder (unregistered)

    Because oracle will do decimal arithmetic rather than floating point which can be critical when dealing with money. I'd guess that the real WTF is that this may have introduced a bug. Changing the types to the equivalent of BigDecimal would probably help.

  • Swedish tard (unregistered) in reply to luis.espinal
    luis.espinal:
    boog:
    hoodaticus:
    Loren Pechtel:
    TST:
    Looks like code that once needed something from the database (e.g. tax information) which was subsequently removed so just the substraction was left.

    Seconded.

    That particular refactoring would remain a WTF, no matter what excuses you can marshal for it.
    Indeed. I don't understand the recurring obsession with understanding how the WTF came to be. Whoever left it in this state prior to Eli finding it was an imbecile, plain and simple. Do people really think we can learn that much by speculating what was going on in the author's stupid, stupid head?

    Only if we work in psychology ;)

    Or if one is interrested in finding out how such things happen, so that one might avoid doing so oneself when extremely tired doing 16 hour days...

  • Not of this Earth (unregistered) in reply to Oracle Marketer

    You made my day. TDWTF rocks :-)

  • oheso (unregistered) in reply to boog
    boog:
    Good catch. This workflow should also generate a log of its actions, then send an Employee Address Request form to the inter-office mail department, receive the office address for the CFO (and his secretary) in a spreadsheet, convert the spreadsheet into XML, then back to a spreadsheet, back to XML, then to a CSV (which can be imported into Excel), and finally it should run the workflow log through a mail merger and forward printed copies to the CFO and his secretary, to be hand-delivered by the Inter-Office Mail Delivery Officer.

    Hmm. That's a good start but ...

  • oheso (unregistered) in reply to Captain Oblivious
    Captain Oblivious:
    ... the whole point of the relational database model is to compute joins and meets in a lattice of relations.

    Ooh, say that again!

Leave a comment on “The Marshal”

Log In or post as a guest

Replying to comment #337677:

« Return to Article