The conversation

Lessons learnedExperience excerpt · English

I think developers sometimes get too obsessed with code quality thinking that smarter code makes …

I think developers sometimes get too obsessed with code quality thinking that smarter code makes them a better developer. In fact I’ve seen developers fall into the trap of mistaking their code as the product and thus spend so much time beautifying it that that fail to ever release anything. Then you have the other end of the spectrum where people are too focused on hacking stuff together that the end result is unmaintainable. The reality is there needs to be a bit of both to be a good developer. For example, if you’re building a proof of concept (POC), then it’s more important to prove the idea than it is to define the architecture. And the reason for that is because you don’t always understand how the final product (whether it’s commercial software or a FOSS library) is best architected until you’ve gone through a few drafts of the idea. So spaghetti code isn’t necessarily a bad thing. But then when you know your idea works and you need to flesh it out into something more durable, you start to refactor the spaghetti into something more maintainable. …

Original discussionJohn Carmack on Fabrice Bellard463 source comments · at import
5

What was this responding to?

Parent context · original excerpt

AU

Mozart doesn’t feel right. The code isn’t beautiful and elegant. It’s not built to last (at least for ffmpeg) or be some kind of masterpiece. He writes code to get a job done or tickle some intellectual curiosity. It’s not beautiful but that’s OK. I think Unicorn illustrates one of the issues with his style. It wouldn’t have needed to exist of the QEMU code was architected into neat components. But then writing spaghetti code that gets the job done is why he’s so fast and effective. It’s a trade off https://www.unicorn-engine.org/docs/beyond_qemu.html I think there’s actually a sharp contrast with John Carmack here. Fabrice might be smarter and faster but Carmack is perhaps a better software engineer. You can really see the development of his style from Doom and Quake source code, where Quake 3 source is like a beautiful gem of a code base.

Full original

Community replies 0

No community replies yet. Add your perspective.

Replies from the source 5

Direct replies available in this import. Original-language excerpts.

21

But the code quality is speed. And reach. You can not advance, unless you can read the code, you can understand the model, you can not scale beyond a certain point. The beauty of the architecture is the ability to build a spaceship compared to a train of kerosene tankers. Physically similar, but in capability radical different. I find this very scary. Somebody unable to perceive capabilities and tech-debt. If you can not perceive that- you should not be let near executive decisions or code-base evaluation. This is literally the difference between rocket-science and exploding failed projects. Everyone can pile up explosives, not everyone can go to space today. Its a great interview topic to filter this kind of candidate out of companies.

Full original
NI

It's the opposite, better-factored code makes me, a mediocre developer, capable of making progress instead of hitting a complexity wall. It's separate from striving for "beautiful" code, beauty within well-factored boundaries yields dimishing returns compared to just having the boundaries.

Full original
PS

> I think developers sometimes get too obsessed with code quality thinking that smarter code makes them a better developer. Not much about "smartness", but code can by far outlast many "product" sold on top of it, so it can make sense to polish them more than the ready to throw gift paper. People will certainly buy nice gift paper wrapping cheap crap music toy of the day. But they will also value differently access to a beautiful handcrafted musical instrument. On the other hands, people who don’t even play any music won’t be able to assess any musical appliance.

Full original
TR

>For example, if you’re building a proof of concept (POC), then it’s more important to prove the idea than it is to define the architecture. I have tried to do this for POCs (just hacking everything together), and I always get stuck very quickly. Then until I figure out some sort of architecture for what I'm supposed to be doing I can't proceed. It's like, once I have the first step (of several) of the a POC working, I literally cannot think of how to implement the second one until the first one is somewhat well organized

Full original
BI

If your code is a low-stakes one-and-done and it works in the end, messy code is forgivable. Undertale looks like Yandere Simulator inside; nobody cares. But if your code is something that needs to be maintained over time and/or has constraints in terms of security, availability, etc., like virtually all code is, then yes: clearer, better factored, more readable code is a big part of the product because it's a massive favor both to yourself and your successors when changes have to be made and results in quicker changes, lowered costs for changes, and higher quality on metrics like security. Even if I'm writing a game—I'm auDHD, so if the initial code is garbage (and I've written a lot of garbage code) I'd be loath to touch it later. Better factored code is easier for me to revisit and improve upon with time. So I make it a point to continuously improve how I structure code from the jump …

Full original
Continue on Hacker News

Respect different perspectives. Share concrete experiences.

Sign in to post, reply, repost, and quote.