Hello, everyone, in this session, we will be talking about object oriented programming, so like
other general purpose programming languages, Python is also an object oriented language and it has
been an object object oriented language since its very beginning.
Now it allows us to develop applications using an object oriented approach.
So there are different types of approach.
Overlimit one is object oriented approach and the second approach which we usually have in the programming
languages, is in procedural approach.
OK, so we need to first of all understand what is the difference between object oriented programming
and the procedural programming.
OK, so the object oriented programming is the problem solving approach here.
V you have to do certain computation and these computations are done using different objects.
So when we are using object oriented programming, we are trying to solve a particular problem.
But when we talk about procedural programming, so in case of procedural programming, we are just trying
to follow certain list of procedures or list of instructions step by step.
So let's say I want to find out an area of a circle or area of a triangle or I'm trying to bake a cake
and let's say I'm trying to do certain computation, do something which does not require much complicated
stuff, just steps to be performed.
In that case, I can very well use procedural programming.
But when the problems are a little complex in nature at that point of time, object oriented programming
comes in very useful.
So when we're using object oriented programming, it helps making the development and the maintenance
also very easy to be done by in case of procedural programming, which is very difficult to maintain
the code when the project becomes very lengthy because we don't have any differences that we can go
back to the code and look, we have to read the entire board for that and we might miss out on some
variables there.
But in case of object oriented programming, things are a little more structured in nature.
So it is a little easier to deal with the code, to deal with the larger code when we are talking with
object oriented programming.
Another thing is object oriented programming allows more security.
It allows us to hide the code, which we don't want others to see, I'm sure only the part of the person
has to deal with.
So let's say it's just like a car.
So if I have a car, I want someone to look at the steering wheel.
Only I'm the I don't want someone to go into the mechanics of the good.
I will be building the whole car.
I will be having all the engines and everything.
But the person who is driving the car will only have to worry about how the work with the steering,
the how to work with the brakes and the accelerator, they don't have to worry much about the mechanics
behind it.
So the same thing would be possible to do object oriented programming.
That is, I will be able to hide those things.
I'm not important for the user and only those things that you needed by the user, by in case of the
procedural language, it does not provide any proper V for the binding and the hiding the details.
So it does a little less secure in nature.
So without wasting any time.
Let us go ahead with it now, let us see photo.
So what do we have an object oriented programming.
So in case of object oriented programming, we are designing the program using classes and objects.
So what is a plus?
A plus is nothing but a collection of objects.
So it is a logical entity that has some specific attributes and methods.
So a class will have certain attributes and certain methods.
Now let's say I have a employee class so it will have certain attributes and methods or whatever that
the employee will have salary, the employee will have an email and the employee will have a name.
He will have an age.
He will have some role assigned to him.
So these are different attributes of the employee.
That is some values which are associated with the employee.
Now, the methods associated with the employee could be, let's say, work or a a board.
So these are different methods, typists, certain operations which an employee can perform.
So that is the difference between the attribute and method after that becomes an object.
So what is an object?
Object is an entity that has a stake and a behavior.
So an object will have different state.
So then object can be any of the a life entity, let's say mouse, keyboard, GOP bullpen, person,
animal.
All these could be different objects and their later behavior could be.
So let's say we have an example of a person.
So if I have a person object, so this person object will have different methods or different behavior,
that is the person can while the person can build, the person can eat.
And there would be different attributes associated with that person.
That is the name, age, profession, all these things.
Now the object oriented programming will allow us to group the related things.
So if a person has a different set of tasks like walked out of it so I can group them together now and
a person can have walk, talk, eat.
When I talk about the surgeon, there will be something like perform a surgery.
So this had this is a different kind of task to be performed while Ed will have a different task like
speech so I can group different types of functions for different types of objects to get.
Right, so let's say we have a person right now, this person, one can only eat fruit and this person
can only eat vegetables.
So now what will happen?
The.
It is common with them, both of the people can eat, but one person can eat only fruit and other person
can only eat vegetables.
So here we have different behaviors so we can group different behaviors.
We can segregate those different behaviors in these scenarios.
OK, so this is what allows us to do.
It allows us to create different type of behaviors for different types of object.
And it also allows to group different behaviors based on the properties of object oriented programming,
which we will be learning about later.
Now, why do we need object oriented programming here?
We talked about abortion, we talked about the person object, and this person object has attributes
like name, age, profession, and this person can perform task that does have a method like walk,
talk and eat.
Now, let's see, I want to create different questions, I want to create one person to person, it
will be easier.
I can create one function and the person can perform that.
It is easier to do.
I can do that.
I will need some variables to hold the values.
And I will I can easily afford that.
But let's say I will have to create a thousand person or let's say I have to create that person object
or let's say ten thousand people.
Then in that case I cannot create thousand variables and also keep track of those thousand variables.
Right.
And again, those thousand variables are only in case we have just one variable per person.
But when this person has, let's say, instead of just three and four words, let's say this person
has endless telephone number, I'm different other value.
Let's add five hundred different values and I have ten thousand people.
That makes it more than 50 million values.
Right.
I cannot create 50 million variables because that will actually overburden my entire program and the
program will actually crash.
I cannot have such a thing.
This is where object oriented programming comes into picture.
So object oriented programming will help me create a structured way to actually keep track of my variables
and make things a lot more simpler to implement.
So this is where object oriented programming will come into venture.
Now, the next thing which we will be discussing is the implementation of object oriented programming
and how we will do that.
So let's do that in the next session.
Thank.