Step 3 of my guide is to learn a project's internals with an approach I call “trace down, learn up.” I trace one familiar feature from the outside inward to map its codepath and subsystems, then study those subsystems from their innermost, least abstracted components upward.
I call my approach to learning project internals “trace down, learn up.”
When tracing a feature, I take notes about the files, lines, and functions I’m going through, but I do not yet attempt to understand how anything works.
I recommend staying focused and learning feature by feature rather than trying to read a whole project line by line: “Stay focused and learn feature by feature.”
When choosing a feature to trace, I recommend picking one that you're familiar with as a user and, if possible, one that seems simple on the surface.
When learning a subsystem, I start at the innermost point because it is usually the most fundamental and least abstracted.
To start learning a specific subsystem, I recursively “trace down, learn up,” examining its public, exported API surface and learning how each API call works.
I find it critical to learn how to build a project before attempting to read the internals, because experimentation and rebuilding test my understanding.
While learning, I experiment by adding logs, implementing tiny chunks of functionality, or changing existing functionality, then rebuild the project and see what happens.
I recommend supplementing source-code study with books, videos, blog posts, and other media, but say there is no substitute for getting hands-on with source code to “become a maintainer.”
When resources for learning internals do not exist, I recommend writing them; writing reinforces learning and helps future contributors.
I read recent commits relevant to the subsystems I’ve studied and test that I fully understand why the change was made.
To reimplement a commit, I checkout the repository at the commit just previous to the commit I’m studying, reproduce the bug if applicable, implement a solution, and compare it with the maintainer’s or contributor’s change.
For an initial commit exercise, I recommend avoiding changes that require more than 50 to 100 changed lines to start.
For a first contribution, I like to start small and incrementally take on larger and larger tasks.
I browse project issues for contributor-friendly work, expect possible false starts or abandoned issues, and recommend following the documented contribution process exactly.
My first contribution to Zig was a three line change that took me around four or five hours to complete over two evenings; that estimate did not include the time spent on prior steps.
I said that if the same bug surfaced today, I would be able to fix it in minutes, but that it takes time to reach that level of proficiency.
I argue that complex projects such as programming languages, browsers, and databases are made by humans, not magic or the preserve of higher beings, and I hope my process makes them more approachable.
The guide is dated March 13, 2022.
I wrote about Zig compiler internals at https://mitchellh.com/zig because I couldn't find a similar up to date resource.
When I studied the Zig compiler, I traced zig build-exe from the command to the CLI, the build-exe subcommand, the “Compilation” subsystem, and then the lexer and parser.
From tracing notes, I can usually get a “big picture” of how something works and discern major subsystems from filenames and functions, which helps divide learning into more reasonably sized chunks.
I warn that people can get lost for weeks or months and discouraged when they try to read an entire project line by line.
My first Zig compiler tracing example was a program that added two numbers and had zero output.
As I climb subsystem layers, they tend to grow more abstract, making them harder to learn without understanding the component pieces.
Examining a subsystem’s public API shows how higher-level layers use it, guiding my learning and clarifying the stack as I move upward.
While learning the Zig tokenizer, I added new tokens and saw that they tokenized but then saw that the parser failed; when I reached the parser, I made my new tokens do something.
I recommend reading available literature about internals, but I warn that books, videos, and blog posts alone should not be expected to produce expertise.
I describe relying on literature rather than hands-on source work as another example of theoretical vs. practical application.
I call reimplementing commits my “doing the problem set in the back of the textbook” portion of learning.
For commit exercises, I inspect either the project’s history or the history of a relevant file or folder, and I may study the solution first or attempt to fix the bug before comparing solutions.
When reimplementing a change, I use only the +/- lines on the VCS diff as a hint about the necessary change size.
After understanding a project’s technical components, my next contribution goal is to learn its human components through the contribution and review process.
I say there is no silver bullet for finding a small change, and describe making false starts or abandoning issues before finding one.
I say the time it takes to find or fix an issue may be frustratingly long, but it is the price of admission.
Projects often use “contributor friendly” labels to help guide new contributors.
If I have joined the community in earlier steps, I can ask someone for help or to double-check my contribution process.
The time for my first Zig contribution did not include the time commitment of prior steps.
I say complex projects such as programming languages, browsers, and databases are not magic or destined for “higher-beings”; all projects were started by other humans, and if they could do it, I can do it too.
In my March 13, 2022 article “Contributing to Complex Projects,” I describe a repeatable way to become confident learning and contributing to software whose implementation is not trivially understood. I intend the approach for open-source and proprietary projects, whether hobbyist or professional; at work, other engineers are directly available to help, while in open source contributors are mostly on their own. I don’t expect the pattern to work for everyone, but hope it helps people feel confident attempting to learn and contribute. My definition of a complex project is subjective.
I say the guide applies to software projects “regardless of whether they are open source or proprietary, hobbyist or professional.”
I describe professional work as offering “direct access to other engineers who are willing — if not obligated — to help you,” whereas in open source “you’re mostly on your own.”
I define a complex project as “any software project where the implementation isn’t trivially understood.”
I say “This definition is subjective”; different people may disagree about whether a project is complex.
Step 1 is to become a user before trying to understand the project’s internals. Expert-level user knowledge is unnecessary: my personal graduation criterion is to try building something real with the project, even if it is small or simple.
Before contributing to Zig, I created four real libraries: libflightplan, zig-graph, zig-libxml2, and zig-libgc.
I say creating toy projects is “an important step to bridge the gap from theoretical to practical understanding.”
I say using a project helps me learn its idioms, which “help guide an understanding of why a project works the way it does, has the features it does, etc.”
As a user, I say, “you’ll gain a broad understanding of the capabilities of the project.”
I say, “There is a stark difference between reading the reference documentation and using a project in practice.”
I describe project idioms as “the cultural undertone.”
I say learning project idioms helps form empathy for the humans working on it and guides judgments about which changes may or may not make sense.
- I recommend joining the project community early: “Join IRC or Discord,” attend a local meetup, and watch talks.
I recommend spending a period listening more than talking; the goal is to gain empathy and learn how the project works. I’m often surprised by how much I learn by watching others learn.
Step 2 is to build the project and get a working binary or equivalent. Initially, don’t worry about understanding the build system or dependencies: use guides, websites, or whatever instructions help reliably and repeatedly turn source code into a runnable binary on your system.
My instruction is: “Don’t read the code before learning to build the project.” I observe that people often get bogged down trying to understand source code before learning how to build the project.
I explain that “its hard to experiment and break a software project without being able to build it.” Building first makes experimentation and breaking things possible.
I say not to worry about feature-complete builds: features may require the right dependencies, systems, or configuration. The initial goal is “a binary that works well enough on your system”; later experience and confidence can help pursue more complete builds.
During the build step, I recommend “learning how to run the test suite and getting that to pass” so later experimentation is easier.
Complex projects may have complex test suites; sometimes “getting only a subset of the test suite running — whatever is enough to experiment” is sufficient.
The captured excerpt is dated March 13, 2022 and includes the first two steps, “Step 1: Become a User” and “Step 2: Build the Project.” It ends mid-sentence after “whatever you need to reliably and”; the rest of that instruction and any later steps are not present in this excerpt.