Vanilla Pop: Did you see it?Write a short test before writing the product code, everything will be perfect.
Joe: I do n’t know. I think that I ’m not quite comfortable with this backward wong method.
Vanilla: But this operation is very easy for you, right?
Joe: That is natural!I have learned this method from here!
Vanilla: (sound doesn't sound very certain) Well, let's continue to pair programming.
Joe: Do you know, I feel you are very worried.Moreover, I need to work alone, otherwise I will feel hurt in my self-esteem.
Vanilla: Okay, you said that, that's all.
(A little bit of time passed, and the sound of the music was accompanied by a typing keyboard knock. At the end of the day, the switch made a noise when the lights were turned off, and the door slammed shut.)
the next day
Vanilla: Let's take a look at these tests.
Joe: Come on!You will like these tests, I also made some adjustments.
Vanilla: Uh?When I clicked the test button, there was a pause, and ...
Joe: (Proudly speaking) A dialog box pops up!
Vanilla: Uh ...
Joe: Yes, this dialog will ask the user what kind of crazy parameters they want to pass to the test.In this way, I can replace your 4 tests with one test.
Vanilla: Ah ... Now when I test, I need to interact to--
Joe: Very powerful, isn't it?If you need to debug, you are all ready!
Vanilla: But Joe, I do n’t want to interact with the microtest.Sometimes, there will be thousands of micro-tests, and the time to interact with them is inoperable.With just one click, all micro-tests should start running.
Joe: (heartbroken) Oh!Understand, let me deal with it.
(After a period of time)
Vanilla: Why are there fewer tests in today ’s test run report than yesterday?
Joe: Some tests don't know what to do, and they keep failing, so I disabled some tests?
Vanilla: Wait a minute!You mean, I am increasing the test every day, and in the first few days after you started wong, you directly reduced the number of tests?
Joe: So, yes.Your test won't work after I adjusted the code.
Vanilla: Really?You should maintain the tests that have been submitted, otherwise we will have to stand still.
Joe: But you designed the test too inflexibly.You have to agree to use the dialog box to allow the user to manually enter the test parameters, just like I implemented before-
Vanilla: But Joe, each micro-test is designed for a single scenario, just a scenario.This test is simple and easy to understand, and easy to maintain.
Joe: So if the test fails, what do you want me to do?Open the dialog, yes the dialog is very useful!
Vanilla: You need to maintain the test, Joe.
Joe: But how do I know which part is wrong?Is it testing or my code?
Vanilla: The results of the test will remind you of the situation.At this time, you need to investigate and analyze, and make a judgment: whether there is a problem with your code, or whether the test needs to be updated.
Commentary: Vanilla Pop is letting the team members start learning TDD.The first mistake is that he did n’t let Joe pair with him.Developers trained in the education system are used to completing tasks independently.Moreover, many developers are used to spending a few hours, facing the struggle of the computer, not willing to argue and discuss with other colleagues.This is our nature.This feature is actually beneficial for learning programming.We sat in front of the computer, tossing the code alone, and kept repeating it until it became good enough to finally deliver the project successfully.
But there are better ways.We are no longer students, and the advantage of wong in the company is that there are many skilled developers here.The more developers work together, the quicker one's skills will be passed on to another developer with this social approach.If a new process like TDD can be implemented, it will be significantly faster.Pair programming is a good way to learn technical practice, a secret weapon.Otherwise, Vanilla Pop and junior programmer Joe rely on continuous feedback to learn, which will be much slower.
In the next episode, Code Dog is involved in a code coverage scandal.
用户评论