• 1 Post
  • 94 Comments
Joined 7 months ago
cake
Cake day: November 25th, 2023

help-circle




  • But most of us know not to use Cheque leaves for transaction purposes (You get fined, if you end up encashing a cheque when your balance cannot cover the Cheque amount)

    Wow, that sucks. Maybe you should talk to your bank about getting some kind of protection against a check being returned NSF and paying a massive-ass fine.










  • (however, I don’t get why more loops and ifs makes a function harder to test, I’m just going to trust you and that I’ll find out later.

    Well, it’s fairly easy to explain - each branching statement in your function doubles the number of discrete paths through the code. If there’s one if statement, there’s two paths through the code. (The one where the if predicate is True, and the one where it isn’t.) If there’s two if statements, there’s four paths through the code. If there’s three if statements, there’s eight paths through the code.

    In order to test a function completely, you have to test every possible path through the code. If you used three if statements, that means you have to devise and write eight tests just for the different code paths, plus testing various exceptional cases of the function’s input (“what if all inputs are 0”, “what if all inputs are null”, “what if the integer is a string”, etc.) That’s a lot of tests! You might even have to write tests for exceptional cases combined with different code paths, so now you’re writing eight times the number of tests you otherwise would have had to.

    Whereas if your function doesn’t branch at all, there’s only one path through the code to have to test. That’s a lot fewer tests which means you’ll probably actually write them instead of saying “well, it looks like it works, I won’t spend the time on tests right now.” Which is how bugs make it all the way through to the end of the project.




  • crashfrog@lemm.eetoCyanide and Happiness@lemm.ee1 December 2023
    link
    fedilink
    arrow-up
    2
    arrow-down
    14
    ·
    7 months ago

    I mean if you did withdraws down below the amount in your account and then paid overdraft fees, who’s fault is that? If you want to spend money you don’t have use a credit card.

    then they processed the big one first (even though it was the last) then processed the small ones after and then they didn’t charge one overdraft fee, but multiple.

    Yes, as per the explicit terms of your account agreement.

    also there is the obvious case of the 2008 financial crisis

    Yes, where a lot of people took out loans they knew they wouldn’t be able to repay.