Some simple examples for exercising TDD
Zhang San has a ledger to record his daily cost and income. Could you please help him with calculating the cost of the last nature week based on the transactions in the ledger?
- Finishing the calculation logic at frist, then write some test case to test your logic.
- Writting the test cases at first, then write the calculation logic to pass the tests.
- Comparing the above approaches, will you have different feeling?
ps: If possible, please do above 2 different practices at different days to make sure your mind won't be influence by privous practice.