What is a Programming Language? If someone asks this question can you answer it? So, this article is going to be very amazing for you because we will talk all about programming.
As you know programming is for computers. So, we can say that programming is simply a way for us to give instruction to computers devices. If you want to talk to computers then you need programming and without programming computer programs are nothing. This means without programming you can run windows on a computer or you are not able to do anything on computer without coding. You won’t be able to move the mouse around on your screen, you wouldn’t be able to Google things and you also can’t read this article without coding.
In this article you will learn:
- What is a Programming Language?
- What is Object Oriented Programming Language?
- What is an Object in Programming?
What is Object Oriented Programming Language?
Let say, we are going to make a delivery drone that has the functionality to deliver the package to our customers. So, the first thing you have to do is to code this drone that it do what we want. We can do this by some basic functions, conditional logic and just writing our code on a file but the problem is that while writing code, the code gets bigger and bigger and it will not be one file or not a 10 lines of code.
It becomes hundreds and thousands and millions of lines of codes divided into different files. Code gets more and more complicated because we live in world where technology is everywhere and programming something like a drone is complicated. Especially, when its delivery drone. OOP (Object Oriented Programming) is a paradigm. So, we can say 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, how we can use object oriented programming to make this code of drone more manageable. When we are writing a program about let say that does drone delivery what we break it up into small pieces into little objects that represent the real world.
For Example I might code the object, my own data type which is the propellers that allow the drone to fly. Maybe the other developer works on the camera and the vision part of the drone. Another developer can perhaps create the clause that holds that package. The last developer works on the signaling part that send the delivery signals to the headquarters.
What we are doing here? We are breaking up the 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.
But when we want to create a delivery system this time not a drone. It’s a tank like a delivery robot. We can use the same pieces such as camera and claw and maybe the signaling. By just removing the propellers and use the tracks like taxis and somebody can code the track part. Now we are able to use different pieces extend the functionality from our drone into different objects.
What is an Object in Programming?
As you know in OOP (Object Oriented Programming) there is idea of objects and classes. Now a class is the blueprint of what we want to create. What are the basic attributes that is properties that our class has. What are some basic methods and actions that our class can take? So, using the blueprint or class we are able to create different objects over and over using class as the building block.
So, the building in the figure that we represent as a class can be instantiated. That is the action of creating different instances. Instances at the right side in the figure these all are objects. The naming in the figure that you are going to use to and all object oriented programming languages has this principal. So, you will have to understand that somebody says, Hey I just instantiated the class. It means hey I just create a new instance, a new object. So, looking at the figure above. Let’s understand this by some python code. This is Object Oriented Programming Language.
Class OneObject: $Class #code Pass obj1 = OneObject() #Instantiating
Now here we create a class or blueprint and obj1 = OneObject() in this line the double bracket is us instantiating the class and saying hey class whatever we have in the pass and instantiated and create a new class. So, here obj1 = OneObject() we are creating a new object by instantiating the class “Class OneObject:” Here we can also create multiple objects like this:
Class OneObject: $Class Pass obj1 = OneObject() #Instantiating obj2 = OneObject() #Instantiating obj3 = OneObject() #Instantiating
Now I have three different objects that I can use based in the class “Class OneObject:” You see in the code the class has no statement with pass you can add the code here but think about the efficiency. The class is going to be stored in the memory. So, every time you want to create new object, you don’t have to write the code. Just you can simply say go in the memory where the OneObject() is and just run the code in the pass argument. So, we can in programming everything is object that extend the functionality of class by instantiating it.