OOP in Python | Object Oriented Programming | Python for Beginners #lec84

Jenny's Lectures CS IT
18 Jul 202322:23

Summary

TLDRThis video introduces the concept of Object-Oriented Programming (OOP) in Python, explaining why it is necessary over the traditional procedure-oriented programming approach. The speaker highlights the limitations of using global variables and functions in large projects and the need for data security, which OOP provides. The video explains the basic concepts of OOP, such as classes and objects, using relatable examples. Additionally, the speaker touches on the difference between attributes and methods, providing an overview of the benefits of using OOP for managing complex projects. Future videos will explore OOP concepts in greater depth.

Takeaways

  • 📚 The video introduces the concept of object-oriented programming (OOP) in Python.
  • 🔍 The purpose of the video is to explain why OOP is necessary after using procedure-oriented programming (POP).
  • ☕ The previous project (coffee machine project) used POP, and now the focus shifts to OOP.
  • ❗ In POP, data security is a concern as global variables are freely accessible by multiple functions, making it hard to manage large-scale projects.
  • 🔐 OOP addresses data security by focusing on objects and encapsulating data, preventing unauthorized access.
  • 🏗️ OOP helps in managing complex relationships in large projects by modeling real-world objects and their interactions.
  • 👨‍🏫 The video uses the example of a YouTube channel, where different roles like instructor, editor, and social media marketer represent objects in OOP.
  • 💡 A class is a blueprint for creating objects, and objects are instances of classes in OOP.
  • 🔄 OOP supports concepts like inheritance, polymorphism, and data hiding, which are absent in POP.
  • 📝 The video promises future discussions on topics like inheritance, polymorphism, abstraction, and more details about OOP with programming examples.

Q & A

  • What is the main focus of this video?

    -The main focus of this video is to explain why we need Object-Oriented Programming (OOP) in Python, especially after using the procedural programming approach in earlier projects.

  • Why is Object-Oriented Programming (OOP) introduced after using procedural programming?

    -OOP is introduced because procedural programming (POP) is not efficient for handling larger, more complex projects. POP lacks features like data security, inheritance, and modularity, making it difficult to manage large codebases with many functions and global variables.

  • What is the key difference between procedural programming and object-oriented programming?

    -The key difference is that procedural programming focuses on procedures or functions, while object-oriented programming focuses on objects that combine data and functionality, providing better data security and modularity.

  • What is one major drawback of procedural programming mentioned in the video?

    -One major drawback is the lack of data security. In procedural programming, global data can be accessed and modified by any function, which can lead to unexpected behavior and errors in larger projects.

  • Why is data security important in programming?

    -Data security is important because, in real-world projects, not all data should be accessible by all functions or users. For example, some personal information should be kept private and only accessible by authorized entities.

  • What are some features of OOP that procedural programming lacks?

    -OOP includes features like inheritance, polymorphism, data hiding, and encapsulation, which procedural programming lacks. These features help manage large projects by making code more modular, reusable, and secure.

  • What is the role of classes and objects in OOP?

    -In OOP, a class is a blueprint or template for creating objects, while objects are instances of that class. Objects have attributes (data) and methods (functions) associated with them, encapsulating both data and functionality.

  • Why is everything considered an object in Python?

    -Everything in Python is considered an object because Python uses classes to define data types. Variables, strings, functions, and even integers are instances of predefined classes in Python.

  • What is meant by the term 'attributes' in OOP?

    -In OOP, 'attributes' refer to the data or properties associated with an object. These are the variables defined within a class that hold information about the object.

  • How does OOP help in managing complex real-world projects?

    -OOP helps manage complex projects by encapsulating data and functionality within objects, providing better modularity, data security, and scalability. It also allows for easier maintenance and debugging by organizing code around objects and their interactions.

  • What is a simple analogy used in the video to explain OOP concepts?

    -The video uses the analogy of running a YouTube channel. Initially, a single person manages everything, but as the channel grows, specialists (instructors, editors, marketers) are hired for specific tasks. Similarly, in OOP, different objects (instructors, editors) handle different tasks, making the project more manageable.

