Thursday, 23 January 2014

Programming Experience (Object-Oriented Programming)

In September 2013, in my CSC108(Intro to Computer Programming) class, I learned much about Python's built-in functions and many different ways of applying them. We also learned about and were introduced to the wonderful programming paradigm that is object-oriented programming(OOP) but only to a minuscule detail. Later on, in my CSC148(Intro to Computer Science) class, we went more a lot more in-depth and were also introduced to the three virtues of a great programmer, which are laziness, impatience, and hubris.

In my CSC108 class, we learned the basics of OOP which included representation of objects with its appropriate data fields, initialization, and also implementing methods to the class. In my CSC148 class, we were taught, with laziness in mind, how to more efficiently create a class, such as improving your init method by placing in extra parameters, or being able to place selection statements within the return statement. Another thing which I learned that has a significant impact on my programming prowess is the notion of inheritance. This tool adheres perfectly to the virtue of laziness by allowing a programmer to add 'features' or override a class without modifying the original code. In other words, less copy-pasting.

Although everything I have been saying seems quite simple and convenient, in terms of each tool on its own, yes it is very elementary, however, what I found most difficult was applying everything together and making my code 'lazy at the same time. I often found myself repeating methods from a baseclass into a subclass by accident out of habit or even using __str__ method instead of __reper__. All these recurring errors can only be fixed through repetition and more repetition. Who would've thought being lazy would be so hard?