"Test Drive Development" is thinking

xiaoxiao2021-03-06  127

Steps to test drive development:

1. Write a clear demand. - Clear goals are important.

2, column task list (to-do list)

3. The first thing to do should be the simplest.

4, will be sampled.

5, put the thinking process in the list.

6, 7 ...

Personal sentiment:

Small step is running as much as possible to solve a problem. A skill that only solves a problem is not the ability to solve the problem, but to clarify the problem, decompose the problem, and select the ability to select the current first resolution from the list of questions.

First, clear problems: describe the problem clearly. Establishing the goal is the first step in writing test cases. Second, Decompose Problem: When a problem does not think in the process of solving or thinking twice, it is necessary to start considering the current problem. Third, choose the question of the current first resolution: Decompose the problem, give up the big problem to go to solve the decomposed small problem, or use the Mock Object mode to ignore the small problem, continue to solve the current problem. I prefer the latter.

Sometimes I will pay attention to the strategy of ignore the secondary problem: For example, if you don't understand the basic situation, don't have an urgent consideration (with excuses, of course you can reserve the interface) because you do it, but you will mess with your thoughts. . The general step should be

1. Consider special circumstances

2. Consider special circumstances two

3. Observe the common and different between the 12, and the true implementation of the interface. The common feature is placed in the interface, and the difference remains in the derived class.

Reserved Interface: If you take into account a different implementation or have an extended room for future implementation, then the specific program should be written for an interface. Then, if you can't set up in the start phase, you can reserve the interface (my own concept), the specific method can put the first concrete-implemented PUBLIC method in the interface, and finally design the second When the class is cleaned.

For the face of how to analyze, I have a bit of a preliminary view: As the object's characteristics include data and operations, I will focus on these two aspects 1. Consider what data 2 in demand 2. Consider it more obvious It belongs to an object data to be placed in the object. Create some objects in this process. Give the object name. 3. Consider what operations in the demand. Give him a name, corresponding to the future method name. 4. Consider which data is used to use data 5. According to the data used by the operation belongs to that object to determine which object of this operation - the data used by the data belongs to an object, the method should belong to this object.

转载请注明原文地址:https://www.9cbs.com/read-126156.html

New Post(0)