Object Oriented Programming#

Object Oriented Programming (OOP) is a programming paradigm that relies on the concept of classes and objects. In Object Oriented programming (OOP) related pieces of information and behaviors are grouped together into a template called a class. Then individual objects are created from the class template. The entire software program runs by having multiple objects interact with objects to create the larger program.

Why OOP?#

OOP makes code organized, reusable, and easy to maintain. It follows the DRY (Don’t Repeat Yourself) principle used by many programmers to make efficient programs. OOP also prevents unwanted access to data, or exposing proprietary code through encapsulation and abstraction.

Building blocks of OOP#

classes#

Classes contain fields for attributes, and methods for behaviors. Classes are where the programmer creates a blueprint for the structure of methods and attributes.

objects#

Objects are instances of classes created with specific data.

attributes#

Attributes are the information that is stored. Attributes are defined in the Class template. The state of an object is defined by the data in the object’s attributes fields.

methods#

Methods represent behaviors. Methods perform actions; methods might return information about an object, or update an object’s data. The method’s code is defined in the class definition.

Bonus Material#

  • Oops! OOP’s not what I thought

    • By Anjana Vakil

    Oops! OOP's not what I thought

  • Object Oriented Programming from scratch

    • By Raymond Hettinger

    Object Oriented Programming from scratch