Live data from Hacker News

Ask HN: Best codebases to study to learn software design?

news.ycombinator.com

61–70 of 94 posts

Re: Ask HN: Best codebases to study to learn software design?

#61
post #7

My experience (30 years in software, 25 in practicing architecture, MIT system architecture masters) tells me there is no such thing as abstractly “good” design. There are designs with negative consequences for sure, but “good” depends on the context: what are you building, safety/security requirements etc. Probably most importantly on the implementation team and it’s structure. A team of juniors will butcher your in…

It's about having most compromises be Not Totally Stupid and have the worst ones only be locally stupid. There is a big universe out there of compromises that fulfill those criteria. As you imply, a lot of the time it's more about constantly fighting for Less-Bad-and-avoiding-Dumb than about architecture as such.

Re: Ask HN: Best codebases to study to learn software design?

#62
post #46

Earlier quoted context omitted.

> Imagine bridges or houses were built like that. Or your surgeon was trained like that. While I don't disagree with you in general, this does feel a bit off. By that logic you can call the field of music immature, and all of the arts. I think the difference is that its easy to experiment without high costs. I genuinely think that if building bridges was cheap and quick, the fastest way to learn was to try...

I generally agree with your point on ease of experimentation, but if we insist on calling it software engineering , then maybe the field needs to adhere to engineering principles, as the GP highlighted.

Notice OP says "software design". Design is still an art, even in mechanical engineering.

Engineering applies to looking at a design and proving something about it.

Re: Ask HN: Best codebases to study to learn software design?

#64

