logoalt Hacker News

tombertyesterday at 7:29 PM8 repliesview on HN

I suspect if people saw the handwritten code of many, many, many products that they used every day they would be shocked. I've worked at BigCos and startups, and a lot of the terrible code that makes it to production was shocking when I first started.

This isn't a dig at anyone, I've certainly shipped my share of bad code as well. Deadlines, despite my wishes sometimes, continue to exist. Sometimes you have to ship a hack to make a customer or manager happy, and then replacing those hacks with better code just never happens.

For that matter, the first draft of nearly anything I write is usually not great. I might just be stupid, but I doubt I'm unique; when I've written nice, beautiful, optimized code, it's usually a second or third draft, because ultimately I don't think I fully understand the problem and the assumptions I am allowed to make until I've finished the first draft. Usually for my personal projects, my first dozen or so commits will be pretty messy, and then I'll have cleanup branches that I merge to make the code less terrible.

This isn't inherently bad, but a lot of the time I am simply not given time to do a second or third draft of the code, because, again, deadlines, so my initial "just get it working" draft is what ships into production. I don't love it, and I kind of dread of some of the code with my name attached to it at BigCo ever gets leaked, but that's just how it is in the corporate world sometimes.


Replies

marcus_holmestoday at 2:07 AM

It's an unpopular truth for our industry, but the point of commercial software development is not to write good code; it's to write profitable code.

There are some cases where the most profitable code is also good code. We like those.

But in most (99%+) cases, the code is not going to survive contact with the market and so spending any time on making it good is wasted.

progmetaldevtoday at 1:32 AM

To me, it instead sounds like you care about the code you produce. You judge it more harshly than you probably do other code. It sounds like you are also meeting deadlines, so I'd call that a success and more production than what a lot of people tend to put out into the world.

I often have a lot of time between projects, and am able to really think about things, and write the code that I'm happy with. Even when I do that, I do some more research, or work on another project, and immediately I'm picking apart sections of my code that I really took the time to "get right." Sometimes it can be worse if you are given vast amounts of time to build your solution, where some form of deadline may have pushed you to make decisions you were able to put off. At least that's my perspective on it, I feel like if you love writing software, you are going to keep improving nearly constantly, and look back at what you've done and be able to pick it apart.

To keep myself from getting too distressed over looking at past code now, I tend to look at the overall architecture and success of the project (in regards to the performing what it was supposed to, not necessarily monetarily). If I see a piece of code that I feel could have been written far better, I look at how it fits into the rest. I tend to work on very small teams, so I'm often making architecture decisions that touch large areas of the code, so this may just be from my perspective of not working on a large team. I still do think if you care about your craft, you will be harsh on yourself, more than you deserve.

cassianolealyesterday at 8:20 PM

This is the product that's claiming "coding is a solved problem" though.

I get a junior developer or a team of developers with varying levels of experience and a lot of pressure to deliver producing crummy code, but not the very tool that's supposed to be the state-of-the-art coder.

show 5 replies
faangguyindiatoday at 2:54 AM

i worked at companies in US

where uptime monitoring was Page Refresh by QA team.

where there was no centralized logs

postgres had no backup or replication or anything

xienzeyesterday at 8:47 PM

> I suspect if people saw the handwritten code of many, many, many products that they used every day they would be shocked.

Absolutely. The difference is that the amount of bad code that could be generated had an upper limit on it — how fast a human can type it out. With LLMs bad code can be shat out at warp speed.

show 1 reply
awesome_dudeyesterday at 8:37 PM

> and then replacing those hacks with better code just never happens

Yeah, we even have an idiom for this - "Temporary is always permanent"

show 2 replies
whatisthisevenyesterday at 10:31 PM

> I suspect if people saw the handwritten code

Somehow, everyone has forgotten the terrible code quality that existed prior to 2020.

https://www.youtube.com/watch?v=UjZQGRATlwA

Like, come on. Software has been shit for decades. AI hasn't observably reduced the quality of software I use everyday in a way that is meaningfully separable from normal incidents in the past.

show 2 replies
benjiro3000today at 12:49 AM

[dead]