Test-driven development

Source: Internet
Author: User

1. When we start a job, we need to create a plan list (to-do list) To remind us of what we need to do.

Comment: when I was in elementary school, the teacher started to say this. Er, I have been doing this for more than 20 years :(

2. Remember, we do not start from object creation, but from testing.

3. Run the test as soon as possible:

A. pseudoCode: Return a variable, and gradually replace the constant with the variable until the pseudo code turns into the real code.

B. display implementation: Enter the actual implementation.

4. Value Object: Once the instance variable of the value object is specified in the constructor, changes are no longer allowed. An implicit meaning of a numeric object is that all operations must return a new object. Another implicit meaning: equals () must be implemented ();

5. Write this test by copying and editing with no scrubsProgram.

Self-assurance will never go home until repetitive design is eliminated.

Comment: the complexity of the test code is 1. It does not have branches and loops, so many codes can be written and tested by copying and editing.

6. Maintain program test integrity before refactoring.

Comment.

7. Test-driven development process:

A. Add a small test.

B. run all the tests. The operation fails.

C. modify it as appropriate

D. Run the test and the test is successful.

E. Rebuild, eliminate repeated designs, and optimize the design structure.

You can add an image here:

8. Testing programs are a by-product of TDD. Do not expect these tests to replace other tests, such as performance testing and stress testing.

9. TDD appears repeatedly in three aspects:

A. There are three methods for testing: pseudo code, triangle method, and explicit implementation (obvious implemention)

B. Eliminate repeated design between code and test as a means to drive design

C. Control the capability of the test gap. When the road is smooth, the friction is increased and the gap is opened faster.

Comment: The third sentence is not very understandable :(

10. When a test is created, it forces the creation of a class to be used later.

11. Introduce polymorphism to eliminate display class definitions.

12. Compiling the test as soon as possible is an overwhelming central task.

13. Do not introduce more designs unless there is a better motivation.

14. This is mentioned by Martin Fowler in the sequence: Pattern copy.

Mode copy is not a good programming method. The mode is generally semi-finished products, and you need to go back to the furnace again when using your project. However, a good way to deal with such problems is: At first, no matter how many models are copied, and then rebuild and test them first. --- It seems very reasonable :)

 

===============2006-9-7 continue learning ===================

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.