In the last SLOG, I expressed the difficulties I encountered with
exceptions. However, after some practice, this week, I am finding myself
quite comfortable with the idea. Exercise 2, which dealt primarily with
exceptions, aided in clearing the concept for me. This whole week, I
was dreading the exercise, given my limited understanding of the topic,
but now, after being done, I am quite pleased with it. Previously, an
error in a program would cause the program to crash. However, with
exceptions, we can now effectively deal with the errors. We can enable
the program to keep running via the try-except method. Something I found
really interesting is the ability to create my own exceptions. I have
always wondered about invalid input in programs. In CSC108, we were
taught to include preconditions in docstring to deter programmers from
inputting invalid data. However, that was a mere guideline and did not
accomplish much. By raising our own exception classes, we can control
the input, as well we provide the user with information on what went
wrong.
Another topic in 148 right now is inheritance, which is quickly becoming one of my favorite aspects of programming. Calling on functions in other classes is extremely useful and avoids redundant duplication of code. The lab this week was a lot of fun, as it heavily utilized inheritance. I found myself breezing through most of the lab. However, the part with unittest was a little challenging for me as I spent a large portion of time on it. In lecture, I thought that I understood unittest, however the lab demonstrated that I didn't. Choosing test cases and using assert methods were confusing to me but after struggling through that portion of the lab, I am feeling much more confident in my unittest skills.
This week, we also started recursion. I remember my TA from CSC108 being very excited about recursion and I have been looking forward to it ever since. I must confess that I do not fully grasp it at this point, but I am hoping that with more practice, I will master it.
Another topic in 148 right now is inheritance, which is quickly becoming one of my favorite aspects of programming. Calling on functions in other classes is extremely useful and avoids redundant duplication of code. The lab this week was a lot of fun, as it heavily utilized inheritance. I found myself breezing through most of the lab. However, the part with unittest was a little challenging for me as I spent a large portion of time on it. In lecture, I thought that I understood unittest, however the lab demonstrated that I didn't. Choosing test cases and using assert methods were confusing to me but after struggling through that portion of the lab, I am feeling much more confident in my unittest skills.
This week, we also started recursion. I remember my TA from CSC108 being very excited about recursion and I have been looking forward to it ever since. I must confess that I do not fully grasp it at this point, but I am hoping that with more practice, I will master it.