Ask HN: Worst code you ever had to fix up?
1–10 of 25 posts
Re: Ask HN: Worst code you ever had to fix up?
#2Ran out as soon as I could. In general it's worth remembering that if your overall team isn't performing well you still can be fired regardless of what your immediate manager thinks.
For better or worse I had a childhood which taught me not everyone's going to like me, but you just need to find people who do. In the case of employers I've left several places where I just didn't like the culture. It's worked extremely well for me.
Re: Ask HN: Worst code you ever had to fix up?
#3Probably the cruftiest code was a ship autopilots UI code that was 20k lines of C in one file with no automated testing. There was a very manual process for loading code onto a test display. The debugging experience was terrible. There was a way to manually inspect memory addresses, but that was about it. Oh and there were threads, managed by the homegrown OS (basically just a scheduler that ran on a 10 ms ticks or on an interrupt). These threads had priorities so they could a sometimes get into deadlocks waiting for each other.
As insane as it was, it was the best learning experience I could have had. I’m glad I stuck with it. I learned a lot about low level systems, prioritizing the highest value refactoring, and introducing automated testing to a legacy code base.
Re: Ask HN: Worst code you ever had to fix up?
#4Re: Ask HN: Worst code you ever had to fix up?
#5When we expanded into South America we bought a Brazilian company. I guess it didn't work out because within 2 years the company decided to shut down the Brazilian office and (unfortunately) all of the Brazilian-based developers were let go.
The website was handed over to us, and we were tasked with updating it to reflect the office was shutting down. It was written in a PHP framework I've never heard of, the dev and the prod websites were running on the same server, and it was obvious development was completed via SSH on the box itself. No git repo or pipeline or testing framework or anything like that.
We tried saving it but after 2-3 days we gave up and converted over to a static site hosted via S3.
Re: Ask HN: Worst code you ever had to fix up?
#6Then there's negligence like interns throwing code at a wall, not caring about quality, and managers not doing code reviews. Oh, and it's code shared across several product lines in hundreds of products. A+ guys for letting me clean-up your "science experiment" dishes. You got your giant wall of dead code, your commented-out code, debugging instrumentation code, unfinished code, code that duplicates code elsewhere, and code no one understands because they didn't document it.
Re: Ask HN: Worst code you ever had to fix up?
#7There was no testing and no documentation of the feature sets involved. Rewrote the code in under 10k LOC, huge cost and performance improvements were had, and the feature set was documented. Other engineers could look at the code and maintain it. Got the critical sections of the expert system to 100% branch coverage. Had to fight against other engineers who were saying "100% coverage is bad! I read that on medium!" I just did it anyway due to my own ethical concerns of writing bad software in this area and it only took me ~4hr more to get from 80% to 100% critical path code coverage.
Some of the most stressful software I worked on. I added in shit loads of logging to make sure that if anything did go wrong we'd find out what happened.
At some point someone wasn't notified about something the expert system was supposed to catch. I felt like I was going to faint because this meant someone was seriously hurt. Unfortunate twist: my code worked correctly. The system on the other end who was supposed to send the alert (maintained by the "100% coverage is bad" guy) died. Very unfortunate. The other engineer didn't feel bad about it at all.
I think about this a lot when I'm speaking to engineers. I use it as a litmus test for who I really enjoy working with. If they read a medium article and can't apply critical thinking to identify if it relates to their circumstances or not. Also, attempting to find out if they refuse to hear out a coworker.
Re: Ask HN: Worst code you ever had to fix up?
#8Re: Ask HN: Worst code you ever had to fix up?
#9Suppose the line count of "terrible" code re-written was t and the line count of "great/clean/elegant" code written for bankrupt companies was g. What is the median value of t/g experienced by hn readers?
Re: Ask HN: Worst code you ever had to fix up?
#10People want greenfield projects, but maintaining and improving legacy code is where the real, fundamental learnings occur ;). Probably the cruftiest code was a ship autopilots UI code that was 20k lines of C in one file with no automated testing. There was a very manual process for loading code onto a test display. The debugging experience was terrible. There was a way to manually inspect memory addresses, but that w…