Privacy Notice: When you sign in with GitHub, your quiz attempts are stored in Google Firebase so you can track your progress. This data is only accessible to the course instructor, is not otherwise shared, and will be deleted at the end of the semester. For earlier deletion, contact the instructor. Prefer to stay anonymous? Use guest mode or a GitHub account without your real name.
Loading...
Sign in to track your progress and see your results across devices.
●Progress is being saved
03 Lecture 3 Quiz: From Greenfield to Brownfield
Score:0 / 15
Question Overview
PendingCorrectIncorrect
Instructions
This is an interactive quiz. Sign in with GitHub to save your progress, or continue as a guest.
Select your answer for each question
Get immediate feedback on your choices
Retry questions as many times as you need
Track your progress across sessions
Question1
Definitions
What is the key difference between greenfield and brownfield software development?
✓Correct!
Greenfield development starts from an empty directory where you make every decision — file names, architecture, conventions. Brownfield development means working in an existing codebase with pre-existing constraints, conventions, and users who depend on current behavior. It is not about technology age or team size — it is about whether you start with a blank canvas or an existing one.
✗Not quite.
Hint
Think about whether the canvas is blank or already has something on it.
💡Solution
Greenfield development starts from an empty directory where you make every decision — file names, architecture, conventions. Brownfield development means working in an existing codebase with pre-existing constraints, conventions, and users who depend on current behavior. It is not about technology age or team size — it is about whether you start with a blank canvas or an existing one.
Question2
Industry Reality
According to research cited in the lecture, how do professional developers spend the majority of their time?
✓Correct!
Research by Minelli, Mocci, and Lanza (2015) found that roughly 70% of development time goes to program comprehension — reading code, navigating call hierarchies, and building mental models of how existing components interact. The primary developer activity is not writing — it is reading.
✗Not quite.
Hint
The research tracked over 200 hours of IDE usage across 740 sessions.
💡Solution
Research by Minelli, Mocci, and Lanza (2015) found that roughly 70% of development time goes to program comprehension — reading code, navigating call hierarchies, and building mental models of how existing components interact. The primary developer activity is not writing — it is reading.
Question3
Testing
How does the role of tests change when moving from greenfield to brownfield development?
✓Correct!
In greenfield, tests are part of a workflow you choose to follow. In brownfield, the existing test suite is a contract: it encodes the expected behavior of the system. “All tests pass” is the minimum bar for any change, and pytest is your first and last command. Production validation does not replace tests — users finding bugs is not the same as a test suite preventing regressions.
✗Not quite.
Hint
What does breaking a test in an existing codebase actually mean?
💡Solution
In greenfield, tests are part of a workflow you choose to follow. In brownfield, the existing test suite is a contract: it encodes the expected behavior of the system. “All tests pass” is the minimum bar for any change, and pytest is your first and last command. Production validation does not replace tests — users finding bugs is not the same as a test suite preventing regressions.
Question4
AI in Brownfield
What is the “context problem” when using AI tools in an existing codebase?
✓Correct!
When you open a 10,000-line codebase, the AI has never seen it. It does not know the directory structure, naming conventions, test patterns, or architecture. Without context, the AI gives vague, generic answers and generates code that does not match the project’s style. The problem is not too much context or window size — it is that the AI starts with zero project knowledge.
✗Not quite.
Hint
What does the AI see when you open a project for the first time?
💡Solution
When you open a 10,000-line codebase, the AI has never seen it. It does not know the directory structure, naming conventions, test patterns, or architecture. Without context, the AI gives vague, generic answers and generates code that does not match the project’s style. The problem is not too much context or window size — it is that the AI starts with zero project knowledge.
Question5
Project Instruction Files
What is the primary purpose of a CLAUDE.md file in a brownfield project?
✓Correct!
A CLAUDE.md provides the AI with a structured map of the project: architecture, key files, testing patterns, git workflows, coding conventions, and common pitfalls. The same question asked with and without this file produces dramatically different answer quality — from vague generalities to specific, accurate references. It complements existing docs rather than replacing them.
✗Not quite.
Hint
Think about the before-and-after comparison shown in the lecture.
💡Solution
A CLAUDE.md provides the AI with a structured map of the project: architecture, key files, testing patterns, git workflows, coding conventions, and common pitfalls. The same question asked with and without this file produces dramatically different answer quality — from vague generalities to specific, accurate references. It complements existing docs rather than replacing them.
Question6
Project Instruction Files
During course preparation, the AI was given a comprehensive CLAUDE.md but still produced code with PEP 8 violations. What lesson does this teach?
✓Correct!
CLAUDE.md is influence, not enforcement. When the AI focuses on complex code generation, style rules can be crowded out. This is why CLAUDE.md and automated tooling (pre-commit hooks, linters, CI) are complementary layers: the CLAUDE.md guides the AI’s behavior, and automation catches what slips through. The file is not ineffective — it significantly improves output — but it cannot guarantee perfection.
✗Not quite.
Hint
What happens when the AI is focused on a complex coding task?
💡Solution
CLAUDE.md is influence, not enforcement. When the AI focuses on complex code generation, style rules can be crowded out. This is why CLAUDE.md and automated tooling (pre-commit hooks, linters, CI) are complementary layers: the CLAUDE.md guides the AI’s behavior, and automation catches what slips through. The file is not ineffective — it significantly improves output — but it cannot guarantee perfection.
Question7
Quality Standards
Which of the following is part of the expanded “Definition of Done” for brownfield development but NOT typically required in greenfield exercises?
✓Correct!
The brownfield Definition of Done includes: all existing tests pass (no regressions), new code has tests, coverage is maintained, code passes the linter, PR is reviewed, documentation is updated if behavior changed, and conventions are followed. In greenfield exercises like the SO Challenge, “done” simply meant “the plot looks right.” The key distinction is the emphasis on preserving existing behavior and meeting team standards.
✗Not quite.
Hint
Compare the table in the lecture that contrasts greenfield vs. brownfield criteria.
💡Solution
The brownfield Definition of Done includes: all existing tests pass (no regressions), new code has tests, coverage is maintained, code passes the linter, PR is reviewed, documentation is updated if behavior changed, and conventions are followed. In greenfield exercises like the SO Challenge, “done” simply meant “the plot looks right.” The key distinction is the emphasis on preserving existing behavior and meeting team standards.
Question8
AI in Brownfield
Which of the following is something AI excels at in brownfield development?
✓Correct!
AI excels at code explanation, test generation, refactoring suggestions, and documentation drafting in brownfield settings. However, it struggles with architectural decisions (the “why”), unwritten conventions, side effects and state, legacy patterns, and scope control. The key insight is that AI is strongest at tasks involving pattern recognition in visible code, not at understanding invisible context.
✗Not quite.
Hint
Think about what AI can do quickly that would take a human much longer.
💡Solution
AI excels at code explanation, test generation, refactoring suggestions, and documentation drafting in brownfield settings. However, it struggles with architectural decisions (the “why”), unwritten conventions, side effects and state, legacy patterns, and scope control. The key insight is that AI is strongest at tasks involving pattern recognition in visible code, not at understanding invisible context.
Question9
AI in Brownfield
Why does AI struggle with “legacy patterns” in existing codebases?
✓Correct!
Legacy patterns exist because removing them would break real users. The AI does not understand the historical context — why a workaround was added, which downstream systems depend on the current behavior. It may suggest locally sensible changes that violate broader constraints. While knowledge cutoffs and missing git history are real limitations, the core issue is that AI cannot distinguish intentional legacy patterns from genuinely improvable code.
✗Not quite.
Hint
Why might code that looks ‘bad’ actually be there on purpose?
💡Solution
Legacy patterns exist because removing them would break real users. The AI does not understand the historical context — why a workaround was added, which downstream systems depend on the current behavior. It may suggest locally sensible changes that violate broader constraints. While knowledge cutoffs and missing git history are real limitations, the core issue is that AI cannot distinguish intentional legacy patterns from genuinely improvable code.
Question10
Automated Enforcement
What role do pre-commit hooks play in AI-assisted brownfield development?
✓Correct!
Pre-commit hooks run automatically on every git commit and catch violations (like PEP 8 issues from ruff) before they enter the repository. They serve as the enforcement layer that complements CLAUDE.md’s influence layer — because even with comprehensive project instructions, AI-generated code can still contain style violations. They do not provide feedback to the AI during generation, nor do they replace code review.
✗Not quite.
Hint
What runs automatically every time you type ‘git commit’?
💡Solution
Pre-commit hooks run automatically on every git commit and catch violations (like PEP 8 issues from ruff) before they enter the repository. They serve as the enforcement layer that complements CLAUDE.md’s influence layer — because even with comprehensive project instructions, AI-generated code can still contain style violations. They do not provide feedback to the AI during generation, nor do they replace code review.
Question11
Tool Configuration
Which file serves the same purpose as CLAUDE.md but for GitHub Copilot?
✓Correct!
Different AI tools use different file names for the same concept: Claude Code uses CLAUDE.md, GitHub Copilot uses .github/copilot-instructions.md, and Cursor uses .cursorrules. The file names differ, but the content and purpose are identical: encoding project context that the tool reads automatically.
✗Not quite.
Hint
The file lives in the .github/ directory.
💡Solution
Different AI tools use different file names for the same concept: Claude Code uses CLAUDE.md, GitHub Copilot uses .github/copilot-instructions.md, and Cursor uses .cursorrules. The file names differ, but the content and purpose are identical: encoding project context that the tool reads automatically.
Question12
AI Diary
How does the AI Diary structure change when moving from a solo project to a shared codebase?
✓Correct!
In a shared codebase, the flat diary/001-xxx.md sequence would produce merge conflicts. Instead, the diary uses a branch-based structure: diary/feature//001-xxx.md. Each entry is committed alongside the code it documents, and commit messages use the [diary] prefix. PR descriptions complement the diary but do not replace it.
✗Not quite.
Hint
What would happen if multiple developers used the same flat numbering scheme?
💡Solution
In a shared codebase, the flat diary/001-xxx.md sequence would produce merge conflicts. Instead, the diary uses a branch-based structure: diary/feature//001-xxx.md. Each entry is committed alongside the code it documents, and commit messages use the [diary] prefix. PR descriptions complement the diary but do not replace it.
Question13
Refactoring
When refactoring code in a brownfield project, what is the primary safety mechanism?
✓Correct!
The existing test suite acts as a contract for expected behavior. When refactoring, all existing tests must pass without modification. If a test breaks, the refactoring changed behavior — you fix the refactoring, not the test. Code reviews help, but they cannot catch all behavioral changes the way an automated test suite can.
✗Not quite.
Hint
What do you do when a test fails after refactoring?
💡Solution
The existing test suite acts as a contract for expected behavior. When refactoring, all existing tests must pass without modification. If a test breaks, the refactoring changed behavior — you fix the refactoring, not the test. Code reviews help, but they cannot catch all behavioral changes the way an automated test suite can.
Question14
Conventions
Why is it important that AI-generated code follows the existing project’s conventions rather than generic best practices?
✓Correct!
In a brownfield project, conventions are pre-existing: naming patterns, import ordering, docstring format, test framework style. Without explicit context (like a CLAUDE.md), AI follows generic conventions (PEP 8) that may not match the project’s actual style. Inconsistency makes the codebase harder to read and maintain for all contributors. This applies to all projects, not just open-source ones.
✗Not quite.
Hint
Think about the Locust project using unittest.TestCase vs. pytest fixtures.
💡Solution
In a brownfield project, conventions are pre-existing: naming patterns, import ordering, docstring format, test framework style. Without explicit context (like a CLAUDE.md), AI follows generic conventions (PEP 8) that may not match the project’s actual style. Inconsistency makes the codebase harder to read and maintain for all contributors. This applies to all projects, not just open-source ones.
Question15
Measuring Success
Why is the question “did my change make it slower?” particularly important in the Locust codebase?
✓Correct!
Locust’s entire purpose is measuring and generating load. If a change adds 5ms of processing per request at 10,000 requests/second, that is 50 seconds of overhead per second. Performance is not a non-functional requirement — it IS the product. This makes benchmarking a natural part of every exercise. While CI benchmarks exist in some projects, the fundamental reason here is Locust’s core purpose.
✗Not quite.
Hint
What is Locust used for?
💡Solution
Locust’s entire purpose is measuring and generating load. If a change adds 5ms of processing per request at 10,000 requests/second, that is 50 seconds of overhead per second. Performance is not a non-functional requirement — it IS the product. This makes benchmarking a natural part of every exercise. While CI benchmarks exist in some projects, the fundamental reason here is Locust’s core purpose.