El miércoles, 17 de junio de 2015, 22:39:31 (UTC+2), Marko Rauhamaa escribió: > Ned Batchelder <n...@nedbatchelder.com>: > > > TDD is about writing tests as a way to design the best system, and > > putting testing at the center of your development workflow. It works > > great with Python even without interfaces. > > I wonder how great it really is. Testing is important, that's for sure, > but to make it a dogmatic starting point of development is not that > convincing. > > The way it was explained to me was that in TDD you actually don't write > code to any requirements or design: you simply do the least to pass the > tests. Thus, say you need to write a program that inputs a string and > outputs the same string surrounded by parentheses (the requirement), the > starting point might be this test case: > > - run the program > - give it the word "hello" as input > - check that the program prints out "(hello)" > > The right TDD thing would be to satisfy the test with this program: > > input() > print("(hello)") > > That *ought* to be the first version of the program until further test > cases are added that invalidate it. > > > Another interesting ism I have read about is the idea that the starting > point of any software project should be the user manual. The developers > should then go and build the product that fits the manual. > > > Marko
The refactor phase is key in TDD (red-green-refactor). Again, GOOS is an advisable source of knowledge in this matter. -- https://mail.python.org/mailman/listinfo/python-list