Reading list: How does Test Driven Development (TDD) help in writing clean and modular code?
Test Driven Development (TDD) helps in writing clean and modular code by promoting:

Small, Focused Units: Writing small tests encourages small, single-responsibility functions, leading to modular code.

Better Design: TDD forces thinking ahead about code behavior, leading to well-structured, modular components.

Refactoring: Regular refactoring is safe with tests, improving code structure and removing unnecessary complexity.

Clear Interfaces: Tests ensure components have clear, simple interfaces, supporting modularity.

Eliminating Duplication: TDD helps identify and remove code duplication, leading to cleaner, modular code.

Comprehensive Test Coverage: Every component is tested, ensuring better modular integration.

Collaboration: TDD promotes clear modules that are easier for teams to work on independently.

Reduced Complexity: TDD keeps code simple by focusing on passing tests, naturally leading to more modular code.

In short, TDD results in code that is simpler, cleaner, and modular by design.
https://www.samyak.com/news-post/test-driven-development/