03 Lecture 3 Quiz: From Greenfield to Brownfield
March 2026 (2355 Words, 14 Minutes)
New: Interactive Quiz Available!
Want to track your progress and get instant feedback? Try our new interactive version with progress tracking, immediate explanations, and score calculation.
Instructions
- This quiz tests your understanding of key concepts from Lecture 3
- Each question has 4 options with exactly one correct answer
- Try to answer without referring to the lecture materials
- Focus on understanding concepts, not memorizing details
Question 1: Greenfield vs Brownfield
What is the key difference between greenfield and brownfield software development?
A) Greenfield means working with modern technologies; brownfield means maintaining outdated legacy systems
B) Greenfield focuses on designing architecture; brownfield focuses primarily on fixing bugs
C) Greenfield means building from scratch on a blank canvas; brownfield means working in an existing codebase with existing constraints
D) Greenfield is done individually; brownfield always requires a team
Show Answer
Correct Answer: C
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.
Question 2: Developer Time Distribution
According to research cited in the lecture, how do professional developers spend the majority of their time?
A) Writing new code from scratch
B) Attending meetings and writing documentation
C) Debugging production issues
D) Reading and understanding existing code (program comprehension)
Show Answer
Correct Answer: D
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.
Question 3: Tests in Brownfield
How does the role of tests change when moving from greenfield to brownfield development?
A) Tests become less important because the code has already been validated by users in production
B) Tests change from aspirational to existential — they encode the contract of expected behavior
C) Tests should be deleted and rewritten for each new feature
D) Tests only need to cover new code additions, not the existing functionality that already works
Show Answer
Correct Answer: B
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.
Question 4: Context Problem
What is the “context problem” when using AI tools in an existing codebase?
A) The AI knows nothing about the project — its architecture, conventions, or specific code — unless you provide that information
B) The AI has too much context and gets overwhelmed, leading to confused and contradictory outputs
C) The context window is always too small to fit any meaningful amount of code from existing projects
D) The AI cannot access or read files in existing projects without special configuration and plugins
Show Answer
Correct Answer: A
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.
Question 5: CLAUDE.md Purpose
What is the primary purpose of a CLAUDE.md file in a brownfield project?
A) To replace all existing project documentation — README, wiki, and inline comments — with a single AI-optimized reference file
B) To store compressed snapshots of the project’s source code for faster AI processing
C) To configure the AI model’s parameters such as temperature, token limits, and response format
D) To give the AI structured context about the project’s architecture, conventions, and workflows
Show Answer
Correct Answer: D
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.
Question 6: CLAUDE.md Limitations
During course preparation, the AI was given a comprehensive CLAUDE.md but still produced code with PEP 8 violations. What lesson does this teach?
A) CLAUDE.md files are ineffective because AI models ignore custom instructions when generating complex code
B) The CLAUDE.md was too short and needed more rules about Python-specific style conventions to be effective
C) CLAUDE.md provides influence, not enforcement — automated tools like linters and pre-commit hooks are needed as a complementary layer
D) PEP 8 violations are acceptable in AI-generated code since the AI prioritizes functional correctness over style compliance
Show Answer
Correct Answer: C
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.
Question 7: Definition of Done
Which of the following is part of the expanded “Definition of Done” for brownfield development but NOT typically required in greenfield exercises?
A) The code must compile and pass basic unit tests written by the developer
B) All existing tests pass, code reviewed via PR, conventions followed, coverage maintained
C) The code must pass automated formatting checks and have inline documentation for every function
D) The developer must update the project roadmap and notify all stakeholders of the change
Show Answer
Correct Answer: B
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.
Question 8: AI Strengths in Brownfield
Which of the following is something AI excels at in brownfield development?
A) Explaining existing code, generating tests for existing modules, and suggesting refactoring patterns
B) Making architectural decisions about why the codebase is structured in a particular way
C) Understanding unwritten conventions and implicit team knowledge that is not documented anywhere
D) Automatically detecting and resolving all side effects in concurrent and stateful code
Show Answer
Correct Answer: A
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.
Question 9: AI Struggles in Brownfield
Why does AI struggle with “legacy patterns” in existing codebases?
A) AI models have a knowledge cutoff that prevents them from understanding older APIs and deprecated library versions
B) Some code exists for historical reasons (backward compatibility, old bug workarounds), and AI may suggest “improvements” that break things
C) AI lacks access to the version control history needed to understand how the code evolved over time
D) AI tends to rewrite legacy code using the latest framework versions, causing compatibility issues with existing infrastructure
Show Answer
Correct Answer: B
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.
Question 10: Pre-commit Hooks
What role do pre-commit hooks play in AI-assisted brownfield development?
A) They provide real-time feedback to the AI during code generation, making its output more consistent with project conventions
B) They ensure that no code can be committed to the repository without first passing AI-assisted review and approval
C) They replace the need for manual code review by running comprehensive automated quality checks on every change
D) They automatically catch style violations and linting errors before code enters the repository
Show Answer
Correct Answer: D
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.
Question 11: Project Instruction File Equivalents
Which file serves the same purpose as CLAUDE.md but for GitHub Copilot?
A) .github/copilot-instructions.md
B) .copilotrc
C) copilot.config.json
D) .github/workflows/copilot.yml
Show Answer
Correct Answer: A
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.
Question 12: AI Diary in Shared Codebases
How does the AI Diary structure change when moving from a solo project to a shared codebase?
A) The diary is no longer needed because shared projects use PR descriptions instead
B) Each team member keeps a separate private diary outside the repository to avoid merge conflicts
C) It changes from a flat numbered sequence to a branch-based structure with subfolders per feature branch
D) The diary format stays the same, but entries are merged automatically by the CI/CD pipeline
Show Answer
Correct Answer: C
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/<branch-name>/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.
Question 13: Refactoring Safety
When refactoring code in a brownfield project, what is the primary safety mechanism?
A) The existing test suite verifies that refactored code preserves the original behavior
B) The AI guarantees that refactored code is functionally equivalent to the original implementation
C) Running the application once manually after refactoring is sufficient to verify correctness
D) Code reviews by experienced developers are the primary mechanism for catching refactoring errors
Show Answer
Correct Answer: A
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.
Question 14: Coding Conventions
Why is it important that AI-generated code follows the existing project’s conventions rather than generic best practices?
A) Generic best practices like PEP 8 often conflict with each other, so project-specific rules are needed to resolve ambiguities
B) AI models cannot generate code at all without explicit convention files, resulting in compilation errors
C) Following conventions is primarily important for open-source projects where external contributors need consistency guidance
D) Without matching existing conventions, AI-generated code creates inconsistency that makes the codebase harder to read and maintain
Show Answer
Correct Answer: D
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.
Question 15: Performance in Brownfield
Why is the question “did my change make it slower?” particularly important in the Locust codebase?
A) Locust is a mature project with accumulated technical debt that requires careful performance monitoring of every change
B) Python is an interpreted language, so every code change has a disproportionate impact on execution speed compared to compiled languages
C) Locust is a load testing framework where performance IS the product — overhead directly affects its core value proposition
D) The Locust maintainers enforce strict performance benchmarks in CI that reject any PR causing measurable slowdowns
Show Answer
Correct Answer: C
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.
Scoring Guide
- 13-15 correct: Excellent! You have a strong grasp of the core concepts
- 10-12 correct: Good understanding! Review the areas you missed
- 7-9 correct: Fair understanding. Revisit the lecture materials for key concepts
- Below 7: Please review the lecture carefully and reach out if you need clarification
Key Takeaways to Remember
- Brownfield dominates — 60-80% of professional development is maintaining existing systems, not building new ones
- Reading trumps writing — ~70% of developer time is program comprehension
- Tests are contracts — In brownfield, the test suite encodes expected behavior and is your primary safety net
- Context is paramount — AI knows nothing about your project unless you tell it, via CLAUDE.md or similar files
- CLAUDE.md is influence, not enforcement — Pair it with linters, pre-commit hooks, and CI for reliability
- AI is more useful AND more dangerous — More code to explain, but more to break and more conventions to violate
- Definition of Done expands — Tests pass, coverage maintained, linter clean, PR reviewed, diary complete
- Conventions are pre-existing — You follow them, not set them; encode them so AI follows them too
- Branch-based diary — In shared codebases, organize diary entries by feature branch
- Refactoring needs a safety net — Write tests first, then refactor; the tests prove behavior is preserved