Tuesday, January 21, 2014

Object-Oriented Programming (OOP)

Hello everyone!

As you may have seen from the title, the topic of this entry will be about the object-oriented programming. OOP is one of the many programming paradigms, and Python is one of the many programming languages that supports this kind of a paradigm.

Object-oriented programming is roughly about the objects(!), how these objects behave and lastly the state of these objects. The behavior of the objects is called the "method", and the state is called the "attribute".

 In this paradigm, every object belongs to a class. Class could be thought of as a factory devoted to the production of a single product. Every class has a constructor to create these so called objects.

Python behaves kind of counter-intuitive, perhaps more intuitive to some, when it comes to the construction of the objects. When the "recipe" for a class is changed, Python dynamically changes the "recipe" of the objects constructed before this change was applied.

The OOP aims to:
- avoid code copy-pasting and thus making things more efficient and code more clear
- encapsulate the select part of the program for a better user experience
- allows for a better control over large projects

No comments:

Post a Comment