The lectures from this week focused mostly on showing examples of use of recursions and understanding them. Tracing a recursive function seems like a detective work, trying to narrow down and find the starting point, the base case. Recursion, although a simple concept, is still mind-boggling to me. I am afraid that given a problem, I may not notice the existence of a solution involving recursion.
This week's exercises were pretty simple and I am pretty confident on creating exception classes by inheritance and raising them when necessary. I can feel that in the future, raising exceptions will become very important if I want to make a program that does not mislead the user by spitting out a flawed output, when given an undesired input. I feel it is the programmer's fault when the computer program does not check whether its input is good or bad.
The lab went fine except for writing unit tests. To be honest, despite learning about them from before, I have never written a unit test until that day. I had a difficult time coming up with good test cases and also had to do a fair bit of reading and googling in order to properly code. My partner and I had a little disagreement about what fuel economy represented, but it turned out the description was in the handout. I guess the lesson here is that I should read the handouts carefully, not skipping over words and fooling myself that I understand what I am suppose to do.
We were able to finish every thing except for writing the unit tests. I better start practicing creating unit tests. Our classes from the lab seems to do what were asked to do and the visual representation of the codes are clean. But I wonder if our approach was the best. I am guessing there are multiple ways of writing programs that ultimately does the same thing. Although I am not a fan of following conventions and thinking that a certain way of doing things is the best, since I am dealing with computer science, unfortunately, these things matter. Because of this, I think sharing codes amongst classmates, after everyone is done with their labs/exercises/assignment, of course, is a great way to learn from each other, seeing how one could have come up with simpler and more efficient piece of program. I hope this kind of learning is implemented in the near future.