How does TDD make refactoring easier?

前端 未结 8 915
温柔的废话
温柔的废话 2021-02-01 16:53

I\'ve heard that projects developed using TDD are easier to refactor because the practice yields a comprehensive set of unit tests, which will (hopefully) fail if any change has

8条回答
  •  感情败类
    2021-02-01 17:22

    TDD says write a failing test first. The test is written to show that the developer understands what the use case/story/scenario/process is supposed to achieve.

    You then write the code to meet the test.

    If the requirement changes or has been misunderstood, edit or rewrite the test first.

    Red-bar, Green-bar, right?

    Fowler's Refactoring is the reference for refactoring, strangely enough.

    Scott Ambler's series of articles in Dr. Dobb's ('The Agile Edge??') is a great walkthrough of TDD in practice.

提交回复
热议问题