Sunday, March 1, 2015

Object-Oriented Programing Again!?

Apparently, here is another SLOG about OOP. What is Object-Oriented Programming(OOP)? OOP is an programming model that focuses more on objects other than functions, and more around managing data then performing operations. I have touched a bit of OOP back in CSC108 as I mentioned before and through CSC148 I thinker the course enhanced my skills at OOP. 

So, what is related to OOP? To my understanding, OOP basically is writing classes that revolves around different objects and data. Usually, a class has attributes, which is something that every object of that same class must have, i.e., if I were writing a class on students, some attributes that the class student must have is, for example, a student number. Also, the class student may be inherited to a more specific class that do things (methods) only that specific class does. Another example, if I were to create another class called undergrad and this undergrad class that I am about to create has most of the same attribute as the class student. Now I can inherit everything from the class student to the class undergrad, and make undergrad a subclass of student. So now, everything instance, method, attribute that class student has, not class undergrad has those things too. I need not to repeat all of those again and begin writing from scratch. 

There are also methods that class has, which I think are functions that only the object of that class has. From our example class undergrad, it might has method to tell how many credits that the undergrad student has, also it might have a method that get the major that a object of the class undergrad is currently in. What I think how methods and functions are different is that methods need a class as a part of its parameter where as functions don’t usually require a class as a part of its parameter.


By writing classes, I believe that we are able to solve problems that relates more to our lives, i.e., from our example of keeping records of students.

No comments:

Post a Comment