Which check should you run before editing and after each small refactoring step?
- Only the compiler's syntax check
- Only the code's line count
- The relevant automated tests
Which must be preserved during a refactoring?
- Returned values and effects
- The order of private helper definitions
- The internal arrangement of helper functions
Replacing a whole block in one edit automatically rules out refactoring, even if all observable behaviour is preserved.
Circle one: True False
You will rename and move a class. Which plan makes failures easier to locate?
- Rename and move together, then update imports
- Move the class, leave its existing uses in place, then test
- Separate the changes, update uses and imports, and check each
A billing function reads input, computes a bill and prints it. Which extraction plan best supports preserving its behaviour?
- Extract the bill and revise its rounding
- Extract one job, preserve its inputs and effects, then test
- Extract printing and check just the returned total
A previously passing check fails after one extraction. What is a useful next action?
- Update the expectation to match the extracted code
- Investigate the failure; undo the latest edit if needed
- Finish extracting the remaining jobs before inspecting this failure
Passing tests after every refactoring step prove that behaviour is unchanged for all inputs and effects.
Circle one: True False
A teammate combines a bug fix with helper extraction and labels the whole change refactoring. How should the review distinguish the work?
- Separate the intended behaviour change from the restructuring
- Review the extracted helpers and leave the bug fix implicit
- Use the passing old tests to review the combined change as restructuring