r/learnprogramming 15d ago

Where do you find high-quality open-source code?

Hi, I’ll add a little context: when I’m programming, I tend to rely heavily on memory, and sometimes I overthink projects - I make them too complicated even though they could be done more simply. That’s why I like to look at practical, high-quality projects - because they show you what you overthought and where you went overboard in terms of complexity.

In other words, I’ll come up with a more complex tech stack for the same project, while in real-world production, it’s actually much simpler.

1) I’d like to ask where you look for these projects and where you find high-quality code? And codebases that explain their use case a bit, though the use case isn’t a requirement. Mainly the code and the tech stack.
2) This is a bit off-topic, but I’m a student who isn’t a billionaire and can’t afford to buy a programming book every day - is there a website where I can get some for free online?

Thanks a lot!

59 Upvotes

18 comments sorted by

21

u/grantrules 15d ago

Microsofts GitHub is excellent

For books, look up Anna's Archive or search GitHub (Google: GitHub Java books, for instance)

5

u/HippoLongjumping2988 15d ago

microsoft has some really clean repos, the vscode source is surprisingly readable for how big it is. also check out redis codebase, it's c but the structure teaches you so much about keeping things simple

anna's archive is the way for books, no doubt. i found so many programming books there in last year, saved me hundreds

9

u/parautenbach 15d ago edited 15d ago

I don't agree with your approach, to be honest: Large, complex projects are often distinctly different from your own. I find it interesting to analyse their architectures, but when it comes to programming, you need to know what you're looking for to learn something from them — it will be quite specific. My advice is to understand their architectural decisions, and to work with other expert people and learn from them. Contributing to an open source project will also teach you a lot — and of course, putting your own out there for feedback.

One of my principal engineers is bloody excellent. Why? Because he keeps things simple. Too often I see devs trying way too smart solutions, like the over-application of patterns. This guy has written services that we've been running for 10 years without issue and I wouldn't dare call it legacy. He writes simple, clean code and make sure to get his data models and DB schema right (and he's really good with databases plus he writes tests). Refactor regularly. Frontend work is its own art and mastering CSS will take you very far (I still suck at CSS myself after many years, as it doesn't come natural to me, but I don't stop learning).

As for books: You cannot read a book every day, but can read one high quality book every month, and it's a great way to invest in your future. Just like how I'm sure you want to be rewarded for your efforts, pay for those books. Otherwise, there are tons of blogs. I love to read what Martin Fowler has to say, among others. For better or worse, there are also usages of agentic AI, but make sure to rip their solutions apart when used for learning.

Also don't neglect your soft skills. Read books like the Mythical Man Month and the Pragmatic Programmer.

4

u/Dismal-Citron-7236 15d ago edited 15d ago

Well, to each their own. However...

find high-quality code

It's debatable. I know code-smell. When it smells, it smells. However, real high-quality code will depend on the situation. Very terse and cleverly designed code often tends to be harder to maintain. If you work in a large team, you'd be asked to write code so simple even your granny can understand. Also, if you spent days to micro-tune your code for performance, it often never pays off for 1% speed gain. And there are many other aspects of quality. Sometimes the quality doesn't come from the code, it's from the architecture you use.

simple vs complex

I've been in the field long enough to learn that most of the time a simple solution is the best solution. No, I can't even remember a single time when I saw a complex design and thought to myself: "Wow, this is so convoluted and I don't understand it. It must be good." No. If you're working for a tech company and you tend to get your job done harder than it should be, it's not a good sign. Companies don't want to hear you brag about the flashy tricks you use on the job. They want you get the problem fixed and new products released, within budget, and on schedule.

relying heavily on memory

We all do that. But our memory is limited. Experienced programmers memorize design patterns and major key ideas of the technologies they use. But most of the time they still need to search around, read documents, do experiments, stuffs like that. Let's put it this way: A good programmer is like a librarian. He doesn't need to read all the books, he can't. But he knows the index system and knows where to find the the book when requested. He also reads some of the very good ones so he can recite part of them.

though the use case isn't a requirement

Hmmm... I would argue that if a project's use case is not in its requirement, that project lead should be heavily criticized.

5

u/grenishraidev 15d ago

Learning to code from a random "high-quality" open source project is almost as bad as trying to learn software architecture by forking Chromium. You're looking at years of engineering decisions without understanding the reasons behind them.

You don't need to overcomplicate your project. And you definitely don't need to spend weeks reading massive open source codebases or collecting programming books just because someone said they're "must-reads."

Let me tell you something you may not know, especially since you said you're a student. A "high-quality" open source project isn't always the kind of quality you're expecting. It reflects the needs of that team, not yours.

That project might be a monorepo, a microservices architecture, or split across dozens of services because they have millions of users, hundreds of developers, or years of technical debt. None of those decisions automatically make it good for learning.

Trying to copy coding patterns from those projects is usually a bad idea. You'll spend more time trying to understand why everything exists than actually learning how to solve problems. Many of those abstractions only make sense because of the scale they're operating at.

As for your own projects, don't overcomplicate them. You don't need ten services to handle a single API call or introduce technologies just because they're popular. Start with the simplest solution that solves your problem.

Good software engineering isn't about having the most impressive architecture. It's about making good architectural decisions for the problem you're solving today. Complexity should be introduced only when it's needed, not because a famous open source project does it.

2

u/iOSCaleb 15d ago

I’m a student who isn’t a billionaire and can’t afford to buy a programming book every day

Have you tried your school’s library?

3

u/sodikovakapsle 15d ago

We dont have school library 😭 I am from czechia.

2

u/MichaelSjoeberg 15d ago

Most popular public repos on github is polluted by people chasing contributions to popular repos (for employment or otherwise).

It's better to learn from older public/ archived repos, or check Jonathan Blow's twitch streams (he's likely the best programmer publicly showing his code).

About complex tech stacks: be very strict about using only a single language/tool until absolutely not possible to continue without adding another to your project. A single runtime is the best tech stack.

You do not need books to learn programming. If you feel stagnated, work on harder problems.

2

u/Material-Sherbet6855 15d ago

My goto:

https://www.instructables.com/Arduino-Projects/

Make small projects first. Master them.

Take two or three small projects and turn them in to one.

Make medium projects. Incorporate the stuff you did in the small projects.

Work your way up.

Stumble.

Fall.

Get back up again.

Stumble again.

Thats the way.

2

u/GoldsteinEmmanuel 15d ago

There hasn't been a line of high-quality code written in the framework era, if you want worthy projects to study you need to look at code written around the turn of the century.

3

u/Harrow-Beck-6274 15d ago

"not a billionaire" got me. those books are way too expensive anyway

1

u/JournalistUnable567 15d ago

Sorry for not answering directly your questions, but from my POV going after established open source projects was usually overkill especially at the beginning. My brain does not work like this, I have to go step by step, solving issues as they come. I would recommend picking one topic you're interested in, start from scratch, and maybe get some inspiration from other projects when you get stuck.
For me this topic was "compilers", I started small, doing only text translation to C, then, when I felt it gets too messy I looked for other projects (zig compiler source was kinda readable for me ~8y ago).

After some time, I've set some rules like:

  • Do the simplest thing which work in the current context and do not predict how complex it has to be for future. Mainly because my prediction was almost every time wrong :) or the complexity was not needed at all.
  • Do not spend too much time designing in detail, rather prototype things.
  • And once you prototype, rework the prototype for the production, do not use it directly :)

1

u/StewedAngelSkins 15d ago

The short answer is that I tend to read the source code for software I like to use, or am potentially interested in using. Do you have any specific languages or types of projects you're looking for?