Sunday, 1 March 2015

"Summary of Object Oriented Programming"

Over the past few weeks we have learned more about the language we have been learning to write code in, but approaching it from a different angle.  A lot of the material we had learned up until a few weeks ago had been programs that used a 'procedural program' paradigm, rather than an 'object oriented' paradigm.  The benefits of object oriented programming were immediately apparent, creating objects that have both data and functionality (rather than just having data, and operating on that data with separate functions as in procedural programming) is clearly a more elegant way of writing code.  I realized that code becomes more concise, simplistic, more focused and overall easier to comprehend with this paradigm shift.

The concept of data and methods being stored in classes was something that made sense on an intuitive level upon introduction.  Also, the implementation of the associating code was straight forward as I had expected.  Classes allow for enhanced focus on specific objects being used, and their practical application was quickly realized (as displayed in class with examples about airplanes, types of employees, etc..).  The idea of inheritance was again something that made sense on an intuitive level, and the value it would bring to coding was clear.  With inheritance subclasses can be constructed to operate under the jurisdiction of previously defined parent classes, inheriting the parent's methods.  This allows for added methods to be contributed to the subclasses without altering the parent class.  The corresponding code for inheritance was not as easily understood at first, and practice was needed to reach a complete understanding.  I was able to fully comprehend the idea of inheritance after taking the time to trace a series of programs that were presented in class.  First I went over the inheritance example that is given in the course notes (chapter 1; class A(), and class B(A) found at the end of the chapter) and traced the code in my mind multiple times, and with the python visualizer.  This allowed me to follow where the programming was looking for data first, and where it would check next if the required information was not found.  This gave me a general grasp of the concept of inheritance, but it was the classes Employee, SalariedEmployee and HourlyEmployee which fully solidified my understanding.  These classes introduced me to raising 'NotImplementedError' and gave me more practice tracing inheriting methods.

Object oriented programming has been enjoyable and useful to learn about in the past weeks and after further research, I've recognized that it is an important concept to understand as it has been the preferred programming paradigm since the 1980's.  Im glad to have worked on the concepts until full comprehension as I feel a solid background in OOP is going to be important in further learning.

No comments:

Post a Comment