Hacker News new | ask | show | jobs
by sneak 955 days ago
I once saw a 5000 line file of shit-tier code making a business something like a million bucks cash per day.

It was a single huge function, called from cron every 5 minutes. No locking to prevent concurrent runs if it took longer than five minutes to execute. No exception handling. One giant nearly incomprehensible everything-function. Global variables. Bugs everywhere.

Easily hundreds of thousands of dollars of net profit per hour (some hours).

Since then I never worry much about code quality in my prototypes. Build one to throw away.

1 comments

It’s great until there’s some new regulation or costumer requirement and it can’t possibly be added to the monstrosity and so you lose those millions until you can rewrite, which takes months.
Rewriting 5000 lines doesn’t take months. I actually ended up refactoring it in under 24 hours to make it about 10x more reliable and performant (after I put out the immediate fires that had me looking at it in the first place).

In general, I agree. I don’t write code that bad, even for prototypes. That said, I worry a lot less about being super meticulous DRY and best practices in my prototypes that in 90% of cases will never touch millions in value. Done is better than perfect.

Done is not always "better than perfect". A bridge that is done isn't better if it collapses due to poor engineering and kills people.

All software is not life or death. But software can be something people come to rely on.

If I choose (unknowingly) to rely on software not done well and it bites me, I personally would rather not have relied on it at all.