Computer Science

Computer Science

Thursday, January 23, 2014

Object Oriented Programming

Object Oriented Programming:

Before taking computer science courses here at UofT, I did not know much about object oriented programming. I had heard some things about it previously, though. I had heard about concepts like classes and objects before, but I had no idea what they were used for.

After only 3 weeks of this course, I feel like I know much more about OOP, and I also have an odd sort of appreciation for OOP. The concept of organizing all your data into "objects", and having your objects represent concepts in the real world is so simple and intuitive. I feel like OOP is a great way to look at programming, because it makes sense to organize things in a hierarchy. I am actually quite interested in object oriented programming because I think it can be quite powerful and useful when implemented correctly.

I feel fairly confident in my ability to write simple classes, and I understand the concepts of subclasses and inheritance quite well. I try to think of subclasses as "children" or "branches" of a parent class. For example if I have a class called "Person", we can write subclasses of this Person class. The parent class will initialize basic attributes and behaviours that all "Person" objects have in common, but we can define special behaviours for specific types of people in our subclasses. The subclasses can inherit methods and properties defined in the parent function.

I don't know exactly what the property() function does. In lecture it was explained but not thoroughly. I think it has something to do with private and public attributes, so the end-user cannot just alter the attributes of objects without your permission. Hopefully we will cover this topic a bit more later on in the course.

The labs and exercises have not been difficult so far (which is good). Lectures are kind of confusing because we basically just look at someone else's code for an hour and try to figure out what the heck he wrote. I feel like I learn a lot better in CS by actually doing exercises and problems by myself, so I hope there are more opportunities to practice the material.