Live data from Hacker News

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

news.ycombinator.com

41–50 of 94 posts

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

#43

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…

you mention a key point. profession. programmer doesnt really imply professional programmer.

I'd aay if you do it for a living, certain tedious chores must be learned. the best programmers i know (professional) can all read code. they spent many junior years learning to read it, being on code auditing desk.... nowadays idk how the landscape looks, but for all of them they had to review and read code to find bugs before they were allowed to produce code (they all worked at same company ofc... so my view is limited!)

i do feel such discipline is needed. they can always poke holes on my code no matter how many holes i plug :) - i am semi professional. i write code for work, but not production code. (experimental). i never learned to audit code and feel that makes it impossible for me to truly create production grade code

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

#44
study modern code bases of language you want to learn, and look first at their history to see if they are mature, came from a company, academics etc.

you should not only study 'good' code... how will you know what is bad code?

study code that does similar things to what u want (client/server/game/ai/datacrunching etc.) and study lot of it..different qualities, ages, and sources

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

#45

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 will get not just 5 different solution proposals, but there will likely be strong disagreements on which approach is a good one.

"I recognize a good solution when I see it" is just not good enough for a serious engineering discipline.

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

#46

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…

> 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...

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

#47
I've done this for years and swear by it.

Top 5 codebases for changing my mind about things:

Wietse Venema's Postfix mail server. Taught me tons about security posture, the architecture i'd describe as microservices before microservices was a thing, but contrary to the modern take on microservices (it's mostly a tool for decomposing work across large semi-isolated groups) this was primarily about security and simplicity.

Spring framework - this opened my eyes to ways of working that i hadn't really thought enough about before, the developers on that project have a culture of deeply considering the needs of their users (who are java developers often in an enterprise environment).

Git - the thing i like about the git code base is that once you've covered the objects database (e.g. blobs, trees and commits) and the implementation of refs, everything else just feels like additional incremental features. With those core concepts, everything else is kinda harmoniously built on top.

Varnish by Poul Henning-Kamp is another one - feels like he went to great lengths to make that code base a teaching tool despite the fact it's also a top tier reverse proxy.

Last one isn't a code base - but it will help with software design in the large; studying how the lieutenants model works in the linux kernel.

Thinking about my answers, i think i've highlighted something subtly different than "well designed codebases" it's more a list of codebases that left a notable long lasting impression on me because of design decisions they made.

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

#48

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?

On forums like this people have a frustrating inability to answer the question asked.

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

#49

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. 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, maybe replace a kidney.

You cannot repetitively train or have strict rules for that, because every time it's something new. You need to have broad knowledge and experience to be able to fight the next unknown challenge. It's unknown because it's never been done before, or it has been done but your competitor will not reveal the details.

Building bridges or being a surgeon sounds very boring to me, since it's always the same (maybe some minor variants). Building software? Very much not the same.

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

#50
post #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.

Are there any books or websites you'd recommend I read to learn more about design instead? I 100% need to learn by doing, but wouldn't it also be good to learn what has already been discovered so I don't have to reinvent the wheel? Or is it best to discover good design on your own?

I learned on my own. If I were to recommend anything to read it would be to find a good book on refactoring or dealing with legacy code.

I read design patterns books when i was younger but in retrospect that was a hindrance more than a help.

Post reply on HN