1
00:00:00,009 --> 00:00:02,650
So welcome to the brand new section where we're going

2
00:00:02,660 --> 00:00:08,109
to be taking a look at object oriented programming,

3
00:00:08,369 --> 00:00:11,100
otherwise known as OOP.

4
00:00:12,520 --> 00:00:13,260
OK,

5
00:00:13,520 --> 00:00:20,020
this is where we're going to delve into some advanced aspects of programming.

6
00:00:20,430 --> 00:00:25,950
But don't worry, I will be here to explain to you in the simplest manner possible.

7
00:00:26,430 --> 00:00:28,549
So what exactly is oo

8
00:00:30,709 --> 00:00:32,880
what you see in front of you is

9
00:00:33,029 --> 00:00:38,060
basically a library, right? You've got all sorts of books, you've got books on

10
00:00:38,299 --> 00:00:43,889
anthropology, archaeology, biology, chemistry, math, and so on.

11
00:00:44,840 --> 00:00:49,270
Imagine you were the librarian, you were the person in charge of all these books.

12
00:00:49,450 --> 00:00:52,270
Ideally, of course, you would need some sort of a system

13
00:00:53,009 --> 00:00:58,340
to manage these books, right? You will need to know where to put the books.

14
00:00:58,729 --> 00:01:00,970
You will need to know the

15
00:01:01,119 --> 00:01:04,480
characteristics of each book, like you know, the title of the book,

16
00:01:04,489 --> 00:01:05,989
the author of the book.

17
00:01:06,889 --> 00:01:10,930
And also whether or not the books are available, maybe they've been buried,

18
00:01:11,099 --> 00:01:11,919
stuff like that.

19
00:01:12,699 --> 00:01:13,160
So

20
00:01:14,860 --> 00:01:19,239
imagine that we created a class called book.

21
00:01:19,519 --> 00:01:20,160
OK.

22
00:01:20,519 --> 00:01:21,599
And just like I said,

23
00:01:21,959 --> 00:01:25,949
this class can define several kinds of characteristics about each book,

24
00:01:25,959 --> 00:01:28,400
like the title of the book the author, the genre,

25
00:01:28,639 --> 00:01:29,720
the cover color.

26
00:01:30,959 --> 00:01:33,139
But besides the physical attributes of the book,

27
00:01:33,150 --> 00:01:36,150
we can also talk about the things that we can do with the book.

28
00:01:36,430 --> 00:01:38,620
Maybe you can borrow the book

29
00:01:38,849 --> 00:01:41,940
and if we can, how long can we borrow the book for?

30
00:01:42,339 --> 00:01:44,379
Maybe we can even buy the book and so on.

31
00:01:44,809 --> 00:01:45,220
Ok.

32
00:01:45,870 --> 00:01:48,209
Think of all these attributes

33
00:01:48,470 --> 00:01:49,449
under

34
00:01:49,849 --> 00:01:51,569
the class book.

35
00:01:52,110 --> 00:01:52,650
All right.

36
00:01:53,470 --> 00:01:54,050
Now,

37
00:01:55,339 --> 00:01:59,000
things like the title, the author, the genre,

38
00:01:59,139 --> 00:02:03,800
things that physically describe the book, we can call them attributes,

39
00:02:03,970 --> 00:02:06,250
right? We've talked about attributes already in this course.

40
00:02:06,870 --> 00:02:08,169
But then methods,

41
00:02:08,309 --> 00:02:12,610
methods will describe what it is that we can actually do with each

42
00:02:12,779 --> 00:02:13,520
book.

43
00:02:14,449 --> 00:02:16,149
Can you borrow it, can you buy it?

44
00:02:16,740 --> 00:02:19,589
So basically the book class

45
00:02:19,869 --> 00:02:23,919
will define both the attributes and the methods.

46
00:02:24,919 --> 00:02:25,429
So

47
00:02:25,610 --> 00:02:26,490
in other words,

48
00:02:26,649 --> 00:02:31,460
the book class is like a general description of what a book

49
00:02:31,619 --> 00:02:34,580
might look like and what we can actually do with the book,

50
00:02:34,589 --> 00:02:38,460
but we're not referring to a specific book just yet.

51
00:02:39,750 --> 00:02:40,250
All right.

52
00:02:41,679 --> 00:02:42,300
Now

53
00:02:42,470 --> 00:02:45,830
each individual book in the library

54
00:02:46,089 --> 00:02:52,029
is what we refer to as an object of the book class.

55
00:02:52,220 --> 00:02:53,380
So once again,

56
00:02:53,630 --> 00:02:56,330
the book class will give us a general description

57
00:02:56,339 --> 00:02:58,990
of the attributes and methods of each book.

58
00:02:59,139 --> 00:03:02,320
While the books themselves, the individual books,

59
00:03:02,520 --> 00:03:06,720
they will be called objects of the book class.

60
00:03:06,990 --> 00:03:07,529
So

61
00:03:08,259 --> 00:03:09,839
the object attributes

62
00:03:09,940 --> 00:03:11,919
of book A for example,

63
00:03:12,080 --> 00:03:14,660
could be the title is Python programming.

64
00:03:15,020 --> 00:03:18,759
The author could be Jack and then the color could be blue, right?

65
00:03:19,440 --> 00:03:23,550
And then let's take a look at book B, the title could be cyber 101.

66
00:03:23,710 --> 00:03:26,220
The author is Alice and the color is red.

67
00:03:26,639 --> 00:03:30,570
These are individual attributes of each book

68
00:03:30,660 --> 00:03:33,460
and the attributes have their own values.

69
00:03:34,449 --> 00:03:39,990
The value of the attribute color for book A is blue as an example, right? And so on.

70
00:03:40,470 --> 00:03:42,149
So the methods

71
00:03:42,880 --> 00:03:47,100
we can also for example, say book A has a method called borrow

72
00:03:47,630 --> 00:03:48,580
whereby

73
00:03:48,809 --> 00:03:51,220
once the book has been borrowed,

74
00:03:51,570 --> 00:03:55,380
the library will have to update the records to indicate

75
00:03:55,500 --> 00:03:58,699
that the book is no longer available to be borrowed.

76
00:03:59,360 --> 00:04:01,130
And likewise imagine book B

77
00:04:01,309 --> 00:04:04,059
had been borrowed in the past, but now it's been returned,

78
00:04:04,509 --> 00:04:08,419
we can then mock book B as available again.

79
00:04:08,630 --> 00:04:12,059
So these are methods, these are attributes.

80
00:04:13,589 --> 00:04:14,050
So

81
00:04:14,820 --> 00:04:16,119
to give you a quick recap,

82
00:04:16,619 --> 00:04:21,260
the class is kind of like the general description of the book

83
00:04:21,428 --> 00:04:24,250
where the attributes and methods are defined.

84
00:04:24,519 --> 00:04:30,750
The object is an instance, basically a specific book in a library,

85
00:04:30,760 --> 00:04:34,320
a specific object on the class, the book class

86
00:04:34,660 --> 00:04:37,190
attributes will be physical description of each book.

87
00:04:37,200 --> 00:04:40,309
While methods otherwise known as actions

88
00:04:40,420 --> 00:04:45,140
are well, essentially the actions that can be performed on each

89
00:04:45,450 --> 00:04:46,179
book.

90
00:04:46,609 --> 00:04:47,059
So

91
00:04:47,769 --> 00:04:52,350
join me in the next video where we're gonna start taking a look at some examples.

