OOPs in Python Part I

Python is an extensive programming language in 2021.In this article we are going to discuss about OOPs Concept .

Every things in python is Object oriented. Lets have look examples below first.

Python Objects

If I click Run Here the above code, You will see that we have all our data types. But we have the Class keyword in front of it. This is because everything in python is built by this Class keyword and we’re able to use different methods on our objects to perform some action on them.So

What is an Object ?

Objects have methods like and attributes that you can access with the DOT (.) operator.

Now why is this useful let’s have a look at an example let’s say we’re working for Amazon and Amazon recently decided that hey you know what. We’re going to have delivery drones that are going to deliver our customers packages a lot faster. But we need to code this drone right and up to this point we’ve learned that we can do that with basic functions conditional logic and just writing our code on a dot pi file but the problem is as code gets bigger and bigger and bigger.

It’s not just a one file.

It’s not just 10 lines of code.

It becomes hundreds and thousands and millions of lines of code divided into different files code gets more and more complicated because we live in a world where technology is everywhere and programming something like a drone is quite complicated especially when it’s a delivery drone.

So how can we use object oriented programming to make this code more manageable.

Well oop is what we call a paradigm that is it’s a way for us to think about our code and structure our code in a way that is easier to maintain extend and write.

So if we’re writing a program about let’s say that does drone delivery what we break it up into small pieces into little objects that represents the real world.

For example I might code an object my own data type which is the propellers that allow the drone to fly and maybe another developer works on the camera and the vision part of the drone. Another developer can perhaps create the clause that hold the package and then another developer might be able to work on the signaling so that we’re able to send signals from our drone to let’s say Amazon headquarters and nowhere. All our drones are what we’re doing here is we’re breaking up functionality and data into different pieces that model the real world into separate objects so that different people can work on different parts and then we can just combine them afterwards.

The main takeaway is that OOPs is a paradigm a way to think about our code a way for us to structure our code so that as it gets bigger and bigger we’re able to be organized because we’re not writing silly 10 line codes. We’re writing millions in lines of codes. Companies like Netflix have thousands of developers that are writing code every single day. They need a way to structure and organize this code so that what it just doesn’t turn into complete chaos.

So, hopefully now you might have some idea about the object but before deep diving into concepts of OOP , we should look a fundamental of programing Language and its its History firstly.

Computer Programming Language and History

A programming language is a language specially designed to express computation performed by a computer .Programming language are used to create programs that control the behaviour of a system to express the algorithms, or as mode of human communication.

And I’m going to link to this excellent article from Wikipedia about the history of programming languages . Refer the link to learn about history of programming languages.

If you gone through the above linked article- You see we started with basic programming languages we have things like assembly language that was really low level really close to machine code. We had things like COBOL and then we slowly as we started writing more and more code in the 60s and 70s we started to establish some of these fundamental paradigms. And one of the big paradigms that came to be especially with these small talk programming language was this idea of object oriented programming or an object oriented language.

Generations of Programming languages

We now know that programming languages are the primary tools for creating software .As now, hundreds of programming languages exist out in there in market. However, in the 1940s when computers developed ,there was only one language –Machine Language.

The concepts of generations of programming languages(also known as levels) is closely connected to the advances in technology. The five languages of programming languages included Machine Language, Assembly Language ,High level languages(3GL),very high level language(4GL) and fifth generation language that includes Artificial Intelligence.

Features of Object Oriented Programming

The OO Programming language must support mechanism to define, create, store, manipulate objects , and allow communication between objects.The underlying concepts of OOP are as follows:

  • Classes
  • Objects
  • Methods
  • Message passing
  • Inheritance
  • Polymorphism
  • Containership
  • Reusability
  • Delegation
  • Data Abstraction and Encapsulation

Review Questions

Q1. What is machine language? Do we still use it ?
Q2.What is Programming Language?
Q3.How Third Generation programming language better than its predecessors?
Q.4 Differentiate between procedural language and Object Oriented Language.
Q.5 What are the concepts of OOPs

Next Article we will see practical implementation of OOPs concept in detail.

Keep Learning | Be Confident

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top