1 00:00:00,300 --> 00:00:01,140 Instructor: Let's talk about 2 00:00:01,140 --> 00:00:03,690 our next developer fundamentals, 3 00:00:03,690 --> 00:00:06,843 and this one is understanding data structures. 4 00:00:08,189 --> 00:00:10,890 A really good programmer is a programmer 5 00:00:10,890 --> 00:00:12,660 that is able to decide 6 00:00:12,660 --> 00:00:15,840 what data structure to use, when. 7 00:00:15,840 --> 00:00:19,110 Up until now, we've learned about dictionaries and lists, 8 00:00:19,110 --> 00:00:22,800 and we'll learn about a couple more throughout the course. 9 00:00:22,800 --> 00:00:24,480 But a really good programmer, 10 00:00:24,480 --> 00:00:26,340 a programmer who's experienced, 11 00:00:26,340 --> 00:00:29,280 is able to understand what the trade-offs are, 12 00:00:29,280 --> 00:00:30,690 when to use what. 13 00:00:30,690 --> 00:00:32,947 And although, I can give you a list of, 14 00:00:32,947 --> 00:00:34,590 "This is when you should do this, 15 00:00:34,590 --> 00:00:37,440 and this is when you should use maybe dictionaries." 16 00:00:37,440 --> 00:00:40,680 The thing is, this takes practice and experience. 17 00:00:40,680 --> 00:00:42,240 So throughout our course, 18 00:00:42,240 --> 00:00:44,130 and then the exercises that we're gonna do, 19 00:00:44,130 --> 00:00:46,200 the projects we're gonna build at the end, 20 00:00:46,200 --> 00:00:48,930 I hope that this idea of understanding 21 00:00:48,930 --> 00:00:52,230 when to use what data structure makes sense to you. 22 00:00:52,230 --> 00:00:54,480 But let's go back to our example. 23 00:00:54,480 --> 00:00:56,310 When should you use a list, 24 00:00:56,310 --> 00:00:59,340 and when should you use a dictionary? 25 00:00:59,340 --> 00:01:01,710 Well, the first thing we have to realize 26 00:01:01,710 --> 00:01:06,180 that a dictionary is not sorted, right? 27 00:01:06,180 --> 00:01:07,680 A list has order. 28 00:01:07,680 --> 00:01:09,720 It has zero, one, indexes, 29 00:01:09,720 --> 00:01:11,010 so on and so forth. 30 00:01:11,010 --> 00:01:13,560 A dictionary has no order. 31 00:01:13,560 --> 00:01:16,560 So maybe if you wanna have a list 32 00:01:16,560 --> 00:01:19,200 of people in line at your shop, 33 00:01:19,200 --> 00:01:21,270 well, you should probably use a list. 34 00:01:21,270 --> 00:01:25,140 But, maybe, you have a user that is playing a game, 35 00:01:25,140 --> 00:01:28,710 and that user has first name, maybe weapons, 36 00:01:28,710 --> 00:01:30,120 maybe an age. 37 00:01:30,120 --> 00:01:31,650 That doesn't have to be ordered 38 00:01:31,650 --> 00:01:34,200 so you might use a dictionary. 39 00:01:34,200 --> 00:01:36,030 Also, you'll notice that dictionaries 40 00:01:36,030 --> 00:01:39,570 hold more information than lists, right? 41 00:01:39,570 --> 00:01:43,920 Because lists only have that single value. 42 00:01:43,920 --> 00:01:46,620 That is, a list has the index, 43 00:01:46,620 --> 00:01:48,960 and then whatever the value is. 44 00:01:48,960 --> 00:01:51,870 In here, we have a dictionary inside of a list, 45 00:01:51,870 --> 00:01:54,600 which is holding a lot of information. 46 00:01:54,600 --> 00:01:58,080 Deep down, a list is simply an index 47 00:01:58,080 --> 00:02:01,290 and some sort of value here, right? 48 00:02:01,290 --> 00:02:04,560 Versus a dictionary that holds a lot more information. 49 00:02:04,560 --> 00:02:05,790 It holds a key. 50 00:02:05,790 --> 00:02:10,597 So this could be the weapons of that user. 51 00:02:10,597 --> 00:02:13,950 "Hello" can be the greeting of that user. 52 00:02:13,950 --> 00:02:17,790 Maybe is_Magic, 53 00:02:17,790 --> 00:02:21,060 is another information about that user. 54 00:02:21,060 --> 00:02:23,460 So we're able to have both keys and values 55 00:02:23,460 --> 00:02:24,293 in a dictionary, 56 00:02:24,293 --> 00:02:26,850 so it holds a lot more information. 57 00:02:26,850 --> 00:02:29,610 And as we learn different data structures, 58 00:02:29,610 --> 00:02:32,100 you'll have these different pros and cons. 59 00:02:32,100 --> 00:02:35,820 You'll start to understand as to when to use what. 60 00:02:35,820 --> 00:02:38,580 All right, there's another developer fundamentals. 61 00:02:38,580 --> 00:02:39,474 I'll see you in the next one. 62 00:02:39,474 --> 00:02:40,307 Bye-bye.