Stranger's Codebase
You'll find your way around 5,000 lines someone else wrote, map it, trace one feature through it, and land a tested change in it without asking the author anything.
About
Most of the code you'll ever work on was written by someone else, and reading it is a different skill from writing it. Beginners open a big project, scroll for ten minutes and close it. The trick is to never read it top to bottom. You start from one thing the program does, find the text it prints, and follow the calls backwards from there. Pick a project of at least 5,000 lines that you actually use, whether that's a library you depend on, a command line tool or a friend's abandoned side project. Sending your change upstream and talking to the maintainers is the Open Source track next door, so this badge is about the reading.
At a glance
- Per requirement
- 35 XP
- Completion bonus
- 300 XP
- Requirements
- 6
- Takes
- A month
- Skill level
- Intermediate (months of practice)
- Cost
- Free
- Supplies
- Nothing special
- Where
- At home
- Other people
- On your own
Requirements
-
1
Clone a codebase of at least 5,000 lines you've never read, and build or run it from its README alone. Pick something you use, so you care how it works. Count the lines with cloc or wc -l so you know the size. Follow the README exactly and write down every step that failed or was missing, because that list is your first lesson in how projects drift away from their docs. Take a screenshot of the line count and the program running from your own build. Photo
-
2
Draw a one-page map of the entry point, the main modules and how data moves between them. Don't read the architecture docs first, if there are any. Find where the program starts (main, an index file, or whatever the language calls it) and follow the imports outward. Three to six boxes with arrows is the right size, and if you need more, you're drawing files instead of ideas. Take a photo of the hand-drawn map. Photo
-
3
Trace one feature from the user's action to the line that does the real work, and write the call chain down. Pick something small and visible, like a flag the tool accepts or one function in the library's public API. Put a breakpoint or a print at the top and step down until you reach the line that actually does the job, then list every function on the way. Most features turn out to be five calls deep, and one of the five is a surprise. Film a short clip of stepping down the chain in the debugger, or take a screenshot of the written chain with the final line highlighted. Photo or video
-
4
Find where one behaviour is decided using search alone, starting from text the program prints. Pick an error message or a label you've seen on screen, grep the codebase for it, and walk backwards to the condition that triggers it. This is the trick nobody tells beginners: the words on the screen are in the source somewhere, and they're the fastest door into any program. Take a screenshot of the grep hit and the condition that leads to it. Photo
-
5
Make one change, matching their style, with a test that runs green in their suite. Fix a small bug or add a small option. Follow the conventions you see, even the ones you dislike, because a change that looks like it belongs is one that gets understood. Write the test in their framework, the way their other tests are written, and run the whole suite. If there's no suite, add the first test and say so. This can stay on your own fork, since getting it merged upstream is the Open Source track. Take a screenshot of the diff and the passing suite. Photo
-
6
Write a one-page guide for the next person who opens this codebase cold. Say where to start reading, which three files matter, what surprised you, and the one thing the README should have said. Keep it to a page, because a guide nobody finishes helps nobody. Take a photo or a screenshot of the guide. Photo