Wednesday, February 11, 2015

Week6:Object-Oriented Programming

  Last term in CSC108, I believed objected-oriented programming to be the most useless, tedious and annoying part of the course. I did not understand the purpose of classes, as they seemed to be a much more complex and inconvenient way of creating functions. While I acknowledge that I do not have a thorough understanding of object-oriented programming, I believe I have made strides in understanding its purpose. An instance of a class has specific data and attributes that are unique to that class. These features assist greatly in keeping everything organized. For example, I would imagine that Facebook performs well because of its usage of classes. A profile, for example, could possibly be a class that Facebook uses to create profiles for people that sign up for it. It would have attributes such as number of friends, age and date of birth and methods such as adding another user as a friend. I could not imagine how this would be accomplished without the usage of classes since the code would be much more complex and disorganized. This example is just to show that I have a new perspective on classes and their usefulness. I find it interesting that classes can inherit properties of other classes, although I do not understand the purpose of this since we could just have one class with all the properties of similar classes. With all the great benefits of classes, I still do believe that they are somewhat complex to develop at times. For example, I find that having to create __str__ and __eq__ methods very inconvenient and somewhat time consuming. I am also moderately uncomfortable with implementing such methods because I do not understand how they work. For example, I don't quite understand why using the == operator on two instances of a class will check if their memory addresses are equal rather than their values. This is one of the several aspects of classes that I have trouble comprehending.

      I believe I can solve my troubles with object-oriented programming by consistent practice with developing them, and by analyzing its properties thoroughly from top to bottom so that I will understand why they work the way they do. I believe that this solution is working so far because I have a thorough understanding of how some of the features in object-oriented programming works. For example, I know that the __init__ method is used to give an instance of a class its specific attributes and data, depending on the class of course. This was an example of a concept that I was struggling with before but now I am very comfortable with. I suspect that the reasons for my problems with object oriented programming are because I started working with them before really understanding why and how they work. With this post, I hope to have conveyed my thoughts on object-oriented programming rather than reiterating its several features. 

No comments:

Post a Comment