Hello and welcome to this session on object
oriented programming Today we will learn what exactly is object oriented programming? We will see how did object oriented programming
emerge and how did non-structured programming led to structured programming and then how
its structured programming led to object oriented programming? We will also understand object oriented programming
with some real life examples So this is going to be very easy and interesting Let us begin
If we have to define object oriented programming, a bookish definition will look something like
this It is a programming technique where the code is based on functions and attributes
of the objects Now this is a little difficult to understand So let us break it down and
let us take a step back and understand how exactly this did object oriented programming
came into existence. To start with, we had non structured programming,
and here the developers would create a very linear code That means there were no modules
in the program They were simple programs which had all the actions coded inside a single
program And there were languages like Basic and COBOL, which were based on this kind of
programming methodology Now this kind of programming made it very difficult to maintain and enhance
the code In fact, the developers who created the code found it very difficult to read their
own code because it has grown so large and so complex And they were new modules The issues
with this kind of programming let two structured programming. And here the court was organized into structures
or modules, and the modules could talk to each other Languages like C, and Pascal were
based on this kind of programming methodology. This was very successful and coding was very
easy and convenient But still, it was felt that, for large enterprise level applications,
we need something more The programming should be able to relate to the real life entities. And due to this, a new kind of programming
methodology was born, which was known as object oriented programming And languages like Java
and C++ are based on this kind of programming methodology Let us go a little more deeper
and let us take an example A Bank account holder withdraws money from an ATM What are
the steps? So the person will go to the ATM, He will
insert his card, he will enter his pass code, enter the amount to be withdrawn, and then
withdraw the cash and take out the card Now, if we have to write code for this in non structured
programming methodology, it will look like something like this. There will be a single program and all the
steps will be coded inside it Here is an example You can see, the entire logic is written inside
a program There are lines which are numbered, and there are some conditional go to statements
which can make the control jump to some part of the programs But still, it is all inside
a single program So this is how this will look like into non-structured programming
it is very difficult to maintain and enhance the code, basic COBOL and FORTRAN and other
languages which use this kind of programming methodology So now let us go and see how will
this example look like in structured programming As we already discussed, structured programming
will have structures or modules for separate actions So for example, this is an example
for withdrawing money So we will have a module called Withdraw Money and all the code for
this particular action will be housed inside this particular module And then Similarly,
we can have other modules like deposit money, open account and so on And these modules can
talk to each other We can understand this in this way There are different modules for
every action, and these modules can talk to each other and work in a coordinated manner
with the help of some functions and arguments and passing values to each other Now you can
imagine it becomes very easy for a developer to create the code, to enhance the code and
to update the code. If there is any change in the module for deposit
money, he will only have to change that particular module and should not worry about open account
or withdraw money or close account modules. Also, if there is a new action or a new scenario
added, we can create a separate module and this separate module can again talk to the
existing modules using the functions and arguments So this is how structured programming made
it very easy Another thing that you should understand is structured programming works
on actions Let's take this example A person opens account with a Bank and deposits money
and uses his credit card to withdraw money from the ATM In this scenario, what are the
actions or what are the works? Open account is an action Deposit money is
an action and Withdraw Money is another action. So normally in structure programming, a developer
will create modules based on these actions They will be a model for open account, a module
for deposit money, and a module for withdraw money So you can see this is how structured
programming will look like with the help of this example So the program programming is
very modular There are separate modules or structures The maintenance and enhancement
and change is very easier now. Languages like C and Pascal use this kind
of programming Now, although structured programming is very useful and makes the life of a developer
very easy and convenient And it was used for a really long time, but it was felt that structured
programming is very good for midsize level applications But when we talk about large
enterprise level applications, the developers were not able to relate the Code In Their
programming to real life scenarios or real life entities And that is where object oriented
programming was born Now, if we have to create a program for this particular example in object
oriented programming, what we have to do now, the answer is, object oriented programming
does not work in this way. We cannot just have actions and create a code
for this In fact, object oriented programming works with classes and objects. Let us go deeper and let us understand What
does this mean? What is a class? You can understand class as a template or
a blueprint for creating anything For example, if you want to create a building or you want
to create a house, you will have a design document or a blueprint of that creation of
that house And using that template or blueprint, you can create the house, and you can create
N number of houses or N number of buildings using a single template So this is the same
in object in programming, class is a design document or a template And using this template,
we can create multiple objects In object oriented programming You will find that it depicts
reallife entities in the form of objects, and these objects are created using classes
Let us understand it more deeply Here is an example, an account holder withdraws money
from his Bank account using credit card Now, in structured programming, we had worked on
actions Here, we will work on entities Or you can say, What are the nouns in this particular
scenario? An account holder is a noun or an entity Bank
account and credit card In object oriented programming, we will create classes for these
entities, so we will have a class for account holder We will have a class for Bank account,
and we will have a class for credit card Now, Imagine an account holder in real life For
example, Tom is an account holder Even Henry is an account holder, and so is Sarah Now,
any account holder will have some attributes What are the different attributes and account
holders can have? He can have a name, age, date of birth, address,
and so on And there are some actions or some functions that an account holder can do So,
for example, Tom can deposit money in his account He can also withdraw money and transfer
funds, and the same goes for Henry and Sarah Now in object oriented programming we will
create a class which will have the same attributes and the same functions or actions So a class
in Object hundred programming will look something like this The account holder class will have
all these fields, name,age, date of birth and address, and all these actions in the
form of functions Deposit money, withdraw money, and so on So you can relate the account
holder class to a real account holder in real life As already discussed Plus is a template
to define objects and using this class or this template, we can create multiple objects
So using this account holder class, we can create multiple objects. We can create an account holder object for
Tom, For Henry and so for Sarah, I hope you can understand it better Now using the account
holder class, we can create multiple account holders Similarly, using the Bank account
class, we can create multiple Bank accounts and then for credit card we can create multiple
credit cards and these classes will have functions which can talk to each other I hope now you
can go back to the bookish definition and The programming is based on functions and
attributes of the objects. I hope now the object oriented concepts are
very clear. I will meet you in the next session Thanks
for watching.