Thursday, January 23, 2014

First SLOG week 3

I am currently a first-year computer-science student in the University of Toronto. First of all, I just want to say thank you to all the people who helped in last year in the CSC108. Without any previous programming experience, python has been a challenge for me compare to other classes I am taking in this year. However, with all the help I got from my professor and TAs, also my classmates and friends, I managed to get through the CSC108 course easily. 

Well, the first topic is Object-Oriented Programming, OOP for short. Python was designed as an Object-Oriented Programming language. It is a model that anything in it can be represented as a class or an object.

But why are we using such method? Do they really useful? Yes, it does. The traditional way for coding is the procedural approach. As programs are getting more and more complicated nowadays, the difficultly level for the procedural approach becomes dramatically high. In Object-Oriented Programming, instead of putting logic as our priority, object itself is more important to us. “OOP puts objects at the center of the process.” First we define the object we want to manipulate with and then we figure the relationship between them and at last we work out the logic. 

The most important feature that Object-Oriented Programming has is Inheritance. “Inheritance is the process of making a new class based around a parent class.” It allows the new class to inherit the feature of the parent class. Let’s give an example to show you how this might be efficient and useful. If we want to use “car” as our parent class, we could create a BMW class which inherited for the car class. BMW class might have some features, but it is still a car and is more specific than car class. Since the BMW has its own features such as a twin-turbo V-8 engine, rear-wheel drive, X-Drive or the I-Drive system. Such features make it unique. If we want to make a class in the program to represent a BMW. We could use inheritance of the OOP to inherit the methods and variables contained in “car” so that the BMW could have the ability to “move forward”, “accelerate”, or “brake”, and in BMW class we can store the additional orders we want the BMW to do. As we are doing so, we don't have to retype all the line in one giant class. 
The lab we did on this week is really a good example of the Object-Oriented Programming. We created two classed first and then use it in the one last program, it saved a lot of time by putting everything all together in one giant program.

So far, I am comfortable with all the materials we have covered so far. Hopefully the first assignment wouldn’t be such a big challenge.