Thursday, 19 February 2015

Object-Oriented Programming

    Object-oriented programming is a programming paradigm based on the concept of "objects", which are data structure that contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods. It attempts to provide a model for programming based on objects and a distinguishing feature of objects is that an object's procedures can access and often modify the data fields of the object with which they are associated.
    As what we learned in lectures in these few weeks, the class Stack is a good example. In this class, one of the most attractive features is that it is a last-in, first-out stack of items (LIFO). We can regard it as a real book stack from which we can take and put a book on the top of the stack. Obviously the books are just like the objects. In fact, there are methods in it called 'pop', which aims to pop and return the top item in the Stack; 'push', which aims to place the object on the top of the Stack; and 'is_empty', which checks whether the Stack is empty. These three methods enable us to access and modify the data fields of objects.
I'm more than excited to learn more about the object-oriented programming language Python.

No comments:

Post a Comment