Maura Higgins parties with 'besties' Kendall Jenner, Hailey Bieber and Cara Delevingne as she mixes with A-list stars Coachella - after Danny Jones kiss scandal
Another major UK supermarket to launch its own version of viral 'Dubai-style' chocolate with a special twist
How Kylie Jenner and Timothee Chalamet looked 'out-of-sync' at Coachella, according to body language expert
My pregnant sister cried when I said her baby name was stupid - she wants me to apologise but I'm scared her child will be bullied
Arrest made after man 'exposed himself' to two women in Colchester
Asking prices hit new record high despite stamp duty hike, Rightmove says
A Single Mortgage
We talked about singletons a bit last week. That reminded John of a story from the long ago dark ages where we didn't have always accessible mobile Internet access.
At the time, John worked for a bank. The bank, as all banks do, wanted to sell mortgages. This often meant sending an agent out to meet with customers face to face, and those agents needed to show the customer what their future would look like with that mortgage- payment calculations, and pretty little graphs about equity and interest.
Today, this would be a simple website, but again, reliable Internet access wasn't a thing. So they built a client side application. They tested the heck out of it, and it worked well. Sales agents were happy. Customers were happy. The bank itself was happy.
Time passed, as it has a way of doing, and the agents started clamoring for a mobile web version, that they could use on their phones. Now, the first thought was, "Wire it up to the backend!" but the backend they had was a mainframe, and there was a dearth of mainframe developers. And while the mainframe was the source of truth, and the one place where mortgages actually lived, building a mortgage calculator that could do pretty visualizations was far easier- and they already had one.
The client app was in .NET, and it was easy enough to wrap the mortgage calculation objects up in a web service. A quick round of testing of the service proved that it worked just as well as the old client app, and everyone was happy - for awhile.
Sometimes, agents would run a calculation and get absolute absurd results. Developers, putting in exactly the same values into their test environment wouldn't see the bad output. Testing the errors in production didn't help either- it usually worked just fine. There was a Heisenbug, but how could a simple math calculation that had already been tested and used for years have a Heisenbug?
Well, the calculation ran by simulation- it simply iteratively applied payments and interest to generate the entire history of the loan. And as it turns out, because the client application which started this whole thing only ever needed one instance of the calculator, someone had made it a singleton. And in their web environment, this singleton wasn't scoped to a single request, it was a true global object, which meant when simultaneous requests were getting processed, they'd step on each other and throw off the iteration. And testing didn't find it right away, because none of their tests were simulating the effect of multiple simultaneous users.
The fix was simple- stop being a singleton, and ensure every request got its own instance. But it's also a good example of misapplication of patterns- there was no need in the client app to enforce uniqueness via the singleton pattern. A calculator that holds state probably shouldn't be a singleton in the first place.
As Madonna and Elton John settle years-long feud, the Queen of Pop's MANY spats with fellow A-list stars... from calling Lady Gaga's song 'reductive' and 50 Cent 'jealous'
Detective, 44, stalked her ex boyfriend in year-long campaign after he dumped her and would send up to 40 messages a day - then used her police computer to look up information on him
White Lotus' Aimee Lou Wood SLAMS SNL over 'mean and unfunny' skit that mocked her teeth
Ronnie Kray raped me... I find the hero worship of him and Reggie clueless - the twins were absolute psychopaths
Resident in 'sink estate' set for demolition says he and his partner are not going anywhere - despite being the only people still living in the doomed block
Inter Miami star Luis Suarez appears to BITE his own teammate Jordi Alba in latest shocking incident
Now children's home bosses are told not to call residents boys or girls - in case it offends transgender youngsters
British ARMY now called in to rodent-ridden Birmingham as pest control expert labels city 'apocalyptic': Cash-strapped Labour-run council declares major incident over bin strikes
The secret visit Princess Diana took Prince William on that solidified his role in the Royal Family
MP speaks out after images appearing to show 'sewage' being dumped in Chelmsford river
Old Fortinet flaws under attack with new method its patch didn't prevent
Infosec In Brief Fortinet last week admitted that attackers have found new ways to exploit three flaws it thought it had fixed last year.…