Beautiful Code 2015
June 15, 2015 9:56 PM

I want to look at and think about other people's design decisions as part of my effort to become a better software engineer. What open source code bases have taught you something valuable about the art and craft of writing code or the ins and outs of managing large, distributed software projects?

This doesn't have to be strictly about code--I'm also interested in seeing successful approaches to documentation, testing, and healthy community management. I'm aware of this question from 2011, but I'd love to see the 2015 version.
posted by rhythm and booze to Computers & Internet (11 answers total) 43 users marked this as a favorite
What languages and what's your background ? I greatly enjoyed learning/reading the Nethack code in the mid-90s.
posted by k5.user at 6:55 AM on June 16, 2015


I'd rather not limit this to languages, but if it helps frame the question better: C/C++, Python, SQL, Spark/Scala, some Java. I studied computer science in school and work as a data engineer. I've been working in industry/startup-y companies for about six years.
posted by rhythm and booze at 7:38 AM on June 16, 2015


For scala, if you're interested in typeclasses and higher-kinded types, I highly recommend Structures. It is influenced by Scalaz, but is much narrower in scope (and much easier to read and understand). Michael Pilquist, the author of Structures, also has a fantastic series of videos on YouTube (Functional Structures in Scala), where walks through implementing typeclasess such as Functors, Applicatives, Monads, etc. If you are interested in Scala and exploring the power of the type system, I recommend checking it out (it really helped solidify many of these concepts for me).
posted by chaotic_neutral at 7:50 AM on June 16, 2015


I don't think they're useful outside of Python, but Raymond Hettinger has a few videos on YouTube based on conference presentations; I thought "Beyond PEP8" was amazing, just a masterclass in refactoring.
posted by snarkout at 8:35 AM on June 16, 2015


Every time I deal with an open source project, I always find myself thinking, "I wish they did this like Moodle." It's not the best codebase ever, but the community management, dev process, and testing framework are just so well thought out.
posted by advicepig at 8:40 AM on June 16, 2015


Have you seen the Open Source Architecture book?
posted by aeighty at 9:24 AM on June 16, 2015


As a professional software developer, I always like to reread Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin periodically.
posted by boo_radley at 10:20 AM on June 16, 2015


Something I've been thinking a lot about recently is this writeup of a coding exercise as executed by Donald Knuth and Doug McIlroy. The exercise was to write a program that would read a text file, determine the n most frequently used words, and print out a sorted list of those words along with their frequencies.

The tl;dr is that Knuth wrote a carefully constructed literately documented 10 page Pascal implementation with some clever data structure and algorithm work. McIlroy's version was a six line shell script that more or less transparently composes well-known UNIX tools.

10 pages vs six lines.

This doesn't make Knuth chopped liver. A programmer doesn't always have the luxury of working with a full suite of convenient tools well-suited to their problem domain, and the merits of Knuth's careful and literate approach can serve well across many domains.

Still, there's something about this I think should strike any developer. It seems we talk about reuse & composability a lot more than we see it done this well, and when it is done this well it's not just elegant but kindof shocking.
posted by weston at 3:23 PM on June 16, 2015


The Django codebase has a good reputation for being both interesting and advanced, while remaining well structured and well maintained. It might not be elegant, but for a long-lived codebase in wide use, it's in very good shape, and there's a lot of practical lessons in it.

For technical achievement, the way that Django uses metaclass programming for models is considered quite good--again, in the "actually works and in use for a long time" mode.
posted by fatbird at 4:50 PM on June 16, 2015


"I want to look at and think about other people's design decisions as part of my effort to become a better software engineer. "

Checkout out exercism.io.

Basically, you complete a set of tests for a given language, and then submit your answers. You then get shown every one else's answers, with space for discussion about why you did what you did.

It's a great way to learn a new language, and participate in discussions about how to write / think about / talk about code.
posted by justalisteningman at 3:56 PM on June 21, 2015


I don't know if it qualifies as beautiful, but the Chromium project is huge, well tested, and incredibly fast moving. It also has some of the best tooling I've seen for any project. The code search links methods to their overrides, where they are called from, etc.
posted by Edible Energy at 6:52 PM on June 21, 2015


« Older Should I pursue a liberal arts degree?   |   How do you write a song? Newer »
This thread is closed to new comments.