Maybe I’m just not good enough at paying attention, but for me it seems like you have to actually run into problems over and over and figure out how to avoid the problems. Then you end up being able to mentally simulate what problems you will run into, and design is basically all about avoiding future problems of various kinds (and balancing tradeoffs about which future problems to avoid and how much effort to put in…

That's kinda like saying you can learn to drive by just getting into a car, crashing then thinking about how not to crash it next time. In reality both things are necessary. The car analogy doesn't hold for road driving because we drive well within the limits, but for racing it really is necessary to know exactly where the limits are. I don't think we should really be treating our profession like a race, though. But…

>That's kinda like saying you can learn to drive by just getting into a car, crashing then thinking about how not to crash it next time.

That would be a perfectly valid way of learning to drive if crashing had no danger or destruction and you could instantly reset the car every time. Software is a special case of engineering where the cost of failure is extremely low, so trial and error is generally the fastest way to get going with actually doing something.

Re: Ask HN: Best codebases to study to learn software design?

#65
The codebase is not where the design usually lives. It's where the implementation lives. You could imagine a rewrite into another programming language which would preserve the design but completely replace the implementation.

You should practice writing design docs. Don't worry about what the doc is supposed to look like, and definitely don't work off of a template. The most important thing about the doc is that another human could do the implementation if you gave it to them.

The doc can also function as a "proof of consideration". If you choose to do something one way, but there are other possible ways to do it, you can acknowledge the other possible ways, and say why they are worse. By preemptively acknowledging an alternative, you have proved to readers that you considered it.

All a "good" system designer is doing is considering a larger design space than most, and consistently finding good points in the space. Pick a problem, sample points in the design space, tell me why some points are better than others, and write it all down.

Re: Ask HN: Best codebases to study to learn software design?

#66

Maybe I’m just not good enough at paying attention, but for me it seems like you have to actually run into problems over and over and figure out how to avoid the problems. Then you end up being able to mentally simulate what problems you will run into, and design is basically all about avoiding future problems of various kinds (and balancing tradeoffs about which future problems to avoid and how much effort to put in…

> for me it seems like you have to actually run into problems over and over and figure out how to avoid the problems This shows how immature the field of software engineering is. Imagine bridges or houses were built like that. Or your surgeon was trained like that. Over time, we hopefully develop estblished norms, but at the moment, things are too much in flux. Put 5 sw engineers in a room, pose a problem and you wil…

For me, software design is more comparable to business system and organization design. It’s just that instead of humans executing the processes you design, it’s machines doing it.

I don’t think business system and organization design is approached like bridge design either, is it?

Also, bridges, houses and surgeons can physically kill people if something goes wrong. Software that can physically kill people, such as that in airplanes or missiles, is actually treated quite differently from most software, I think? I don’t have experience in those industries those so I can’t comment on the specifics of how is it different, but my impression is that things are a lot more rigid. Business organization design also can’t directly kill people.

In general, I think that there is a fundamental tension between looseness and flexibility of operations and innovation. If you are super rigorous and have set in stone best practices, it is going to be harder to find new ways of doing things that work better.

I’m not really bothered if people don’t consider software to be a serious engineering discipline. I’m not sure I do either. If someone wants that kind of thing, I’d recommend they go into a different engineering discipline, rather than trying to make software like that.

Re: Ask HN: Best codebases to study to learn software design?

#67

My suggestion is to search for open-source codebases in your favorite languages, study them, and start practicing them.

I'm definitely going to do that. I asked because I wanted to start off with some that I'd knew would be well designed. However, it would probably be more interesting to see a wide variety of quality than just the good ones. Or maybe open source projects are all usually well designed. I haven't looked at many in depth. The only one I've really looked into was Clang to try to figure out why clang format ignored my styl…

One of the best is actually the implementation of the Tcl language. It's highly readable C code, very well structured (it was initially by Ousterhout, after all).

Re: Ask HN: Best codebases to study to learn software design?

#68

Earlier quoted context omitted.

> for me it seems like you have to actually run into problems over and over and figure out how to avoid the problems This shows how immature the field of software engineering is. Imagine bridges or houses were built like that. Or your surgeon was trained like that. Over time, we hopefully develop estblished norms, but at the moment, things are too much in flux. Put 5 sw engineers in a room, pose a problem and you wil…

> This shows how immature the field of software engineering is. Imagine bridges or houses were built like that. Or your surgeon was trained like that. It's not that software engineering is immature, it's just more dynamic. We are not the surgeon, we write the surgeon. We write a surgeon to fix a broken leg. Once that is done, we don't have to fix another leg. Now we need to reattach a finger. Once that is solved, may…

Most swe is just crud

Re: Ask HN: Best codebases to study to learn software design?

#69

Maybe I’m just not good enough at paying attention, but for me it seems like you have to actually run into problems over and over and figure out how to avoid the problems. Then you end up being able to mentally simulate what problems you will run into, and design is basically all about avoiding future problems of various kinds (and balancing tradeoffs about which future problems to avoid and how much effort to put in…

> for me it seems like you have to actually run into problems over and over and figure out how to avoid the problems This shows how immature the field of software engineering is. Imagine bridges or houses were built like that. Or your surgeon was trained like that. Over time, we hopefully develop estblished norms, but at the moment, things are too much in flux. Put 5 sw engineers in a room, pose a problem and you wil…

> This shows how immature the field of software engineering is. Imagine bridges or houses were built like that.

You're forgetting a key difference between software and the physical world.

The blessing and curse of software is that there are few constraints on the solution so it can take an enormous number of different forms and still be valid. There isn't gravity, friction or the various other things that constrain physical solutions.

And each of those almost limitless solutions has different trade-offs related to a large number of different variables. It takes many many years of seeing the different impacts of those design decisions across the different variables within the constraints of different domains and contexts.

It's truly a combinatorial problem with so many dimensions that no human is smart enough to just simulate the impact of design decisions in new and unfamiliar domains+context.

You could argue that there could be standard ways of doing things within specific domains+context, but the context is so varied between companies, and business priorities have so many differences that I don't think it's a solvable problem.

The best we can do is have higher level patterns and approaches to specific types of problems that can guide people based on others experiences, but all of that still needs to be mixed and matched for the specific problem space.

Re: Ask HN: Best codebases to study to learn software design?

#70

Earlier quoted context omitted.

That's kinda like saying you can learn to drive by just getting into a car, crashing then thinking about how not to crash it next time. In reality both things are necessary. The car analogy doesn't hold for road driving because we drive well within the limits, but for racing it really is necessary to know exactly where the limits are. I don't think we should really be treating our profession like a race, though. But…

>That's kinda like saying you can learn to drive by just getting into a car, crashing then thinking about how not to crash it next time. That would be a perfectly valid way of learning to drive if crashing had no danger or destruction and you could instantly reset the car every time. Software is a special case of engineering where the cost of failure is extremely low, so trial and error is generally the fastest way t…

It would be an incredibly inefficient way of learning anything. You might as well say you could just rediscover all of human knowledge by just observing the world and doing your own experiments. Turns out standing on the shoulders of giants tends to get you further.
Post reply on HN