1 00:00:00,000 --> 00:00:00,032 2 00:00:00,032 --> 00:00:01,740 SPEAKER 1: No longer in the weeks to come 3 00:00:01,740 --> 00:00:05,190 are we going to be focusing on the command line alone. 4 00:00:05,190 --> 00:00:08,280 DAVID J MALAN: So this has been an evolution, I think, in the classroom. 5 00:00:08,280 --> 00:00:10,410 Increasingly, in recent years, have we tried 6 00:00:10,410 --> 00:00:13,380 to-- have I tried to keep pace with certain trends in industry 7 00:00:13,380 --> 00:00:14,730 and programming paradigms. 8 00:00:14,730 --> 00:00:18,390 And as MVC became more and more popular in Python, 9 00:00:18,390 --> 00:00:21,420 and PHP, and other languages, still, did we weave it into the course. 10 00:00:21,420 --> 00:00:23,902 So we weren't just using raw PHP years ago, 11 00:00:23,902 --> 00:00:25,860 and we're not just using Python out of the box. 12 00:00:25,860 --> 00:00:28,651 We're actually standing on the shoulders of very popular frameworks 13 00:00:28,651 --> 00:00:30,780 that actually do solve very well-defined problems. 14 00:00:30,780 --> 00:00:34,860 And the reality is to take away some of those abstractions and some 15 00:00:34,860 --> 00:00:39,870 of that structure, we would be doing students, 16 00:00:39,870 --> 00:00:41,970 I think, a disservice to not show them how they're 17 00:00:41,970 --> 00:00:43,720 going to do things in the real world. 18 00:00:43,720 --> 00:00:45,630 And so we instead use something in Python 19 00:00:45,630 --> 00:00:48,090 like Flask, which is a very popular micro framework-- 20 00:00:48,090 --> 00:00:51,180 micro framework in that it's not the bloated framework that some 21 00:00:51,180 --> 00:00:52,900 of the larger things are. 22 00:00:52,900 --> 00:00:56,070 But it allows us to get certain jobs done like routing, for instance, 23 00:00:56,070 --> 00:00:59,280 and other certain functionality like parsing the [? HTTP ?] requests that 24 00:00:59,280 --> 00:00:59,779 come in. 25 00:00:59,779 --> 00:01:00,750 And so that's nice. 26 00:01:00,750 --> 00:01:03,750 DOUG LLOYD: Were you concerned about using a micro framework, as opposed 27 00:01:03,750 --> 00:01:05,370 to one of the more full fledged-- 28 00:01:05,370 --> 00:01:08,119 that's not really the right term, but one of the larger frameworks 29 00:01:08,119 --> 00:01:09,720 that might have some more features? 30 00:01:09,720 --> 00:01:11,320 DAVID J MALAN: No, quite the opposite. 31 00:01:11,320 --> 00:01:14,580 I mean, I either wanted to give them nothing which felt extreme, 32 00:01:14,580 --> 00:01:19,567 or the least amount of structure possible to get real work done. 33 00:01:19,567 --> 00:01:21,900 And so by contrast, we could have something like Django, 34 00:01:21,900 --> 00:01:25,066 but you just get so much more with that, and you get the whole kitchen sink. 35 00:01:25,066 --> 00:01:29,069 And I think you lose the appreciation of what you have to build 36 00:01:29,069 --> 00:01:30,860 and what the framework is building for you. 37 00:01:30,860 --> 00:01:32,776 I think when you're new to the language itself 38 00:01:32,776 --> 00:01:35,310 as most students were with Python, you might not necessarily 39 00:01:35,310 --> 00:01:37,892 grasp the distinction between what is Python the language, 40 00:01:37,892 --> 00:01:39,600 and what is Django the framework in terms 41 00:01:39,600 --> 00:01:41,430 of what functions are available to you. 42 00:01:41,430 --> 00:01:44,225 So Flask seemed to strike the right balance 43 00:01:44,225 --> 00:01:47,100 DOUG LLOYD: I mean it was definitely an overhaul of [? P SET 7. ?] We 44 00:01:47,100 --> 00:01:49,980 used to be that all of the functionalities of P SET 7, 45 00:01:49,980 --> 00:01:54,930 were mock e-trade like website where we have students buying, and selling, 46 00:01:54,930 --> 00:01:55,740 and quoting stocks. 47 00:01:55,740 --> 00:01:56,580 And all of those-- 48 00:01:56,580 --> 00:01:59,330 all that functionality used to be the individual files of students 49 00:01:59,330 --> 00:02:02,730 that write [? by.php ?] and implement all of the functionality required 50 00:02:02,730 --> 00:02:08,520 to purchase a stock in its own file, but in Python, we 51 00:02:08,520 --> 00:02:11,190 had to kind of reinvent the way the assignment was set up. 52 00:02:11,190 --> 00:02:11,940 DAVID J MALAN: It simplified it a bit. 53 00:02:11,940 --> 00:02:13,410 I think it kept all of the controller code 54 00:02:13,410 --> 00:02:16,326 that students were writing in one place, which I think was compelling. 55 00:02:16,326 --> 00:02:20,940 And what's been important to me too, is like we realize that many students-- 56 00:02:20,940 --> 00:02:23,250 most students perhaps who do web based final projects, 57 00:02:23,250 --> 00:02:26,310 are going to almost always base their own project 58 00:02:26,310 --> 00:02:29,952 on [? P SET 7's ?] distribution code or [? P SET 8, ?] and I really did want 59 00:02:29,952 --> 00:02:32,910 the code were giving students and the blanks they were filling in to be 60 00:02:32,910 --> 00:02:36,640 represented of how they should start their own projects once they graduate 61 00:02:36,640 --> 00:02:37,620 from CS50. 62 00:02:37,620 --> 00:02:41,850 And so I mean we really obsessed over every line of code and the distribution 63 00:02:41,850 --> 00:02:43,950 code, making sure that we can justify everything. 64 00:02:43,950 --> 00:02:45,991 And making sure that it really was representative 65 00:02:45,991 --> 00:02:48,720 of how you might start a general web application that 66 00:02:48,720 --> 00:02:50,490 has both the back end and a front end. 67 00:02:50,490 --> 00:02:52,948 DOUG LLOYD: But what's also interesting about [? P SET 7 ?] 68 00:02:52,948 --> 00:02:55,622 is that because we had a problem set in Python before, 69 00:02:55,622 --> 00:02:58,080 we were actually able to take off some more of the training 70 00:02:58,080 --> 00:02:59,871 than we would have otherwise been able to-- 71 00:02:59,871 --> 00:03:04,279 We always had to leave on in the PHP iteration of this problem set. 72 00:03:04,279 --> 00:03:05,820 DAVID J MALAN: That was nice I think. 73 00:03:05,820 --> 00:03:07,611 I think the price we pay is something to co 74 00:03:07,611 --> 00:03:11,100 mingle our discussion and lecture of Python itself 75 00:03:11,100 --> 00:03:13,760 with Python at the command line in Python in a web context. 76 00:03:13,760 --> 00:03:14,468 DOUG LLOYD: True. 77 00:03:14,468 --> 00:03:17,400 DAVID J MALAN: And so this web programming in Python 78 00:03:17,400 --> 00:03:18,870 could potentially stand on its own. 79 00:03:18,870 --> 00:03:20,370 We didn't have that additional week. 80 00:03:20,370 --> 00:03:23,430 And so we really focused the last portion of this particular week 81 00:03:23,430 --> 00:03:26,440 on the web application of the same, but I think that's OK. 82 00:03:26,440 --> 00:03:28,320 Because at the end of the day, we already 83 00:03:28,320 --> 00:03:30,600 have from the previous week what-- 84 00:03:30,600 --> 00:03:33,600 from previous weeks like what the internet is, what's HTTP and TCP. 85 00:03:33,600 --> 00:03:35,309 So we're already layering and layering. 86 00:03:35,309 --> 00:03:38,100 So to start with Python, and then end with a bit of web programming 87 00:03:38,100 --> 00:03:40,230 in Python, I feel like it's the right natural progression. 88 00:03:40,230 --> 00:03:42,090 And then you go one step further of course a week later, 89 00:03:42,090 --> 00:03:43,506 with JavaScript and the front end. 90 00:03:43,506 --> 00:03:47,240 And so it kind of works, though we could certainly-- 91 00:03:47,240 --> 00:03:51,000 it would certainly be nice to have even more time for every detail. 92 00:03:51,000 --> 00:03:54,485 DOUG LLOYD: If only we had 30 more weeks. 93 00:03:54,485 --> 00:03:54,985