Sunday, February 2, 2014

Inheritance and Testing

Lab this week was spent learning more about class inheritance and unit testing. These were both parts of programming that I did not have a lot of experience with before this week. Creating classes have been getting much easier with the practice I have been doing between class exercises, labs and home programming. Practicing has helped speed up the lab, and focus on inheritance and unit testing. It was interesting using parent classes to handle repeat code as a more advanced version of building new functions to minimize repeat code. Inheritance helped me reduce the code written for the motorized and human-powered classes and further subclasses during lab.

Once the code was cleaner using inheritance, my partner and I moved on to unit testing. We both had experience with the assertEqual function but little else with unit testing. My favourite new function to learn was the assertRaises function because this allowed me to apply my newly gained knowledge of exceptions from last week. Personally, I love when topics connect so well in my courses, so being able to combine exceptions and testing together was very exciting. 

Now I will be heading into the first assignment applying these new skills towards creating cleaner, more powerful code. I look forward to sharing my struggles and breakthroughs in my future posts. 

No comments:

Post a Comment