Script Valley
Reading Other People's Code
Navigating Large Codebases/Assessment

Practice & Assessment

Test your understanding of Navigating Large Codebases

Multiple Choice Questions

6
1

You need to find all places in a codebase where a function called processPayment is called. What is the most efficient approach?

2

A route file imports directly from a database repository, skipping the service layer. What architectural problem does this suggest?

3

What is the primary advantage of reading tests before reading the implementation of a module?

4

In a call graph, you notice a utility function is called by 47 different files. What does this tell you about it?

5

You see this pattern: eventBus.on('order:placed', sendConfirmationEmail). Which design pattern is this?

6

What does a circular dependency between two modules (A imports B, B imports A) primarily indicate?

Coding Challenges

1
1

Trace the Express Router Chain

Clone https://github.com/gothinkster/node-express-realworld-example-app. Starting from app.js, build a text-based call graph showing every middleware and route handler that runs when a POST request hits /api/users/login. Format: each level indented 2 spaces, with the file name and line number in parentheses. Example: app.use(authenticate) (app.js:24). Your output file callgraph-login.txt must show at least 4 levels deep and correctly identify where the JWT token is generated. Input: the cloned repo. Output: callgraph-login.txt. Time estimate: 20–25 minutes.

Medium

Mini Project

1

Codebase Architecture Map

Choose any open-source project with 50+ files (suggested: https://github.com/expressjs/express or https://github.com/fastify/fastify). Produce an ARCHITECTURE_MAP.md containing: (1) Layer Diagram — a text-based diagram showing the dependency layers inferred from import statements (e.g., routes → middleware → core → utils). (2) Top 5 Hotspots — the 5 most-imported files, found via rg or grep counting references, with an explanation of why each is central. (3) Call Graph — a text call graph tracing one complete request lifecycle from entry point to response. (4) Pattern Inventory — identify at least 3 design patterns used in the codebase, with file references and a one-paragraph explanation of each. (5) Test Coverage Gaps — list 3 behaviors you can infer exist from the code that have no corresponding test. Use all Module 3 skills: search, import analysis, test reading, call graph building, and pattern recognition.

Hard