122
DarKneT
8y

Probably the biggest one in my life.
TL:DR at the bottom

A client wanted to create an online retirement calculator, sounds easy enough , i said sure.

Few days later i get an email with an excel file saying the online version has to work exactly like this and they're on a tight deadline

Having a little experience with excel, i thought eh, what could possibly go wrong, if anything i can take off the calculations from the excel file

I WAS WRONG !!!
17 Sheets, Linking each other, Passing data to each sheet to make the calculation
( Sure they had lot of stuff to calculate, like age, gender, financial group etc etc )

First thing i said to my self was, WHAT THE FREAKING FUCK IS THIS ?, WHAT YEAR IS THIS ?

After messing with it for couple of hours just to get one calculation out of it, i gave up

Thought about making a mysql database with the cell data and making the calculations, but NOOOO.
Whoever made it decided to put each cell a excel calculation ( so even if i manage to get it into a database and recode all the calculations it would be wayyy pass the deadline )

Then i had an epiphany

"What if i could just parse the excel file and get the data ?"
Did a bit of research sure enough there's a php project
( But i think it was outdated and takes about 15-25 seconds to parse, and makes a copy of the original file )

But this seemed like the best option at the time.
So downloaded the library, finished the whole thing, wrote a cron job to delete temporary files, and added a loading spinner for that delay, so people know something is happening
( and had few days to spare )

Sent the demo link to client, they were very happy with it, cause it worked same as their cute little excel file and gave the same result,

It's been live on their website for almost a year now, lot of submissions, no complains
I was feeling bit guilty just after finishing it, cause i could've done better, but not anymore

Sorry for making it so long, to understand the whole thing, you need to know the full story

TL:DR - Replicated the functionality of a 17 sheet excel calculator in php hack-ishly.

Comments
  • 16
    Now that is a hack! Good story :)
  • 27
    Actually from the architectural point of view you did the right thing. You rewritten UI while still using the same component for business logic.
    Now they can start to rebuilding logic bit by bit comparing to the old system using whatever technology they like.
  • 1
    Thanks @LucaScorpion

    @lig1 actually i almost didn't post this cause i couldn't decide i did the right thing or not.
  • 4
    Then maybe you can relate to that:
    https://xkcd.com/1667/
  • 1
    "sounds easy enough", haha, you fools.
  • 2
    @phorkyas that's exactly what this is 😂

    @leny 😀😀
  • 1
    @lig1 Also, in case the client found an mistake in the excel file, which is no unheard of, he could just put a fixed excel file on the site, with no need to code stuff.
  • 1
    You did just awesome job with this app. The idea of using excel library was the best you could make.
    I did similar thing once. Client was happy with this :-)
    My library was PhpExcel. Slow but works fine.
Add Comment