Live data from Hacker News

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

news.ycombinator.com

21–30 of 94 posts

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

#22
There's a free book on this topic: The Architecture of Open Source Applications

https://aosabook.org/en/index.html

Maybe that would be a good start. You can then pick a project to dive in.

As a more specific tip, I've done some hacks in Nginx long time ago and found it quite nice.

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

#24
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…

Yeah, as I've been learning more about software design, it's become pretty clear there is no silver bullet. It would be nice though. I find it a bit overwhelming to try to find the best solution for a problem when there are so many different architectures and programming paradigms.

That being said, taking into account the requirements does eliminate quite a few of the options. Right now, I work on safety-critical embedded systems which requires us to make some decisions that would most likely be way different in other environments.

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

#25

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…

I have this too, I have never been able to "do exercises" or "study a codebase". I need to be making something that I am excited about, then I'll learn, from examples, from wanting to be thorough and correct.

But sometimes I think I'm just not their yet, if I become able to read code like a book and really understand what happens, which often I don't, then perhaps I'll enjoy the process more.

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

#26
I dont think this is a good idea, actually. Good design is about making good trade offs at the right point in time.

A code base with excellent design will show you the end state but not how it got there but probably not the trade offs and decisions involved.

Practicing refactoring on subpar code bases and dealing with the consequences of your decisions is a better way to improve.

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

#27

My immediate reaction to this question is: "your team's". Nothing will teach you more about how to design software then really understanding why good and bad solutions were adapted to solve a certain real problem. Software exists precisely because there is still a messy layer connecting user requirements to actions on a computer. If there was not messiness then we could just automate it all. Approaching software from…

I haven't considered time to implement as a metric for evaluating design, but it makes a lot of sense.

I definitely learn so much from my team's codebase. Most of what I learn is either from the good designs I see in there or from my googling trying to fix the not so good parts.

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

#28
To answer your actual question:

The codebases I learned from the most are Git, Postgres, CPython. Not saying they are perfect designs, but they are well maintained, solve hard problems, have seen many years of evolution, and are very easy to get your hands on.

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

#29

My immediate reaction to this question is: "your team's". Nothing will teach you more about how to design software then really understanding why good and bad solutions were adapted to solve a certain real problem. Software exists precisely because there is still a messy layer connecting user requirements to actions on a computer. If there was not messiness then we could just automate it all. Approaching software from…

What if the question is born out of the insight that his team's software is poorly designed, motivating the desire to get outside input? What if the question is asked by a college student?

Then it still matters a lot what kind of codebase he is working on. A web project is differently structured and done than the codebase for a embedded operating system. There are differend standards and practices in the industry.

I learned a lot by just stepping through the code with the debugger of libaries I used. That brought more practical insight while learning about design patterns etc. In the end, it is all about patterns. Finding the right pattern for a given problem.

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

#30
Your own. Everyone else's is trash. Never understand someone else's code-- the whole point is that there should be just a handful of functions of yours I can call, and shouldn't ever care to see how the sausage is made. Otherwise, your abstraction sucks
Post reply on HN