OOP in Python

While exploring the wonders of Object-Oriented Programming (OOP) in Python, I was in search of a straightforward and easy-to-catch definition of this fascinating programming approach. In contrast to procedural programming that maintains a strict separation between data (variables) and procedures (functions), OOP allows the definition of new types  (referred to as classes in Python) that encapsulate both methods and properties into a single “Object”. Since Objects provide an interface with ” the rest of the world”, they are modular, reusable and customizable chunks of code. Here below is the best definiton I have found so far to describe OOP:

“OOP is a programming approach where OBJECTS (entities, items or things) are defined with METHODS (functions, actions or events) and PROPERTIES (values, attributes or characteristics), resulting in more readable, more reusable code.” Lets say you’re writing a program where you need to keep track of multiple cars. Each car has different characteristics like mileage, color, and top speed, but lucky for us they all can perform some common actions like braking, accelerating, and turning. Instead of writing code separately for each car we could create a class called ‘Car’ that will be the blueprint for each particular car”.

from Python Programming/Object-oriented programming

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Picture this maths

maths is more than simply sums


Explore, Discover & Share

Roser Amills, escritora mallorquina en Barcelona

Escritora mallorquina en Barcelona

mayeutika, llegar a ser lo que somos

Antonia Arévalo, Life&Executive coach

Microsoft Research

Explore, Discover & Share

Windows On Theory

A Research Blog

Computational Photography Classes at Georgia Tech

CS 4475/6475 (Currently offered in Spring 2017 term)


Explore, Discover & Share

Big Think

Explore, Discover & Share

%d bloggers like this: