Sunday, 9 February 2014

week of February 5, 2014 csc148h1 winter 2014

This week, we were introduced to some applications of recursion and unit test.
By comparing lecture slides to our assignment 1, towers of anne hoy, it seems like our objective is to create an automated application that solves a problem by implementing recursion.
If all the instructions can be defined as a general formula instead of lines and lines of code on how to move cheeses around, the following can be an example of how such an application can be implemented:
1. move all but the bottom cheese to the source to intermediate stool.
2. move the bottom cheese from source to intermediate stool.
3. move all but the bottom cheese from the intermediate stool to the destination stool.
If all these commands are implemented into code as a base case, then calling the function again and again until it is done will create an automated "problem solver" to tower of anne hoy.
Unittest, on the other hand, is another form of automation. It provides a series of test cases to run to test the specific functions built within the test file, and executes them one by one and reports back the errors found. I tend of think of unittest as a general solution that can be used to test many different instances of the same code - input case, return result.
In brief, recursion and unittest are both powerful tools of automation that breaks down a long and complex task down to easy steps and implement until the job is done.

1 comment:

  1. I find it interesting that you found an overlapping element between recursion and unittest and that you define this element as the automation process that breaks down complex tasks into short simple tasks... I never thought of unittest like this...

    ReplyDelete