Sunday, 15 February 2015

Summary of Object-Oriented Programming


Hello to all my readers,

First of all I just want to say that I survived my hectic week, all the tests, assignments, quizzes and labs. Phew. It feels so much better to have those out of the way only to have more things coming up though. *sarcasm*. 

Anyways, let’s gets back to CSC148 and this week I would like to discuss the topic of Object Orientated Programming (OOP). OOP is based on the concepts of objects, which provides an efficient model for programming. Classes of great interest in OOP, which allow the programmer to design various types of things from cash registry as shown as an example in class to creating game similar to what we did in assignment 1. Classes can create instances of itself using the constructor __init__ which can be created by the programmer; however, python also has a built-in __init__ method. Other built-in functions include __str__ , __repr__ and __eq__. The methods written in the specified class belong to that class, which allow the user to do various sorts of cool things including changing the instances of that class which had been created. 

Furthermore, a subclass also known as child class inherits all the methods of parent class. The concept of inheritance is critical to OOP and it is of the key reasons as to why OOP is very helpful. Without this concept, programmers would have to waste their time writing the same methods again in another class whereas inheritance as the name suggest allows the programmer to use the methods defined in the parent class in that of a child class. No need to the same work twice. New objects therefore can inherit the attributes of the existing or parent object, a major plus point.

That was all for this week. I shall come with another cool post about CSC148. Till then to my readers. Adios Amigos!!!

No comments:

Post a Comment