Wednesday 24 October 2018

Understand the Object Oriented Programming paradigm

The beauty and simplicity of Python is in the way its built for use. Its uses the Object Oriented Programming language structure which makes it easier to use even for a absolute newbie. In OOP languages, you construct objects which are bundles of codes to solve the big picture problem.
An object is code that contains data or variables with the relevant methods or functions that perform actions on that data giving a particular output. A Class is the layout or definition of that object. think of the final headline problem that needs to be solved. This is the final object that is to be created say a car. To construct this car you need several small pieces or parts. Every part is also an object. The basic plans drawn up outlining these parts is the class. Once all the smaller parts or objects are created they can be put together to make the final object the car. This in a nutshell is object oriented programming.

Many objects can be created from a class. Instance refers to an individual object of a certain class eg: object obj that belongs to a class Circle, for example is an instance of the class Circle. The process of creation of an instance of a class is called instantiation. Anther similar feature is a class variable. They are defined within a class and are shared by all instances of a class. both instance variable and class variable are part of the data members which holds all the data associated with the class. Method is a special type of function defined within the class.

Python syntax can be executed by writing directly in the Command Line:

>>> print("Hello, Python!")
Hello, Python!  


Or by creating a python file on the server, using the .py file extension, and running it in the Command Line:

C:\Users\Your Name>python myfirstfile.py

No comments:

Post a Comment