3 ms·
Back in 2003 while I was still studying I spent some time working at a bank helping write some boring web form using a java servlet. I was really junior, and th
by josephg 4y ago
Back in 2003 while I was still studying I spent some time working at a bank helping write some boring web form using a java servlet. I was really junior, and the code was an absolute mess - every time they made a new web form they copy+pasted a 3000 line java class (with no unit tests) from the previous form and modified it. For source control we were using visual source safe - which is one of the worst programs I've ever used. Every few days the repository corrupted itself and needed to be rebuilt.
Well, I made a horrible mistake. Right after deploying (compiling then manually copying a .class file onto our server), I accidentally lost the source code to all my work. There was no backup of the changes I'd made, and source control didn't have it. All testing was manual - which was a horrible process we went through before every deployment. So if I half remembered my changes, I'd have to manually test everything again and hope I didn't mess anything up.
All I had left was the compiled java .class with my changes in it. I was terrified to even tell my boss given all the work.
Well, I tried decompiling the .class file with my changes in it - but the result was 10k lines of nightmare fuel. How could I find my changes in that? But I also had the java file from a few weeks earlier, before I made my changes. So I compiled the previous version, then decompiled it. Then I diffed the two decompiled source code files. That showed me (in decompiled java form) all the places where I'd made changes, and with some work I managed to figure out what all my changes were.
A few hours later I had re-implemented all my changes in the java source file. I could guarantee I'd done it correctly because the output from the decompiler matched perfectly. So we didn't even need to re-do all our manual testing.
I don't think I ever told my boss.