Outlines

00:00

🚀 Introduction to Object-Oriented Programming (OOP)

In this paragraph, the presenter introduces the concept of object-oriented programming (OOP) in Python, emphasizing its importance in programming. They reference a previous video that discussed a coffee machine project and explain that future videos will cover OOP concepts such as classes, objects, inheritance, and polymorphism. The purpose of this video is to explain why OOP is necessary and how it differs from previous approaches.

05:01

🔍 Limitations of Procedure-Oriented Programming (POP)

The presenter explains the drawbacks of procedure-oriented programming (POP), where functions and global variables are interconnected. While this approach works for small projects, it becomes unmanageable with larger projects due to the complexity of managing global variables and tracking their usage across functions. The primary issue with POP is the lack of data security, as global data can be accessed and modified by any function, leading to potential errors.

10:03

📊 Data Security and Real-World Project Challenges

This paragraph highlights the importance of data security in large-scale projects and real-world applications. The presenter explains that POP lacks the necessary structure to protect and manage data, making it difficult to handle complex projects. They stress that OOP addresses this issue by focusing on data security and controlling how data is accessed and modified. OOP also solves other limitations of POP, such as the lack of inheritance, polymorphism, and data hiding.

15:05

🧠 Understanding Objects in Python

Here, the presenter shifts focus to explaining what objects are in Python. They give examples of variables, strings, and functions, showing how everything in Python is treated as an object. The presenter demonstrates this by running code snippets that reveal variables are instances of predefined classes, like 'int' or 'str', and functions are objects of the 'function' class. This sets the foundation for understanding the object-oriented nature of Python.

20:07

🛠 Introduction to Classes and Methods

The concept of classes and objects is introduced. The presenter explains that classes are blueprints for creating objects, while objects represent real-world entities. They give an example of modeling a YouTube channel with different roles, such as instructor, editor, and social media marketer. Each of these roles is an object with attributes (data) and methods (functions), and the presenter emphasizes how OOP allows for better organization and scalability by modeling real-world scenarios.

🏗 Simplifying Real-World Problem Modeling with OOP

The presenter explains how OOP helps simplify the management of real-world problems by breaking down complex tasks into smaller, manageable objects. They provide a YouTube channel example, where different roles like instructor and editor are modeled as objects, each with specific tasks. This organization allows for better control and scalability of projects. The presenter also introduces the concept of class as a blueprint for creating multiple objects and explains how attributes and methods are associated with objects.

🎯 Conclusion: Why We Need OOP

In this final paragraph, the presenter summarizes the advantages of OOP and its importance in managing real-world projects. They briefly explain the differences between classes and objects and how OOP provides a structured way to handle complex relationships and data security. They promise that future videos will dive deeper into the syntax and creation of classes and objects in Python, emphasizing the relevance of OOP in industry and large-scale projects.

Mindmap

Keywords

💡Object-Oriented Programming (OOP)

Object-Oriented Programming (OOP) is a programming paradigm focused on using 'objects' to design applications and software. It emphasizes structuring code around objects rather than functions or logic. In the video, OOP is introduced as a critical concept that ensures better data security and structure, which helps manage larger, more complex projects compared to the Procedure-Oriented Programming (POP) approach.

💡Procedure-Oriented Programming (POP)

Procedure-Oriented Programming (POP) is a programming approach that structures programs around functions or procedures, focusing on the steps of executing a task. In the script, the speaker contrasts POP with OOP, pointing out the limitations of POP for larger projects, such as difficulty managing global variables and lack of data security, leading to the introduction of OOP.

💡Global Variables

Global variables are variables that can be accessed and modified by any function in a program. In the video, global variables like 'resources' and 'profit' are discussed, illustrating how they pose challenges in POP since multiple functions can update them, causing potential errors and security issues. This is used as an argument for the need for OOP, which offers better data security.

