1 00:00:11,400 --> 00:00:12,760 Hi, everybody, welcome. 2 00:00:13,410 --> 00:00:19,470 Today, we're getting started with one of the most important topics of the course, which will be one 3 00:00:19,470 --> 00:00:24,240 of the most challenging as well, and that is object oriented programming. 4 00:00:24,240 --> 00:00:32,760 Or Olby, in short, basically, we are going to apply all of our rules regarding variables, regarding 5 00:00:32,760 --> 00:00:38,970 collections, regarding methods, and we're going to build up some more topics on top of that, such 6 00:00:38,970 --> 00:00:42,390 as classes such as properties. 7 00:00:42,540 --> 00:00:46,950 And also we're going to go deeper into the methods topic. 8 00:00:47,520 --> 00:00:55,140 I think that this section is very important for everyone who wants to find a job as a programmer, because 9 00:00:55,140 --> 00:01:03,030 object oriented programming is very important for you to pass interviews or to build any program which 10 00:01:03,030 --> 00:01:03,900 is complex. 11 00:01:05,070 --> 00:01:08,430 We'll start off with basic three basic terms. 12 00:01:08,940 --> 00:01:15,930 I'm going to show you right away an example of visual example of how objects are built. 13 00:01:16,500 --> 00:01:22,140 And then we're going to start from the beginning and explain each term, as we always do. 14 00:01:22,410 --> 00:01:29,490 And the example that you will see in this lecture will start building it from the start from the next 15 00:01:29,490 --> 00:01:30,060 lecture. 16 00:01:30,180 --> 00:01:30,540 All right. 17 00:01:30,550 --> 00:01:32,580 So this is an introduction of video. 18 00:01:32,580 --> 00:01:36,670 And from the next lecture, we will start building it up from scratch. 19 00:01:37,050 --> 00:01:37,500 So. 20 00:01:37,500 --> 00:01:38,410 All right, let's begin. 21 00:01:39,000 --> 00:01:39,660 All right, then. 22 00:01:39,670 --> 00:01:42,570 So this will be the introduction of video. 23 00:01:42,810 --> 00:01:48,660 So let's start off explaining what is object oriented programming actually means. 24 00:01:48,690 --> 00:01:53,270 OK, so Python is an object oriented programming language. 25 00:01:53,290 --> 00:01:59,640 This we already know and it gives us unique abilities for flexible and useable code. 26 00:02:00,270 --> 00:02:09,570 OK, so let's see some introduction visualization in order to understand what is object oriented programming, 27 00:02:10,350 --> 00:02:14,280 we'll talk in general terms without getting into details. 28 00:02:14,490 --> 00:02:22,560 And later on, after we explain each of these terms deeply, we will build up this example from scratch. 29 00:02:23,400 --> 00:02:30,270 OK, so first of all, there is a new entity we're going to study, which is called the class. 30 00:02:30,540 --> 00:02:40,200 And that class wraps are methods which we already know, an additional entity, which is called properties. 31 00:02:40,560 --> 00:02:51,450 OK, so methods already familiar with methods, but properties are like a variable off that object. 32 00:02:51,480 --> 00:02:54,030 OK, we will later on go into details. 33 00:02:54,150 --> 00:02:57,980 Just remember that properties state for variables. 34 00:02:57,990 --> 00:03:02,070 OK, these are the variables of the object. 35 00:03:03,720 --> 00:03:09,540 So this is an introductory, introductory, introductory visualization. 36 00:03:09,810 --> 00:03:17,170 So a class basically is in reference to cause it's a general car sketch. 37 00:03:17,190 --> 00:03:17,590 OK. 38 00:03:18,210 --> 00:03:24,450 Our car our car has methods which is which are methods as we know them. 39 00:03:25,140 --> 00:03:32,580 For example, we have fuel calculator, we have check engine counters, we have door is open method. 40 00:03:32,730 --> 00:03:34,130 And all of these are methods. 41 00:03:34,140 --> 00:03:42,690 We can put calculations in them, math calculations or some other like manipulations upon variables 42 00:03:42,690 --> 00:03:43,330 that we want. 43 00:03:43,350 --> 00:03:43,650 All right. 44 00:03:43,890 --> 00:03:52,260 So methods are methods as always, while properties are a variable off that object. 45 00:03:52,290 --> 00:04:00,850 OK, so in properties we might have fuel status current km kilometers on engine or door status. 46 00:04:00,900 --> 00:04:01,340 All right. 47 00:04:02,430 --> 00:04:09,570 So this is a general car search, meaning each car that we want to produce from our factory will have 48 00:04:09,570 --> 00:04:15,280 all of these parameters in the in the car while it's being made. 49 00:04:15,330 --> 00:04:15,670 OK. 50 00:04:15,960 --> 00:04:18,210 And from here, let's scroll down a little bit. 51 00:04:18,390 --> 00:04:18,760 OK. 52 00:04:18,780 --> 00:04:27,360 So from this basic sketch, we can now create a new instance of an object, OK, instance of an object 53 00:04:27,660 --> 00:04:29,790 for a specific car model. 54 00:04:30,750 --> 00:04:33,780 While here we had general car sketch. 55 00:04:34,080 --> 00:04:41,280 Now from this we can create a specific car model using an instance of an object. 56 00:04:41,280 --> 00:04:44,010 We will obviously going to learn how to do it. 57 00:04:44,010 --> 00:04:45,210 You're not supposed to know. 58 00:04:46,410 --> 00:04:52,270 OK, and also we can you reuse methods endlessly for each car model. 59 00:04:52,300 --> 00:05:00,060 OK, so from this we're going to create several cars and each car would have all of these properties 60 00:05:00,060 --> 00:05:06,360 and methods, each one of them with its own properties and methods. 61 00:05:06,420 --> 00:05:11,010 OK, so for example, here we have first object. 62 00:05:11,020 --> 00:05:19,060 For instance, from the car sketch that we have seen here, OK, we want to create an object instance. 63 00:05:19,120 --> 00:05:23,690 OK, so from the sketch, we want to create an actual car, basically. 64 00:05:23,950 --> 00:05:29,640 So this time we have actual variables here, which are the properties, OK? 65 00:05:29,710 --> 00:05:34,820 Remember that properties are the same as variables. 66 00:05:34,840 --> 00:05:37,450 Later on, we'll show exactly what they are. 67 00:05:37,810 --> 00:05:48,370 So this Ford Focus Focus car has fuel status then current kimmet kilometers on engine are 240 and Dorje 68 00:05:48,370 --> 00:05:50,140 status is closed. 69 00:05:50,170 --> 00:05:55,690 OK, these are the variables that this car contains. 70 00:05:55,930 --> 00:05:56,370 All right. 71 00:05:56,770 --> 00:06:00,870 And at the bottom, we have the methods and fuel calculator. 72 00:06:01,510 --> 00:06:03,430 We have some kind of printout. 73 00:06:03,850 --> 00:06:08,210 You still have 10 liters of fuel, OK, after some calculation made there. 74 00:06:08,890 --> 00:06:15,070 We have we have a printout inside that method and we have a printout that says you still have 10 liters 75 00:06:15,070 --> 00:06:15,520 of fuel. 76 00:06:16,120 --> 00:06:19,540 Check engine also have some calculation. 77 00:06:19,720 --> 00:06:21,670 And at the end we have a printout. 78 00:06:21,680 --> 00:06:28,360 You need engine check in one thousand and 50 kilometers and there is open the same. 79 00:06:28,600 --> 00:06:29,950 All doors are closed. 80 00:06:29,980 --> 00:06:32,110 OK, there are some check up in here. 81 00:06:32,110 --> 00:06:35,980 Inside this method we check which checks if all doors are closed. 82 00:06:36,740 --> 00:06:40,480 OK, basically, for example, door is open. 83 00:06:40,480 --> 00:06:48,890 Check can receive the variable off the property of door state status. 84 00:06:48,940 --> 00:06:57,520 OK, so it can receive it and check what value it has here, this variable and accordingly then to print 85 00:06:57,520 --> 00:06:59,410 out whatever we want. 86 00:06:59,740 --> 00:07:01,780 OK, so these are the basics. 87 00:07:02,650 --> 00:07:11,830 And from the other hand, we have a second object instance, an Audi A3 and this time Fuel Staros is 88 00:07:11,830 --> 00:07:14,830 15 as opposed to here we had 10. 89 00:07:14,860 --> 00:07:16,410 OK, the values are different. 90 00:07:16,660 --> 00:07:24,640 So fuel status is twenty five current km on three hundred and ten dollars status is open. 91 00:07:25,030 --> 00:07:32,860 And this time the fuel calculation, the method, this method, the calculation here was different and 92 00:07:32,860 --> 00:07:36,100 it says you still have 25 liters of fuel. 93 00:07:36,820 --> 00:07:43,470 Engine check, you need engine checking, eight more kilometers and the door is open chag. 94 00:07:43,600 --> 00:07:46,180 Not all doors are closed. 95 00:07:47,080 --> 00:07:50,230 OK, so we have basically this sketch here. 96 00:07:50,500 --> 00:07:51,400 This is a sketch. 97 00:07:52,330 --> 00:07:55,210 It has certain methods and certain properties. 98 00:07:55,520 --> 00:08:02,290 OK, and then each car gets its own properties and its own values of properties right here. 99 00:08:02,500 --> 00:08:08,740 And we can make separate calculations for the methods as well for each car model. 100 00:08:08,770 --> 00:08:13,840 OK, so this is basically the main idea off objects. 101 00:08:13,920 --> 00:08:19,780 OK, the class that you were going to learn straightaway in the next lecture is like a sketch. 102 00:08:19,780 --> 00:08:26,620 And from that sketch, from that class, we can create an instance of an object, meaning we can create 103 00:08:26,620 --> 00:08:33,760 actual cars in our case and give its own properties and give its own values of properties here and use 104 00:08:33,760 --> 00:08:36,070 this these methods accordingly. 105 00:08:36,070 --> 00:08:37,600 For each of these cars. 106 00:08:37,600 --> 00:08:41,680 We're actually going to give this instance, this entity. 107 00:08:41,920 --> 00:08:45,460 We're going to give it actually a name, a Ford Focus. 108 00:08:45,550 --> 00:08:49,220 And inside this Ford Focus, we're going to insert some values inside. 109 00:08:49,300 --> 00:08:54,910 OK, this is as much visualized as I can do it. 110 00:08:55,720 --> 00:08:59,020 And don't worry, we're going to start all this from scratch. 111 00:08:59,020 --> 00:09:07,510 From the next lecture, we'll learn what our classes, what our methods in the terms of object oriented 112 00:09:07,510 --> 00:09:10,550 and also what our properties are. 113 00:09:10,730 --> 00:09:14,350 I think that concludes our introduction video. 114 00:09:14,350 --> 00:09:15,890 And I will see you in the next lecture. 115 00:09:15,910 --> 00:09:16,420 Thank you.