volume_mute
TDD and Legacy Systems
publish date: 2026/06/19 10:09:34.120071 UTC
volume_mute
TDD is difficult to apply when working with legacy systems. What is the primary reason for this difficulty?
Correct Answer
It is hard to write unit tests for legacy code because the code was not originally designed with testability in mind, often having tight coupling and no clear interfaces
Explanation
TDD is difficult with legacy systems because legacy code was written without testing in mind. It typically has tight coupling between components, few clear interfaces, and no separation of concerns - making it hard to isolate units for testing. Refactoring legacy code to make it testable is a significant effort in itself.
Reference
Software Engineering, Ian Sommerville, 10th edition