💡Data Security

Data security in programming refers to protecting data from being accessed or modified by unauthorized parts of a program. In the context of the video, the lack of data security in POP is a significant drawback, as global variables are freely accessible and modifiable by any function. OOP is presented as a solution to this issue by encapsulating data within objects, providing better control over how data is accessed and modified.

💡Class

A class is a blueprint or template for creating objects in object-oriented programming. It defines attributes and methods that the objects created from the class will have. In the video, the instructor explains that a class like 'Instructor' acts as a blueprint from which multiple objects (such as individual instructors) can be created, each with its own attributes and methods.

💡Object

An object is an instance of a class in OOP. It represents a real-world entity with attributes and behaviors. The video uses the example of creating virtual 'Instructor' objects to model real-world instructors, illustrating how OOP focuses on objects to manage data and behavior in a more structured way compared to POP.

💡Attributes

Attributes are the variables associated with an object in OOP. They store information about the object's state. In the video, the instructor describes attributes like 'name,' 'address,' and 'has books' for the 'Instructor' class, emphasizing how attributes allow objects to have individual characteristics and how they differ from free-floating variables in POP.

💡Methods

Methods are functions defined within a class in OOP, representing the behaviors or actions that an object can perform. The video explains that methods are associated with specific objects and serve to define their actions, such as the 'teach' method for an 'Instructor' object. This association contrasts with the procedural approach in POP, where functions are not tied to specific entities.

💡Data Hiding

Data hiding is an OOP concept where an object's data is restricted from direct access, allowing only certain methods to modify it. The video mentions data hiding as one of the advantages of OOP over POP, which lacks this feature. This contributes to the overall data security by preventing unauthorized access to sensitive data.

💡Inheritance

Inheritance is an OOP feature that allows one class to inherit the properties and methods of another class, promoting code reuse and reducing redundancy. Although the video doesn’t dive deep into inheritance, it lists it as a key advantage of OOP over POP, where such relationships between functions and data are not supported.

Highlights

Introduction to object-oriented programming (OOP) and its importance in Python programming.

Explanation of why OOP is needed: It provides better handling of large-scale projects compared to procedure-oriented programming (POP).

POP focuses on procedures and functions, while OOP focuses on objects and data security.

In POP, global variables and data can be accessed and modified by multiple functions, which can lead to errors and security issues.

OOP helps model real-world problems by organizing code into objects, making it easier to manage complex projects.

Data security is a key advantage of OOP. In OOP, data is encapsulated within objects, ensuring controlled access.

Introduction to key OOP concepts like classes, objects, inheritance, polymorphism, and data abstraction, which will be discussed in future videos.

Real-world analogy: A YouTube channel where multiple tasks (editing, teaching, social media) can be managed efficiently using OOP principles.

Explanation of attributes (variables) and methods (functions) in OOP and how they are tied to objects rather than free-floating in code.

Objects are instances of classes, and classes act as blueprints for creating multiple objects.

OOP allows for scalability and simplifies relationships between different parts of a large project.

Introduction to the built-in classes and objects in Python, such as `int`, `str`, and `function`, showcasing how everything in Python is an object.

Practical example: How to model an instructor, editor, and other roles in a project using OOP principles.

Explanation of how object-oriented programming mirrors real-world concepts, like creating virtual entities with specific roles and functions.

Encapsulation in OOP allows control over how data is accessed and modified, ensuring data security and proper management.

Transcripts

play00:00

hey everyone I hope you are safe and

play00:02

doing good so in the series of learning

play00:03

path and programming language in the

play00:04

previous video we have seen one project

play00:06

that was a coffee machine project I hope

play00:08

you got that thing and you have done

play00:09

that right now from this video onwards

play00:12

we are going to start a very important

play00:14

Concept in Python that is object

play00:16

oriented programming

play00:19

right

play00:20

so we will be discussing everything

play00:22

about object oriented programming all

play00:24

the concepts and all in further videos

play00:26

