Evolutionary architecture and emergent design: test-driven design, part 1th

Source: Internet
Author: User
Tags final

A common kind of agile development practice is TDD. TDD is a pattern of writing software that uses tests to help you understand the final steps of the requirements phase. Write the test first, then write the code, which will consolidate your understanding of what the code needs to do.

Most developers think that the main benefit of TDD is the resulting integrated unit test set. However, if executed correctly, TDD can improve the overall design of the code, because it defers the decision to the final duty moment (last responsible moment). Because you don't make any design decisions in advance, it allows you to use better design options or refactor to better design at any time. This article describes an example that demonstrates the strengths of the design based on the results of unit tests.

TDD Work Flow

The key word in the test-driven development terminology is the driver, which means that the test will drive the development process. Figure 1 shows the TDD workflow:

Figure 1. TDD Work Flow

The workflow in Figure 1 is:

Write a failed test.

Write the code to pass the test.

Repeat steps 1th and 2nd.

Actively refactor in this process.

When you can't think of any more tests, you have to make a decision.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.