This week we continued on the topic of object oriented
programming. In both lectures and our tutorial, we
learned about the class tree. During the lectures, we were given worksheets and
followed Professor Heap constructing functions for class tree. For me this
tutorial was the most challenging so far, and I faced multiple slumps while
solving the tutorial problems.
In the tutorial, I was first stuck
trying to come up with the algorithm for the first function, list_all. I could
do the first two step of the three step procedure and found them straight-forward.
However for a while I couldn’t solve the third step, which is to combine my
results from the first two steps using recursion. I was stuck on where to
implement the gather_list function in the algorithm. First I tried to trace the
recursion steps and come up with the algorithm, but this proved to be
ineffective. I eventually solved it through constant experimentation. Even
though this is a legitimate way to solve problems, I am unsure about the fact
that I cannot explain why I would write my code like this. I think I might’ve
just gotten lucky. The other questions in the tutorials are much easier after
finishing the first one since the gather_list function is implemented the same
way. However I got stuck once again on the last function list_to_depth, in
which I did not solve in the end because the tutorial session was over.
In conclusion, I am not confident in
my ability to come up with algorithms using recursion. The quiz this week was
also the first quiz I wasn’t 100% sure about. I certainly need to practice more
during the break, starting the second assignment as well as finishing up the
tutorial question.