but this video is about what this video

play00:28

is basically about why we need

play00:32

object-oriented programming till now

play00:35

also we have done few projects and we

play00:37

have written many programs without the

play00:39

need of object oriented programming yes

play00:43

then why now why we need oop

play00:46

right until now we were we were

play00:48

following which approach

play00:51

right so basically in this video I'll

play00:53

try to answer this question why do you

play00:56

need object learning programming and

play00:58

then further we'll discuss what is an

play00:59

object and then

play01:01

what is object on your programming

play01:03

right

play01:05

and later videos we'll be discussing all

play01:07

the concept classes objects and

play01:10

inheritance polymer facial obstruction

play01:11

everything about oop right

play01:15

so now before that I just want to tell

play01:18

you something it is important specially

play01:21

for those who are preparing for gate and

play01:23

ESC for gate and escs parents right it's

play01:26

like a never before opportunity for you

play01:28

guys an academy is back with combat yes

play01:32

and this time it is ultra combat

play01:34

so now you have a chance to get up to 90

play01:37

scholarship and many rewards such as

play01:41

MacBook Dell laptops Samsung phones and

play01:44

many more

play01:47

would be conducted on 23rd of July and

play01:51

the time is 11 am how many question you

play01:53

will get 40 question mcqs would be there

play01:56

in this test and the time limit is 120

play01:59

Minutes you will get to solve the

play02:01

questions now what are the syllabus

play02:02

syllabus will be General aptitude

play02:05

engineering mathematics and Technical

play02:09

and the most important thing is you can

play02:10

enroll for this test for this combat for

play02:13

free you don't need to pay anything no

play02:14

registration fee nothing right so do not

play02:17

miss this opportunity and enroll today

play02:19

the link I'll put in the description box

play02:21

of this video and you can use my code

play02:23

jkl10 to enroll for free in this combat

play02:26

right so all the relevant information

play02:28

and Link you will get in the description

play02:29

box of this video you can go and check

play02:31

out okay

play02:32

now let's try to find out the answer of

play02:35

this question why basically we need OB

play02:37

first see in the previous video we have

play02:39

done this project the coffee machine

play02:41

project so this was our project the menu

play02:44

resources profit uh is a variable that

play02:48

is global resources also dictionary

play02:50

having information that is global and we

play02:52

have defined many functions right and

play02:55

these functions are calling like

play02:58

here we are calling these functions and

play03:00

these are returning something and they

play03:03

are interlinked right see in this

play03:05

function we are in make coffee in this

play03:07

function we are updating the resource

play03:10

item resource item means these item

play03:12

because these are Global right and this

play03:15

function also we are accessing the

play03:17

resources because we are just comparing

play03:19

here we are not updating anything

play03:21

and in this like we are we are we are

play03:25

updating this profit This Global

play03:26

variable profit we are updating this

play03:28

right so these functions are interlinked

play03:32

with each other having

play03:33

many relationship

play03:35

right

play03:36

okay now this approach is what here we

play03:39

are following the processor oriented

play03:42

programming this approach pop approach

play03:45

right processor means these functions

play03:48

are known as procedure means procedure

play03:51

basically means the steps how we are

play03:53

going to perform some tasks right and

play03:55

how we are going to perform this

play03:57

function the check resources these are

play03:58

obviously the statements or the tasks we

play04:01

are writing the steps we are writing

play04:04

so these are what procedures so we can

play04:06

say function so this is what pop

play04:07

approach

play04:09

right now yeah that is fine we are

play04:12

following pop approach so why now we

play04:14

need oop approach because this is also

play04:16

fine right but in pop approach we can

play04:20

handle only small project

play04:23

because see it is just a simple one

play04:24

coffee machine project and here see

play04:27

we are having multiple functions and the

play04:30

main important thing is these functions

play04:32

are updating Global variables the profit

play04:35

is global variable a resources this

play04:37

dictionary is also Global obviously

play04:39

so in many functions

play04:42

