1 00:00:00,000 --> 00:00:05,414 [SOUND] [SOUND] Hey everyone. 2 00:00:05,414 --> 00:00:07,910 I'm Kenneth, the Python teacher here at Treehouse. 3 00:00:07,910 --> 00:00:10,180 In this course I'm gonna introduce you to one of the most powerful 4 00:00:10,180 --> 00:00:11,460 features of Python. 5 00:00:11,460 --> 00:00:13,250 But like many things that give you great power, 6 00:00:13,250 --> 00:00:16,550 this one will give you great, no wait, this isn't some comic book. 7 00:00:16,550 --> 00:00:20,150 This feature will give you a lot more power and capabilities in you programming. 8 00:00:20,150 --> 00:00:23,460 But it won't suddenly make you responsible for the safety of a major city. 9 00:00:23,460 --> 00:00:25,670 In the time you spent with Python you probably read or 10 00:00:25,670 --> 00:00:28,700 heard that Python is an object oriented programming language. 11 00:00:28,700 --> 00:00:30,380 But like so much in the world of programming, 12 00:00:30,380 --> 00:00:33,580 that very descriptive name, object oriented programming language, 13 00:00:33,580 --> 00:00:35,350 doesn't really mean all that much, does it? 14 00:00:35,350 --> 00:00:37,865 Yet more dense programming jargon that we just throw at people. 15 00:00:37,865 --> 00:00:39,770 All right, let me break it down a little bit for you. 16 00:00:40,910 --> 00:00:41,860 When I was in school and 17 00:00:41,860 --> 00:00:45,830 we talked about grammar, nouns were always defined as a person, place, or a thing. 18 00:00:45,830 --> 00:00:46,660 And on the surface level, 19 00:00:46,660 --> 00:00:49,500 that's a pretty good explanation of an object in programming. 20 00:00:49,500 --> 00:00:51,250 If it can be described with adjectives and 21 00:00:51,250 --> 00:00:54,200 maybe it can do things with verbs, it's an object. 22 00:00:54,200 --> 00:00:56,770 In Python though, everything is an object. 23 00:00:56,770 --> 00:01:00,530 When you've used an integer to represent someone's age, you used an int object. 24 00:01:00,530 --> 00:01:04,290 When you stored your name in a string, you put your name into an str object. 25 00:01:04,290 --> 00:01:07,840 And heck, when you created a function, you actually defined a function object. 26 00:01:07,840 --> 00:01:10,680 Most of the time though, we don't need to think about functions being objects. 27 00:01:11,830 --> 00:01:15,160 Now, before I get into some terms and definitions, let me say this. 28 00:01:15,160 --> 00:01:19,243 Object oriented programming is a major area of programming and program design. 29 00:01:19,243 --> 00:01:22,350 You won't understand all of it after doing just this course. 30 00:01:22,350 --> 00:01:24,515 I've been using the school of design for over a decade and 31 00:01:24,515 --> 00:01:27,710 I keep learning new patterns and approaches to it all the time. 32 00:01:27,710 --> 00:01:30,840 So, if at the end of this course you still feel a little fuzzy about it, that's fine. 33 00:01:30,840 --> 00:01:32,000 It's to be expected. 34 00:01:32,000 --> 00:01:36,300 Just like with any large topic area, like say algebra or baking, you'll have to 35 00:01:36,300 --> 00:01:40,180 spend time researching and experimenting with it to really get the most out of it. 36 00:01:40,180 --> 00:01:43,681 Okay, let's define a few things and then we'll get into some coding. 37 00:01:43,681 --> 00:01:46,060 In Python, object types like int and str and 38 00:01:46,060 --> 00:01:49,630 list are defined with a construct known as a class. 39 00:01:49,630 --> 00:01:53,860 Instead of using def like in functions, we use the key word class. 40 00:01:53,860 --> 00:01:55,920 Nouns have adjectives to describe them. 41 00:01:55,920 --> 00:01:58,330 Objects, or classes, have attributes. 42 00:01:58,330 --> 00:01:59,940 Attributes are very similar to variables but 43 00:01:59,940 --> 00:02:03,580 they're defined inside of a class and belong to that class. 44 00:02:03,580 --> 00:02:06,220 And just like nouns can do actions by using verbs, 45 00:02:06,220 --> 00:02:08,870 classes have methods to give them special abilities. 46 00:02:08,870 --> 00:02:11,930 Methods look just like functions, but again, they belong to the class. 47 00:02:12,980 --> 00:02:14,020 When we use a class, 48 00:02:14,020 --> 00:02:18,090 like creating a string from a number, we call those resulting object an instance. 49 00:02:18,090 --> 00:02:21,841 When that instance is used, like when we change an attribute on it or call 50 00:02:21,841 --> 00:02:26,088 a method, the instance is responsible, not the class it was instantiated from. 51 00:02:26,088 --> 00:02:29,145 There are actually some other things to consider about attributes and methods, but 52 00:02:29,145 --> 00:02:30,840 we’ll dive into them later. 53 00:02:30,840 --> 00:02:33,970 Wow, that was a lot to take in and we haven’t even gotten into code yet. 54 00:02:33,970 --> 00:02:36,040 You’ll get used to all of this new vocabulary quickly though, 55 00:02:36,040 --> 00:02:38,340 because we’ll be using it all through this course. 56 00:02:38,340 --> 00:02:41,020 For now, get settled in and read through the teacher’s notes to make sure you’re 57 00:02:41,020 --> 00:02:42,690 comfortable with all these new words. 58 00:02:42,690 --> 00:02:45,060 There’s a bunch of code and a vocabulary test coming your way.