Thursday, 30 January 2014

Week 4 of CSC148: Exercise 2, Recursion and Turtles

A lot of concepts were covered this week. Exercise 2 was basically testing us on if we understand inheritance and how Python errors operate. These ideas were linked through object creations, since custom errors are defined in classes, classes being where the ideas of inheritance apply. After doing some reading I found the assignment quite simple and straight-forward. My biggest issue right now is perfecting my style. I'm still finding myself checking style guides frequently to make sure I've got the right amount of spaces somewhere or making sure I've written the type contract out properly. Descriptions are a bit of an annoyance right now, as well.

As far as recursion goes, on a conceptual level it doesn't seem too hard to wrap my head around. On the surface it's quite simple--a function that calls itself within its own function definition. The examples used so far on lists have been quite well explained by Danny, where we've been shown how to sum all the numbers in a list that contains sub-lists. I'm looking forward to starting the first assignment shortly so I can play around with recursion first-hand. Same goes for list comprehensions (or any comprehensions, really), I'd like to get in the habit of using those more often. The fractals Danny was creating with recursive functions and the Turtle module were quite interesting. I am a visual learner and those examples really helped make recursion "click" for me.

The labs this week were straight-forward but a little frustrating. Everything went smoothly except for the testing parts of lab. This is probably my biggest weakness right now, using unittest efficiently.

No comments:

Post a Comment