23

WHO THE FUCK MAKES AN EXCHANGE RATE A STRING?!!!

Comments
  • 8
    Probably the same people who think that JS is a great language because it converts strings to numbers automatically. (Sometimes)
  • 1
    @ostream yeah I came across this a while back now. Can’t remember the exact context but I remember that it was a weird case where just casting the string wasn’t going to fix it and that it caused a bunch of other turmoil as well
  • 8
    @ostream by Murphy's law, this string will contain leading or trailing whitespace, unexpected characters for group separation or decimal points and other crap that will make a simple cast to a number fail.
    You seriously see no problem in it?
  • 3
    @Lensflare literally this! 😂

    The client’s data swamp was truly something to behold. Took me and a few colleagues a few months to drain and clean it up enough so that they could answer basic questions with any accuracy like how many customers do we have? Is this customer still alive so that I don’t send ads to dead people by accident, like I did that one time… etc

    Would have been even funnier if the ad was for life insurance
  • 3
    @ostream yeah actually now that I think about it I think their data was riddled with free text issues.

    Several times a week I would question whether or not the developer of the source system ever heard of validation checks, or about any other input type besides text fields.

    Granted their 50 year old mainframe system that still runs on COBOL was way worse. They literally had a manual as thick as an encyclopaedia that remapped all the nonsensical short codes for their table names and column names to human readable names, along with data types, UML diagrams and rough explanations of how certain formats work since even their numeric columns didn’t follow any format you would see in modern databases.

    Now that I think about that’s actually more documentation than most of the other tables I’ve ever worked with 😂

    They even had one of the COBOL devs that worked on it in house to answer questions!
  • 0
    People that think making it a float is bad?
  • 3
  • 4
    @ostream of course you should check your input. That’s not the point here.
    It‘s not about transmission but about storage.

    You should also pick the correct data type to prevent or detect that kind of issues and make your life easier. That’s literally the reason why there are different data types and not everything is a text string.
  • 1
    @atheist the stored value here is not currency but an exchange rate. Float would be fine.

    And float for currency is a well known anti-pattern. Nothing new. There are many different solutions for that problem, depending on your use case. Picking string to store monetary values is one of the worst things that you can do. That also applies to anything that involves numbers.
  • 0
    @ostream no shit…
  • 4
    var exchangeRate = "four point seven one six five percent";

    🤌🤌🤌
  • 3
    @kwilliams Should be stored as a .ppt with music, ideally
  • 2
    I know people who break the currency up into an array representing the significand

    2.5 = 25 x 10^-1

    integer array(25,10,-1)

    The first time I saw it I didn't know what I was feeling, because there were so many (negative) feelings at once.
  • 1
    @IntrusionCM the negative feelings come from the -1

    Sorry, I had to 😂

    But seriously, why using 3 numbers? The 10 is fixed and can be omitted.
  • 1
    @Lensflare I dunno.

    But imho that approach is so ... Bleep.... That I wouldn't wonder if a different base would be possible, too.
  • 1
    @IntrusionCM My biggest gripe with this is that it‘s not a tuple 😆
  • 3
    Where I work we had to update a database. Would've been easy, except that for some reason they made a description field, the PK for a table....
  • 2
    psychopaths.
  • 2
    @MrMcguffin better to have a manual thick enough to give someone head trauma and not need it, then NOT to have a manual thick enough to give someone head trauma when you DO need it.
  • 2
    @Wisecrack yes. Alternatively you can use this thick beast
  • 1
    @Wisecrack I love the double meaning in your message. Sometimes I do feel like I need head trauma 😂
  • 1
    @MrMcguffin the double meaning was completely unintentional, and at first I didn't know what you meant.

    Must be all the head trauma.

    Where'd I put that manual anyway?
Add Comment