Introduction to Object Oriented Programming in Python| Part-1

Introduction to OOP

Good Software

Before jumping into Object Oriented Programming, let’s understand the word Software.

Software is an easily changeable tool/product that performs a specific task.

The ease of changing or making changes to the software is referred as its softness.

  • A good software should keep the users happy, by delivering what they need.
  • A good software should also keep the developers happy. Ease of making changes (softness) keeps developers happy. So is should be:
    • Easy to understand and make changes.
    • Easy to fix bugs and add new features within the scope.

Object-Oriented Programming System (OOPS) is a way of approaching, designing, developing software that is easy to change.

OOPs

Object-Oriented Programming is a way of approaching, designing and developing software, so that the components of the software and the interactions between them resembles real-life objects and their interactions.

Proper usage of OOPS concepts helps us build well-organized systems that are easy to use and extend.

Describing Real-Life Objects

In Object Oriented Programming, we model software after real-life objects. To be good at modeling software after real-life objects, we should be able to properly describe them.

Let us try describing these real-life objects

The following description is a bad way of describing, as the information of an object scattered and unorganized.

Object 1 is a car and it has four tyres.
Object 2 is a dog and it has four legs.
Object 1 has four doors.
Object 1 can make sound.
Object 2, barks.
Object 1 is in blue color.
Object 2 is in brown

Organized Description

  • In the below description we are grouping the information related to an object.

Object 1 is a car and it has four tyres.
Object 1 has four doors.
Object 1 can make sound.
Object 1 is in blue color.

Object 2 is a dog and it has four legs.
Object 2, barks.
Object 2 is in brown

  • In the below approach, we further organize the information into
    • What the object is?
    • What the object has?
    • What the object can do?

Object 1 is a car
Object 1 has
Four tyres
Four seats
Four doors
and so on …

Object 1 can
Sound horn
Move

The above description shows a simple framework where we describe object by specifying the properties that the object has and actions that the object can do.

Organized Description should be

  • A clear separation of objects.
  • A clear grouping of what object has and what it does.

Related Posts

Python Program to Convert Integer into a Single Numeral

Single Digit Number Ram is given a positive integer N .He wishes to convert this integer into a single numeral. He does so by repeatedly adding the…

Python Program to Print Armstrong numbers between two intervals

Write a program to print all the Armstrong numbers in the given range A to B (including A and B). An N – digit number is an…

Python Program to Check if Given Input is a Letter, Digit or Special Character

Letter, Digit or Special Character You are given a character as input. Check if the given input is a Lowercase Letter or Uppercase Letter or Digit or…

Interleave Strings | Python Program to merge two strings by adding characters in alternating order

Interleave Strings Given two strings, write a program to merge the given two strings by adding characters in alternating order, starting with the first string. If a…

Python Program to Check if given colors are present in the color palate

Shekhar is an artist. He likes to draw and paint. He is now drawing a portrait of a city road which is in the black color and…

Python Program to Check the eligibility criteria for donor  

Python Comparison Operators An XYZ hospital has organised a blood donation camp. The eligibility criteria for donor was as follows  1) Age>=18  2) Weight >=50 kg  3)…

Leave a Reply

Your email address will not be published.