The Code Review
Review 3 programs from another mind. Full workflow. Real judgment calls.
The skill: All three stances together — epistemic humility, computational empathy, collaborative posture. This is what verification looks like.
Time: 8-10 hours total
Estimated time remaining: 8-10 hours
The Context
You've joined a team. Another mind wrote three programs. They think the code works. Your job: verify whether it actually does what was requested.
This isn't bug hunting. It's asking: does this code match its specification? Are there inputs the author didn't consider? Would you trust this to run in production?
The Workflow
- 1READ — What is this supposed to do? What inputs and outputs?
- 2TRACE — Walk through with 2 sample inputs. Does output match expectation?
- 3VERIFY — Test 3 edge cases. What inputs might break this?
- 4CRITIQUE — List all issues. Explain why each matters. Rate severity.
- 5SPECIFY — For each issue, describe what the fix should accomplish (not the fix itself).
- 6OVERALL — Ship / Ship with fixes / Needs rework. Your call.
First: See What Good Looks Like
Before you begin, study this example. Watch how the workflow reveals a mismatch between what the code does and what it should do.
Example: A Simple Doubler
The code:
function double(x) {
return x + x;
}
// Example: double(5) returns 10From the author: “A function that doubles a number.”
1. READ — What is this supposed to do?
Purpose: Double a number
Expected input: x (a number)
Expected output: x × 2
2. TRACE — Walk through with sample inputs
Input: x = 5
return 5 + 5 → 10
Matches expectation? YES — 5 × 2 = 10 ✓
Input: x = "hello"
return "hello" + "hello" → "hellohello"
Matches expectation? NO — expected NaN or error, got string concatenation
3. VERIFY — Test edge cases
Edge case: Very large number (Number.MAX_VALUE)
Expected: Infinity or overflow handling. Actual: Returns Infinity. Maybe OK?
Edge case: NaN
Expected: NaN. Actual: NaN. OK
Edge case: String "3" (not number 3)
Expected: 6 or error. Actual: "33" (concatenation). Issue!
4. CRITIQUE — What's wrong? Why?
Issue: Uses + instead of ×. For numbers this works (5 + 5 = 10 = 5 × 2), but + has different behavior for strings.
Why it matters: If anyone passes a string (even accidentally), the function silently produces wrong output instead of failing loudly.
Severity: Major — core functionality is ambiguous
5. SPECIFY — What should the fix accomplish?
The function should either: (a) use x * 2 to ensure numeric multiplication, or (b) validate that x is a number and throw/return error for non-numbers. Option (a) is simpler and matches intent.
6. OVERALL — Ship, fix, or rework?
Recommendation: Ship with fixes
Summary: The function works for its intended use case (numbers) but fails silently for strings. A one-character fix (+ → *) resolves the ambiguity. Low risk, quick fix.
Notice: the code “works” for the happy path. The issue only appears when you question assumptions. That questioning is the skill.
Program 1: Tip Calculator
A function that calculates tip and total bill.
Tip Calculator
From the AI that wrote it: “A function that calculates the tip and total bill. Takes the bill amount and tip percentage as inputs. Returns an object with the tip amount and the total.”
The Code
1function calculateTip(billAmount, tipPercent) {2 // Calculate tip3 let tipAmount = billAmount * tipPercent;4 5 // Calculate total6 let total = billAmount + tipAmount;7 8 return {9 tip: tipAmount,10 total: total11 };12}13 14// Example usage:15let result = calculateTip(50, 20);16console.log("Tip: $" + result.tip);17console.log("Total: $" + result.total);1. READ
What is this supposed to do?
Program 2: Password Checker
A function that validates passwords against requirements.
Password Checker
From the AI that wrote it: “A function that validates passwords. Must be at least 8 characters, contain at least one number, and at least one uppercase letter. Returns true if valid, false if not.”
The Code
1function isValidPassword(password) {2 // Check length3 if (password.length < 8) {4 return false;5 }6 7 // Check for number8 let hasNumber = false;9 for (let char of password) {10 if (char >= "0" && char <= "9") {11 hasNumber = true;12 }13 }14 15 // Check for uppercase16 let hasUppercase = false;17 for (let char of password) {18 if (char >= "A" && char <= "Z") {19 hasUppercase = true;20 }21 }22 23 return hasNumber && hasUppercase;24}25 26// Example usage:27console.log(isValidPassword("Secret123")); // true28console.log(isValidPassword("password")); // false1. READ
What is this supposed to do?
Program 3: Number Guessing Game
An interactive game where the player guesses a random number.
New syntax in this program:
Math.random()— returns a random decimal between 0 and 1Math.floor(x)— roundsxdown to the nearest integerprompt(message)— shows a dialog, returns user's text input as a stringparseInt(str)— converts a string to an integer (e.g., "42" → 42)
Number Guessing Game
From the AI that wrote it: “A number guessing game. Computer picks a random number 1-100. Player guesses. Computer says higher/lower until correct. Tracks number of guesses.”
The Code
1function playGame() {2 let n = Math.floor(Math.random() * 100);3 let g = 0;4 let c = 0;5 6 while (g !== n) {7 let input = prompt("Guess a number (1-100):");8 g = parseInt(input);9 c++;10 11 if (g < n) {12 console.log("Higher!");13 } else if (g > n) {14 console.log("Lower!");15 }16 }17 18 console.log("Correct! It took " + c + " guesses.");19}1. READ
What is this supposed to do?
The Takeaway
Code review is collaboration between minds across time. The original author isn't here to explain — the code must speak for itself, and you must listen. This skill transfers: when you write code, you're writing for a future reviewer. When you prompt AI, you're specifying for another mind. The same careful attention applies everywhere.