HACKER Q&A
📣 akudha

Courses explaining well-written codebases?


There are thousands of courses teaching people programming - some of these have become big businesses (plural sight, educative etc). But most of these are aimed at beginners. Some intermediate at best.

Are there courses that take well architected, well written codebases and explain the design principles, coding principles etc of such codebases?


  👤 zegerius Accepted Answer ✓
I always recommend The Architecture of Open Source Applications [0], it contains some really interesting stories. And it’s free!

[0] http://aosabook.org


👤 iman453
I’d come across https://codecatalog.org. I wish there were more of these kind of resources.

👤 beyang
We're trying out a series at Sourcegraph doing walkthroughs and deep-dives into popular open-source projects:

1. How Caddy web server works: https://sourcegraph.com/notebooks/Tm90ZWJvb2s6MTM2Nw==

2. How TypeScript ESLint works: https://sourcegraph.com/notebooks/Tm90ZWJvb2s6MTA2OA==

The goal is to write these as if we were onboarding new contributors to the codebase. If there are maintainers of projects that'd like to be featured, please hit us up: https://discord.gg/SQCbGe6zTn. And you can subscribe here: https://tourdesource.substack.com.


👤 rmk
I started reading this book, but lost interest pretty quickly. Maybe you'll like it if you give it a shot: https://www.amazon.com/Code-Reading-Open-Source-Perspective/...

Effective Java by Joshua Bloch has code snippets that are very well-written, as are the examples in The Go Programming Language by Donovan et. al. I read practically all the code in Effective Java, and a lot of the examples in The Go Programming Language (I keep dipping into this book every now and then as I have to learn some aspect of Go, which I use at work; I think I may actually sit down and read this book cover-to-cover and perhaps play with most of the examples).

If you know C, you may want to give the examples in The C Programming Language by Kernighan et. al a go. The examples are written in a bit of an archaic dialect but still very clear.

Another book of note that is funny and engaging (but of course not something that has professional value) is If Hemingway Wrote Code by Angus Croll: https://nostarch.com/hemingway. I think I have read all of the code in this book.


👤 NovaX
"Operating Systems: Design and Implementation" is a classic book that was walks through Minix. It was a commonly used as a follow up course with projects to modify its code. Due to the author wanting to keep it dedicated towards education rather than real systems, it did not become a professional project but did inspire Linux' creation. There are similar books for other OSes, such as BSD and Solaris.

A broader but less detailed approach for casual readers are the books "Beautiful Code" and "The Architecture of Open Source Applications".


👤 jerjerjer
> well architected, well written codebases

Not a lot of that, tbqh.

Check the PostgreSQL codebase. One of the cleanest big codebases around. Here's a list of resources for devs: https://wiki.postgresql.org/wiki/Developer_FAQ#What_informat...

Also, what are your goals? Understanding ugly written, barely working, and badly designed codebases is a much more useful skill.


👤 johnamata
Course? Like with lectures and work? The only one I know that does it is the premium course at https://watchandcode.com/ where the premium's focus is teaching students how to read (javascript) codebases. They start you with a small library then you graduate to exploring increasingly complex open source codebases, along the way picking up concepts in computer science and javascript. It has a heavy focus on contributing to open source, advanced students are working on open source projects such as those from Mozilla. It uses javascript though, so if that's not your cup of tea, then your best bet are blog posts and books, such as

- xv6: https://pdos.csail.mit.edu/6.S081/2021/xv6/book-riscv-rev2.p...

- tensorflow (google translate can do PDFs): https://github.com/horance-liu/tensorflow-internals


👤 hazelnut-tree
Niklaus Wirth is the creator of the languages Pascal, Modula-2 and Oberon. Wirth used Oberon to write a complete desktop computer system, documenting the software design of the system in a freely available book. The Project Oberon website succinctly describes the project:

"Project Oberon is a design for a complete desktop computer system from scratch. Its simplicity and clarity enables a single person to know and implement the whole system, while still providing enough power to make it useful and usable in a production environment. This website contains information and resources for exploring and using the system. The project is fully described in Project Oberon: The Design of an Operating System, a Compiler, and a Computer — written by the designers, Niklaus Wirth and Jürg Gutknecht."

http://www.projectoberon.com/


👤 wizwit999
I think Sourcegraph had a written series on this, can't remember the name.

👤 a-dub
a lot of gnu software is excellent to read, although sometimes portability concerns can obfuscate it a bit.

codebases written in functional languages are also good. in general, when there's a higher barrier to entry, higher quality work is more prevalent.

consider spending some time teaching yourself how to find the best codebase that solves a particular problem. not only does that give you leverage for more learning down the line, it also helps you to develop the much more directly valuable skill of selecting good technology (and detecting crap before it's too late).


👤 yamrzou
Build your own text editor: https://viewsourcecode.org/snaptoken/kilo/index.html. It goes through antirez's (creator of redis) kilo codebase.

Here is a list of similar tutorials from the same blog: https://viewsourcecode.org/snaptoken/similarTutorials.html


👤 jfrd
Check out PBRT, an academy award winning book about a rendering codebase!

https://pbrt.org/


👤 billfruit
I'd be more interested in a course focused on the history of the development of a real software product from the industry.

👤 pamelafox
We once had a reading club at Google on the “Beautiful Architecture” book. I didn’t necessarily agree with all the claims of beauty, so it was nice to read it in a book club setting. Beauty is in the eye of the maintainer! :)

👤 tracerbulletx
It would be nice to see more software project case studies as a genre.

👤 pkrumins
There’s no such thing as a well written codebase. There’s only code you wish you wrote and actual code that is deployed to production.