more than one function we are accessing

play04:44

this resource and one function is

play04:45

updating this resources and in one

play04:47

function we are updating this profit

play04:49

right so we are updating the global

play04:51

variable or the data

play04:53

so suppose we are dealing with a large

play04:56

project a large scale project there we

play04:58

are having multiple functions 50

play05:00

functions or 100 functions and many

play05:02

Global variables right so it would be

play05:05

very difficult for you guys to track

play05:07

like which function is accessing which

play05:09

global variable which function is you

play05:11

know updating which global variable and

play05:13

accidentally if we update a global

play05:14

variable global data in any function

play05:17

then maybe it will give us some error or

play05:20

some unusual you know result right some

play05:23

unexpected output

play05:25

right so main thing is

play05:28

I think now you have noticed main thing

play05:30

we are focusing in

play05:32

in this approach pop approach on

play05:35

functions

play05:37

how to do the task the functions the

play05:40

procedures

play05:41

not on data data is now data here is

play05:46

freely moving

play05:48

during the whole program because

play05:50

obviously the global data is moving

play05:51

freely any function can access this data

play05:54

any function can update this data right

play05:56

it means there is no data security data

play06:00

is freely moving we are just focusing on

play06:01

the procedures of the functional means

play06:03

you can say how to do the task

play06:06

on this we are focusing more

play06:08

so one drawback of this is what data

play06:10

security I hope you got it why I am

play06:13

saying that it there is no data security

play06:15

in pop approach I hope you got this

play06:18

thing now right with the help of this

play06:20

example so now if you want to handle any

play06:23

real world problem any large project

play06:25

right then definitely it would be not

play06:28

easy

play06:29

to manage that project to implement that

play06:32

project with the help of this pop

play06:33

approach right because of the complexity

play06:35

and the relationship between those

play06:38

functions and all how to manage the

play06:41

relationship how to check which function

play06:43

is how to track which function is using

play06:45

which global data and which function is

play06:46

updating which data and all right

play06:49

because we are not focusing on data more

play06:51

and if suppose if maybe you think like

play06:53

we can do we will take like no global

play06:56

data is there we just change this type

play06:59

of this global data just take local data

play07:01

so all the functions which are accessing

play07:03

that global data you have to do

play07:05

accordingly the changes in those

play07:07

functions as well you have to resolve

play07:09

those functions as well right because

play07:10

maybe many functions are using that

play07:12

global data right

play07:15

so because of the complexity and the

play07:16

number of relationship are very complex

play07:19

here it would be very difficult to

play07:21

manage that thing with the help of this

play07:23

pop approach right and obviously the

play07:26

data security is not there and yeah

play07:28

obviously if you are implementing any

play07:29

real world project then we know that the

play07:31

data is how much the data is important

play07:34

like maybe I want like anybody can

play07:36

access my name jayanti but only few

play07:39

person can access my mobile number

play07:41

not all the person obviously I want my

play07:43

data safe

play07:45

so if you want to implement if you want

play07:46

to model any real world problem real

play07:48

world project then definitely you have

play07:51

to focus on data security

play07:53

and data security is not in pop you

play07:55

cannot

play07:56

you like you cannot Implement data

play07:58

security you cannot achieve data

play08:00

security in pop approach that is why we

play08:02

need another approach and that is in oop

play08:04

yes we are having data security and why

play08:07

that I'll tell you how you can Implement

play08:10

data security in object-oriented

play08:11

programming and there are other

play08:13

drawbacks also in this approach pop

play08:15

approach like there is no inheritance no

play08:17

virtual function no operator overloading

play08:20

no polymorphism no data hiding many

play08:23

other things are there but now I know

play08:25

you don't know about what is inheritance

play08:27

what is data hiding what is virtual

play08:28

function what is polymorphism so that is

play08:30

why it will not be you know it would not

play08:32

be easy for you to understand these

play08:34

things right but I'm sure data security

play08:37

is one thing one drawback that you got

play08:40

