-
Peter Norvig's Pytudes was recently posted here. I think that's some of the best code I've read, although they're only small problems and not a bigger project. Still very much worth a read, he goes through the whole problem solving through code process.
https://github.com/norvig/pytudes
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
Refactoring-Summary
Summary of "Refactoring: Improving the Design of Existing Code" by Martin Fowler
I find that reading books rather than code tends to be more helpful in terms of finding good takes on what clean code is -- more specifically books on refactoring or specific language-related features (like 'Effective Java' or 'Fluent Python'). The issue with just reading code is that many times - you'll miss out on why the author chose to use the expression or abstractions which they chose to use. Reading a book at least takes you through author's thought process. For an alternative - you could always browse repositories which contain notes on refactoring as well like this one (which does a good job summarizing some of the key principles from Fowler's book on refactoring):
https://github.com/HugoMatilla/Refactoring-Summary
-
This isn't exactly a repo to look at, but the book "Clean Code" is a fantastic read for learning how to write good code. It does have a lot of examples in it, and does a great job explaining everything. https://github.com/jnguyen095/clean-code/blob/master/Clean.C...
-
The-Simpsons-Hit-and-Run
Stolen (and slightly cleaned up) version of The Simpsons: Hit & Run original source code from 2003
I'm an F tier programmer but I think the Simpson's Hit and Run game has some really great code. Its easy to read and well organized in my opinion.
https://github.com/Svxy/The-Simpsons-Hit-and-Run/tree/eb4b34...
-
I'll shoot with two examples:
(Tooting my own horn) A Fitbit watchface that I wrote a few years back: https://github.com/GWBasic/Binaryish-Clock
An event/threading library for C#. I keep a fork in my Github because the original source was archived: https://github.com/GWBasic/retlang
Note that both examples are "functionally obsolete." The Fitbit studio environment is deprecated in favor of Android Watch; and if you're using C#, you can should be using Tasks to get similar functionality to Retlang.
-
I'll shoot with two examples:
(Tooting my own horn) A Fitbit watchface that I wrote a few years back: https://github.com/GWBasic/Binaryish-Clock
An event/threading library for C#. I keep a fork in my Github because the original source was archived: https://github.com/GWBasic/retlang
Note that both examples are "functionally obsolete." The Fitbit studio environment is deprecated in favor of Android Watch; and if you're using C#, you can should be using Tasks to get similar functionality to Retlang.
-
The sqlite code base is really well done. Lots of documentation.
https://github.com/sqlite/sqlite
-
-
Is there any particular language you're looking for? I've found some languages hideous until I understood them and could appreciate their respective graces. Off the top of my head the I can think of a couple.
The first is Jones Forth (https://github.com/nornagon/jonesforth), start with jonesforth.S and move into jonesforth.f. I really enjoyed following along with it and trying my hand at making my own stack based language.
The other is Xv6, a teaching operating system from MIT (https://pdos.csail.mit.edu/6.828/2021/xv6.html), not all the code or implementations are top notch but it shows you non-optimized versions (just because they're simple and more readable) of different concepts used in OS design.
If you're interested in the embedded world, there is a really neat project I've been following that feels a more structured and safe (as in fault-tolerant) while still staying pretty simple (both conceptually and in the code itself): Hubris and Humility (https://hubris.oxide.computer/).
-
the right amount of context + easy-to-use tooling
- Code culture; follow industry best practices and make it clear where & why you deviate
My personal favorite one: `make todo_list`
We use keywords (TODO, OPTIMIZE, HACK, etc…) through the codebase and make them easily searchable with make helpers.
Ref: https://github.com/pokt-network/pocket/blob/main/Makefile#L5...
-
The question doesn't specify any language, so FWIW, I first learned "serious" programming by reading the sources for GNOME Glib, about 18 years ago.
https://gitlab.gnome.org/GNOME/glib
-
I learned a ton about Java and pragmatic algorithm development from reading Dagger (https://github.com/square/dagger) and porting it to C#. It's small enough that you can grok it in a reasonable amount of time, but sophisticated enough that there's a lot to learn. (Yes it's deprecated in favor of Dagger 2, but the latter is a tougher slog IMO)
Actually most of the big Square OSS libraries are great to read - okio, okhttp, picasso.
-
I've met a few young programmers who heard somewhere that object-oriented programming was bad and they want to get the enlightenment of functional programming that they've heard about. Frequently they travel from job to job like itinerant martial artists always looking for somewhere where they practice the true technique but they always seem disappointed as it is just as easy if not easier to screw up handling errors with monads than it is with exceptions and they find analogies like "a monad is like a burrito" just get them more confused.
As for something profound I'd point you to
https://github.com/cerner/clara-rules
which many people will struggle with because like many other production rules engines in LISP (and many other examples of simple compilers), there is hardly any code! Contrast that to the orders of magnitude larger rules engine Drools
https://github.com/kiegroup/drools
which is so crazy-complicated primarily because the Drools language is Java-based so you need all sorts of things that Clara or CLIPS don't need.
-
Drools
This repository is a fork of apache/incubator-kie-drools. Please use upstream repository for development.
I've met a few young programmers who heard somewhere that object-oriented programming was bad and they want to get the enlightenment of functional programming that they've heard about. Frequently they travel from job to job like itinerant martial artists always looking for somewhere where they practice the true technique but they always seem disappointed as it is just as easy if not easier to screw up handling errors with monads than it is with exceptions and they find analogies like "a monad is like a burrito" just get them more confused.
As for something profound I'd point you to
https://github.com/cerner/clara-rules
which many people will struggle with because like many other production rules engines in LISP (and many other examples of simple compilers), there is hardly any code! Contrast that to the orders of magnitude larger rules engine Drools
https://github.com/kiegroup/drools
which is so crazy-complicated primarily because the Drools language is Java-based so you need all sorts of things that Clara or CLIPS don't need.
-
-
-
-
If you like Python, the library sortedcontainers as a clear, well documented, yet short source code that is a joy to read for a non trivial problem:
https://github.com/grantjenks/python-sortedcontainers/blob/m...
-
Rust stdlib code is quite high quality although not particularly dense due to large amount of comments. Start from the docs, and click any source link: https://doc.rust-lang.org/std/vec/struct.Vec.html
Sqlite is supposedly high quality C code: https://github.com/smparkes/sqlite
For videos of someone (Casey Muratori) writing video game code and debugging it, Handmade Hero: https://handmadehero.org/
A blog post about how to write code by the same author: https://caseymuratori.com/blog_0015
For how to implement a fairly advanced type system, Typing Haskell in Haskell: https://gist.github.com/chrisdone/0075a16b32bfd4f62b7b
But, honestly, you're probably better off writing code yourself and learning by doing.
-
I recently came across Beanie. A Python ORM for MongoDb. A pleasure to work with and integrates well with FastAPI, the tests document the code well, and at this point it’s only as complicated as it needs to be.
https://github.com/roman-right/beanie
-
Related posts
-
Any tips to improve my coding abilites ?
-
Python Code Reviews and Collaboration Best Practices and Tips
-
Using PostHog in Remix Loaders and Actions on Cloudflare Pages
-
Posthog – The single platform to analyze, test, observe, and deploy new features
-
Open-interpreter: A natural language interface for computers