My personal nomination for code you should read next: the source code for Android.
The problem with with "good code" is that it tends to be code that -- more often than not -- is written by people I wouldn't trust to work on real-world large-scale software development.
On the other hand, any sufficiently large project that was successfully delivered necessarily contains almost exclusively "good code", because if it didn't, it would have collapsed under the overbearing weight of "bad code".
What makes the Android source code interesting reading:
- It's written by some of the best software engineers in the business, by any imaginable standard.
- It is an unimaginably successful project.
- It is codes that deals with the gritty enduring reality of programming in the large that cannot reasonably be addressed by toy samples of "good code". That's where real "good code" lives.
- As a programmer, that's the kind of scale I want to work on. Preferably as one of the principle engineers working on Android 1.0. But Android 14 wouldn't be awful.
Overwhelmingly, it is exceptionally good code. Occasionally it is less than happy code. But the places where it are less than happy are almost more interesting than the places where it's good.
The code is 14 years old. It's been through 14 major releases (34 minor releases). It started on phones with 320x200 displays, with megabytes of memory, and processors than could barely run a toaster. And now it runs on phones with 4k displays with 8GB of memory, on processors that are about 2.4 kilo-Crays.
If you're a junior programmer, every single line is better than what you're capable of writing. If you're a senior or intermediate programmer, there is serious food for contemplation. The question that should be asked at every turn: if I was on the Android 1.0 development team, what could I have done to make this happier code?
And I'd really like to see what the "Less code is better code" guru (a recent HN posting) could do with androidx/fragment/app/Fragment.java and friends. A perfect example of a "Good Code Guru" that I would not trust to work on any of my projects.
---
There is no such thing as bad code; but some code is happier than other code.
-- Herbie Hancock.
Or what Herbie Hancock would have said if he were a programmer instead of a jazz musician.