exactly what is data security and why I

play08:42

am saying this right same thing in later

play08:44

videos we will discuss what is

play08:46

inheritance what is like you can say

play08:48

that virtual function and all will be

play08:50

discussing polymorphism data obstruction

play08:51

data hiding then you will get why I am

play08:53

saying right now like pop is not having

play08:56

these things right it's okay if you're

play08:58

not getting anything of these terms it's

play09:00

okay

play09:01

it's normal right because its first

play09:04

lecture of oop and definitely it would

play09:07

not be easy for you to understand

play09:08

everything in one video right

play09:11

but till now I hope the data security

play09:13

you got right now

play09:16

object-oriented programming is used to

play09:18

model now the real world projects right

play09:21

now first thing

play09:22

we'll see like what is object

play09:25

we know python is object-oriented

play09:27

programming and I think you have heard

play09:30

this line also everything is considered

play09:32

as an object in Python right why I am

play09:35

saying this let's see with the help of

play09:37

this example

play09:38

see if I take a variable like a is equal

play09:40

to 1 and if you print the type of uh

play09:44

this variable a

play09:48

then what you will get just focus on the

play09:50

answer see

play09:51

class

play09:53

int

play09:55

class

play09:57

because here we are having a class that

play10:00

is predefined in the library of python

play10:03

class is int and this a is what it's

play10:06

just an object of this class int

play10:10

if I'll not take this a if I

play10:13

like

play10:15

want to find out the

play10:17

type of this string hello now let's run

play10:20

this C Class Str

play10:24

now this hello is an object of class

play10:27

Str so this is built in class in Python

play10:31

that is why I am saying everything you

play10:33

deal now this hello is what an object

play10:35

they say is also an object everything

play10:37

you deal is in Python is what

play10:40

an object let's take if I have a

play10:42

function

play10:43

display

play10:45

and there I am just using the pass

play10:48

statement nothing I'm going to write and

play10:49

then I want to find out

play10:51

this type of this

play10:55

display function

play10:58

this you need to write down name of this

play10:59

function display let's run this

play11:02

and see class

play11:04

function so there is a class in build

play11:07

class function and this function is an

play11:10

just an object of this class this class

play11:13

that is why I was I was saying like

play11:16

everything in Python whether it's

play11:17

variable function or any string or not

play11:19

everything is considered as object

play11:22

now you got

play11:24

why we are saying like what is an object

play11:26

and why we are saying this so you got

play11:28

this idea in built classes we are having

play11:30

python many inbuilt classes right and

play11:32

the object you can use

play11:34

fine and see there is a class Str see

play11:39

you know this hello is what

play11:43

just it's a string if you want to find

play11:45

out type so the class will be string so

play11:47

if I use something like hello don't

play11:51

so the class Str that is having many

play11:54

functions lower title index and many

play11:57

function see

play11:59

right so these functions you can use on

play12:02

this object because this object is of

play12:05

Str class type right so if I use this

play12:09

function only lower

play12:12

and if I print if I run this C

play12:15

this is already in lower so it would be

play12:18

let's suppose

play12:20

I'll do this in capital letter and C it

play12:23

will print

play12:25

in small letter capital letter but don't

play12:27

lower means small letter so there are

play12:29

many inbuilt function also that you can

play12:31

call on that object with the help of dot

play12:34

operator right whatever the object dot

play12:37

whatever the function is there of that

play12:39

class so many classes and those classes

play12:41

are having inbuilt functions those you

play12:43

can use on those object right

play12:46

so I guess you have some idea now

play12:48

objects and all

play12:50

right

play12:51

now uh oriented oriented means in simple

play12:54

English language if we say then like

play12:57

it's interested in a particular thing or

play13:00

a particular person so we are basically

play13:01

interested in object that is why it is

play13:03

known as object oriented programming so

play13:06

are interested or main focus is in on

play13:08

objects

play13:10

right that is why it is known as oop

play13:12

like you know this shop is male oriented

