Now that reading week is coming up and we are half way through the course, it is a good time to reflect upon the concept of Object-Oriented Programming (OOP). In CSC108 last term, we only skimmed OOP by introducing classes and some basic methods. At first, I did not fully understand the true purpose of creating these classes and methods, however, after completing assignment one and the mid-term, I have gained a much better understanding. I especially came to realize how OOP takes programming as a problem-solving process where careful application and the break down of problems is required. Like I mentioned in my previous post, being able to break down a problem into manageable pieces and solving it by properly implementing classes and methods may be the hardest process yet. This is something that I still need to master as I had no idea how to even start assignment one at first.
Furthermore, there are three crucial components of OOP that must be understood - classes, objects, and inheritances. An object is an instance of class. For example, "hi" is an instance of the class str. A class is a representation of a type of object. In other words, we can say that it is the blueprint or template that describes the object. Inheritance is a very powerful concept where classes inherit a state and behaviour from their superclasses. One way I like to think of OOP is with the following model. First, let's take our hand as an example. The hand is a class and our body has two objects, the left hand and right hand. In this case, grab, push, and touch are applicable methods to the class. We can also implement a class called foot, which can inherit some (touch, push) but not all (grab) methods and behaviours from the superclass hand.
The term is half done and I think I have gained a much better understanding of OOP. I look forward to return from reading week to see what the course has in store.
No comments:
Post a Comment