play13:15

or female oriented means in this show of

play13:18

the product all the product you will get

play13:19

are of males not females male oriented

play13:22

female oriented like this so object

play13:24

oriented you focus on we are interested

play13:27

in objects

play13:28

that is why it is known as

play13:29

object-oriented programming right

play13:32

so I hope the answer of why why we need

play13:35

oop that is somewhat clear to you guys

play13:37

because we have done some advantage of

play13:40

oop not all

play13:41

because everything will be discussing

play13:43

later videos then you will get all the

play13:46

advantages and benefits of Pop if you

play13:49

you know understand to a certain level

play13:51

what is op and what are the advantages

play13:53

then definitely you will get why it is

play13:55

always better to use op and why in the

play13:58

industry uh you know in the companies

play14:01

they use this op approach to you know

play14:03

Implement project large project real

play14:06

world project

play14:07

right now let's take a simple example if

play14:11

a real world problem I'm taking if I am

play14:14

going to start a YouTube channel right

play14:15

so in starting I'm the only one like one

play14:18

man army so I can teach some subjects

play14:21

I am the editor I am thumbnail designer

play14:24

I am the social media marketer I am the

play14:26

instructor right

play14:28

but I want to start many courses C C

play14:31

plus plus Java computer network dbms

play14:35

operating system data structure web

play14:36

development course and many more courses

play14:38

then definitely if I am a one-man Army

play14:41

then it would be very difficult for me

play14:43

to manage everything

play14:44

right

play14:46

so this would become more complex if you

play14:49

want to grow your YouTube channel

play14:50

obviously

play14:51

you got it right for one person

play14:54

fine now what I can do

play14:58

to solve my problem I can hire like if

play15:02

I'm going to start uh another course and

play15:05

that is web development

play15:08

so I can hire one instructor

play15:12

that will teach this course

play15:15

right

play15:16

and maybe one editor

play15:19

that will do the editing as well as

play15:21

thumbnail thumbnail designing one I will

play15:24

hire social media marketer

play15:28

and I would be like manager

play15:33

right now my task is to manage these

play15:37

things now this manager

play15:40

like suppose the manager is me

play15:43

so I don't need to go in so much detail

play15:47

of how they are going to do their task I

play15:49

don't need to tell how to teach to the

play15:51

instructor how do you need to tell how

play15:53

to edit the videos how to design

play15:55

thumbnail

play15:56

to an editor I don't need to tell

play16:00

a social media marketer how to do your

play16:02

job

play16:03

right

play16:05

I don't need to worry about these things

play16:07

because these are expert in their job

play16:08

they know how to do their job better

play16:11

than me

play16:12

I guess

play16:13

right

play16:14

so this is going to simplify my task and

play16:17

simplify the relationship

play16:19

so the same approach or the same concept

play16:21

we can use to simplify our code

play16:25

to implement larger project to make a

play16:28

project more scalable the same approach

play16:31

right

play16:33

and see now one more thing if I want to

play16:38

like start one more course about Java

play16:42

so or before that let me just tell you

play16:44

something now

play16:46

let's take one thing like I'm taking

play16:47

this instructor so this instructor is

play16:50

having

play16:52

and see as we know object-oriented

play16:55

programming oop is used to model real

play16:57

world project right

play16:59

so let's create now a virtual YouTube

play17:01

channel so let's create a virtual

play17:03

instructor virtual editor virtual social

play17:05

media marketer and everything virtually

play17:07

let's create right now

play17:09

we need to model this these things in

play17:12

structure editor and all in programming

play17:16

right we need to model this thing in

play17:17

programming and obviously using oop

play17:20

approach we use we model right now this

play17:24

instructor this is Hamming

play17:28

some information right and it will do

play17:31

some task

play17:32

right

play17:34

so two thing what he or she has or what

play17:37

he or she does so it is Hamming

play17:40

obviously some information like name of

play17:42

the instructor maybe address phone

play17:44

number and like some attribute like has

play17:47

books

play17:49

then we can say like true having books

play17:52

has camera

play17:53

because to record

play17:55

the lecture we need camera and like has

play17:58

laptop

play18:00

that is also true or maybe something is

play18:02

false so it is having something some

play18:04

information right and it will do

play18:06

something what it will do teach

play18:09

so we can say like deaf teach we can

play18:12

define a function and here you can write

play18:13

down some statements

play18:15

and maybe other thing other function we

play18:18

can do like depth it will also prepare

play18:19

quiz

play18:21

so that is other thing

play18:24

so

play18:25

this is what it is having this is what

play18:28

it will do

play18:30

right

play18:31

now in programming terms see these are

play18:36

simply we know these are variables

play18:38

if simply I say because these are

play18:40

variables obviously and these are

play18:41

functions but in case of object oriented

play18:45

programming we call the variables as

play18:48

attributes

play18:50

and these are known as methods not

play18:52

functions methods

play18:55

and there is some reason because see

play18:56

these variables and these functions are

play18:59

not free floating in pop the variables

play19:03

we take like global data that was free

play19:05

floating move anywhere

play19:07

these variables these functions are

play19:09

associated with

play19:12

and entity that is instructor

play19:15

so these things are associated with this

play19:17

thing

play19:18

right that is why these are known as not

play19:21

simple variables attributes not simple

play19:24

functions methods

play19:26

right because they are these are

play19:28

associated with something these are not

play19:30

free floating in your programs right

play19:33

so in op we try to model real world

play19:38

object so and these objects are having

play19:40

something some information these objects

play19:42

do something so what they have

play19:47

that thing is modeled with the help of

play19:50

attributes and what they do that thing

play19:53

is model with the help of methods right

play19:56

so simply we can say an object is just a

play20:00

way of combining some piece of data and

play20:03

some functionality into a same thing

play20:06

into same thing like into a box this is

play20:09

same thing in a box only we are having

play20:12

this and this as well right

play20:15

now

play20:16

if I want to start another course like

play20:18

Java

play20:19

so I can hire one more instructor if I

play20:22

want to start another course I can hire

play20:23

one more instructor that is fine right

play20:25

so instructor suppose I have higher like

play20:29

Gia

play20:31

one more instructor payal

play20:34

maybe one more instructor so now see now

play20:38

these actual thing these actual person

play20:43

these are known as objects

play20:47

in object-oriented programming these are

play20:49

objects right and this this instructor

play20:53

this is simply a blueprint or a design

play20:55

this is known as class

play21:00

so class is simply a blueprint just to

play21:03

create objects so these actual things

play21:05

these are objects right like if you are

play21:09

going to build a house then the map or

play21:13

the sketch

play21:14

of that house is what a blueprint a

play21:18

design you have and using that design

play21:21

you can build a house so that house is

play21:24

object and that sketch or that map is

play21:28

what a class and see using that single

play21:32

map we can we can construct we can

play21:34

design multiple houses right

play21:38

so we have only one class we have only

play21:41

one design we have only one blueprint

play21:42

using that we can build many we can

play21:45

create we can generate many objects

play21:48

right so I hope you now you got the

play21:50

basic idea or an overview what is a

play21:52

class what is an object right and why

play21:54

basically we need object oriented

play21:56

programming right

play21:58

so now the overview of object-oriented

play22:00

programming like basically why we need

play22:02

this right and what is object-oriented

play22:05

programming what is simply an audio of

play22:07

class and object and this thing is clear

play22:10

to you guys right now in the next video

play22:12

we will see in more detail what is the

play22:13

class what is an object how to create a

play22:15

class how to create an object the syntax

play22:17

and everything right with the help of

play22:19

program right so now it's in the next

play22:21

two till then bye like it

Rate This

5.0 / 5 (0 votes)

Related Tags
Python OOPObject-orientedData securityProgramming basicsCoding tutorialReal-world projectsSoftware developmentClass and objectsInheritancePolymorphism