0:00:12.930,0:00:16.985 This presentation is delivered by the[br]Stanford Center for Professional Development 0:00:25.540,0:00:30.010 Hi! Welcome, welcome to CS106B,[br]Programming Abstractions. 0:00:30.010,0:00:33.010 (maybe now our mic is on? Oh, that's iteresting.) 0:00:34.000,0:00:37.000 The website was probably the most important[br]thing to take away from here, 0:00:37.000,0:00:38.000 where can you find information about the class 0:00:38.000,0:00:40.000 for the talk today and give some[br]overview and stuff like that, 0:00:40.000,0:00:42.000 but this is the home base for all the material. 0:00:42.000,0:00:45.390 If you managed to get the handouts[br]on the way in, you're golden. 0:00:45.400,0:00:47.160 Otherwise, you can grab them from the website. 0:00:47.160,0:00:49.430 There's a lot of background information,[br]staff information, 0:00:49.430,0:00:51.520 office hours, all sorts of stuff gathered there. 0:00:51.520,0:00:53.120 It's kind of one stop shopping for 0:00:53.120,0:00:56.000 figuring things out about our course. 0:00:56.000,0:00:57.250 Let me tell you what I'm going to do today. 0:00:58.000,0:01:00.480 The first day of, I know a lot of you are shopping 0:01:00.480,0:01:01.480 trying to figure out what's the right fit for you, 0:01:01.480,0:01:04.000 so hopefully today, I'm going to[br]try to give you some information that will 0:01:04.000,0:01:05.000 help you make a good decision. 0:01:05.000,0:01:07.000 I want to tell you a little bit[br]of what our course is about, 0:01:07.000,0:01:09.090 tell you a little bit about the[br]administration and logistics 0:01:09.090,0:01:11.530 most of that stuff is pretty ordinary,[br]and you can read about it. 0:01:11.530,0:01:13.250 Of course, I have to do a little bit of marketing. 0:01:13.250,0:01:14.880 I get to give you my unbiased opinions 0:01:14.880,0:01:17.000 of why this is the absolute[br]best class you could possibly take. 0:01:17.000,0:01:20.000 (I get paid per student, you know.) 0:01:20.000,0:01:22.000 (That's not true.) 0:01:23.000,0:01:24.640 Maybe we'll even have time to check out 0:01:24.640,0:01:27.130 a little bit of the C++ language[br]before we're done and set today. 0:01:27.460,0:01:30.230 (and this needs to go away) 0:01:30.760,0:01:32.590 Let me tell you about CS106. 0:01:33.270,0:01:37.000 CS106 is the introductory programming[br]sequence here at Stanford. 0:01:37.000,0:01:40.000 It's our version of CS1,[br]where you start at the beginning 0:01:40.000,0:01:43.000 when you are interested in[br]learning more about programming. 0:01:43.000,0:01:46.000 We have a two-quarter sequence,[br]A and B, that kind of follow together. 0:01:46.000,0:01:48.170 They're not particularly tightly coupled, which is to say 0:01:48.170,0:01:51.340 if you took A and you took little a break, you could come back to B. 0:01:51.340,0:01:54.160 Or maybe you you actually took a variant of 106a type course 0:01:54.160,0:01:59.000 that is similar at another institution,[br]you're probably in a fine place for starting mid stream. 0:01:59.000,0:02:04.430 We also have an alternate form of B, the CS106X, which is kind of an honors version of that second course. 0:02:04.430,0:02:07.090 So after you've taken that first course and you're feeling really jazzed up, 0:02:07.130,0:02:11.000 there is an alternative more intense way to get through the second course that's 0:02:11.000,0:02:14.000 offered. It's offered this quarter, in fact, so if you're 0:02:14.000,0:02:17.000 thinking actually about that, that is an option for you as well as 0:02:17.000,0:02:18.000 sticking with us. 0:02:18.000,0:02:19.570 What do we do in 106A? 0:02:19.570,0:02:22.230 'A's official title is programming methodology. 0:02:22.870,0:02:25.000 It is starting at the very beginning 0:02:25.000,0:02:26.000 and assuming you have no background in programming. 0:02:26.000,0:02:29.000 It's teaching you how it works, 0:02:29.000,0:02:32.000 what the languages look like, what the syntax is like, what things you need 0:02:32.000,0:02:34.580 to know about how to solve problems using a computer. 0:02:34.580,0:02:38.080 It covers a lot of the fundamentals about logic control 0:02:38.080,0:02:41.000 and in general, I think the big issues of 106A 0:02:41.000,0:02:44.000 have less to do with any particular syntax or 0:02:44.000,0:02:46.000 feature that you learn about a language but 0:02:46.000,0:02:47.880 about how do you solve problems on a computer? 0:02:47.880,0:02:49.000 Somebody gives you a specification of 0:02:49.000,0:02:50.000 you need to write a program that does X, 0:02:50.000,0:02:52.000 and you have to figure out how to make that happen, 0:02:52.000,0:02:54.020 how to break it down, 0:02:54.020,0:02:57.000 how to step through it, how to develop it, how to test it, 0:02:57.000,0:03:00.000 how to iterate on it, how to make changes in it later, 0:03:00.000,0:03:04.000 how to debug it when it's not working well, 0:03:04.000,0:03:06.700 and those things, (I think), transcend any particular language. 0:03:06.700,0:03:09.000 We happen to use the Java programming language in our 106A course 0:03:09.000,0:03:12.790 because it's a great tool for introductory programming, 0:03:13.000,0:03:15.060 but I don't think of that as being really critical. 0:03:15.060,0:03:17.000 In fact, if your introductory course was in some other language, 0:03:17.000,0:03:19.000 some other fairly modern, high level language 0:03:19.000,0:03:20.000 - let's say 0:03:20.000,0:03:24.940 you've learned in Python, C, Scheme, or something other than Java, 0:03:25.000,0:03:28.000 you're probably still fine, 'cause what we're really counting on in B is that you know how to 0:03:28.000,0:03:30.500 program and think like a computer scientist 0:03:30.500,0:03:32.000 know how to solve problems 0:03:32.000,0:03:34.000 Not a lot of the details of the syntax 0:03:34.000,0:03:37.000 are going to be important to us. 0:03:37.000,0:03:40.000 "B" picks up from there, saying okay, you've got some fundamentals. 0:03:40.000,0:03:43.000 Let's start really learning some of the techniques that extend the range of 0:03:43.000,0:03:45.000 problems you can solve. 0:03:45.000,0:03:48.180 We look at recursion, which is one of the fundamental 0:03:48.180,0:03:50.000 problem solving techniques that involves using 0:03:50.000,0:03:52.150 something akin to mathematical induction 0:03:52.150,0:03:54.000 to solve problems in terms of themselves. 0:03:54.000,0:03:56.050 Looking at a lot of algorithms for sorting 0:03:56.050,0:03:57.000 and searching and hashing and doing 0:03:57.000,0:03:58.000 things efficiently, knowing how to compare 0:03:58.000,0:04:01.000 and contrast alternatives in algorithms, 0:04:01.000,0:04:04.040 having some formalisms by which to discuss those things, 0:04:04.040,0:04:08.000 and learn some of the classics that are out there for solving these problems. 0:04:08.000,0:04:11.000 The dynamic data structure, which involves use of pointers to construct things 0:04:11.000,0:04:14.010 like lists, trees and heaps, graphs that 0:04:15.000,0:04:18.000 model certain structures that are very effective in solving certain kinds of 0:04:18.000,0:04:19.570 problems - we'll work through those. 0:04:19.570,0:04:22.000 A large part of our time is spent on this concept 0:04:22.000,0:04:23.900 of data abstraction, which is why 0:04:23.900,0:04:27.000 abstraction shows up as the main word in our title. 0:04:29.020,0:04:31.000 As we start to solve more and more complex problems, 0:04:31.000,0:04:34.000 the code itself can kind of become overwhelming if we don't have some 0:04:34.000,0:04:36.000 technique for managing that complexity. 0:04:36.000,0:04:39.910 One of the big themes for 106B is how we can use this idea of abstraction, 0:04:39.910,0:04:42.000 building something and dealing with the low level details but then 0:04:42.000,0:04:44.000 closing up the box and now treating it as a 0:04:44.000,0:04:47.880 a fixed entity and building on top of that 0:04:47.880,0:04:49.000 and then closing another layer around that 0:04:49.000,0:04:52.000 as a way of working on something, finishing it 0:04:52.000,0:04:53.480 moving on to some larger piece without 0:04:53.480,0:04:55.710 having those details clouding our way. 0:04:55.710,0:04:59.000 It's a very powerful technique for solving larger problems. 0:04:59.000,0:05:00.000 In that context, 0:05:00.000,0:05:04.000 we'll be looking at some of the classic data structures, 0:05:04.000,0:05:06.000 like stacks, queues, lists, maps and sets 0:05:06.000,0:05:08.000 as part of the domain for that. 0:05:08.000,0:05:11.000 We do happen to use the C++ programming language, 0:05:11.000,0:05:14.000 but this is not a C++ course, so to be clear about what you're 0:05:14.000,0:05:16.000 getting versus what you wanted, 0:05:16.000,0:05:17.800 we use Java here (as a vehicle) [a]. 0:05:17.800,0:05:20.000 We use C++ here (as a vehicle) [b]. 0:05:20.000,0:05:22.700 We happen to think there are good reasons 0:05:22.700,0:05:24.390 to actually expose you to both languages. 0:05:24.390,0:05:25.960 (ill talk about that more later) 0:05:26.000,0:05:29.000 In particular, C++ is an enormous language. 0:05:29.000,0:05:30.990 It has a lot of language features as well as 0:05:30.990,0:05:32.000 a very very large standard library, 0:05:32.000,0:05:33.950 and our goal is not at all 0:05:33.950,0:05:36.000 to turn you into this industrial strength 0:05:36.000,0:05:37.000 knows every detail about quirks 0:05:37.000,0:05:38.000 and ins and outs of C++. 0:05:38.910,0:05:41.000 There is another class, 193D, that 0:05:41.000,0:05:43.000 does attempt to do that. 0:05:43.000,0:05:45.000 In fact, if that's what you're looking for, 0:05:45.000,0:05:47.000 I suggest you take a look at that. 0:05:47.000,0:05:47.970 What we're here about is learning 0:05:47.970,0:05:50.000 advanced programming techniques 0:05:50.000,0:05:52.020 taking those foundations and building on them 0:05:52.020,0:05:53.990 to be able to solve more interesting problems. 0:05:53.990,0:05:54.990 We happen to use C++. 0:05:54.990,0:05:56.000 You will learn some C++, but I almost 0:05:56.000,0:05:58.000 consider it a side effect 0:05:58.000,0:06:00.000 of what we're doing. 0:06:03.950,0:06:06.000 Just a little note on placement 0:06:06.000,0:06:09.040 if you're kind of in between and not really sure, 0:06:09.040,0:06:13.000 these are the very very rough guidelines, but they give you 0:06:13.000,0:06:17.000 some idea of which groups gravitate where. 0:06:17.000,0:06:18.000 If you are new to programming or 0:06:18.000,0:06:20.000 you're not confident about your background 0:06:20.000,0:06:22.030 - maybe it was a long time ago, if it was self-taught. 0:06:22.030,0:06:23.000 Maybe it was in a course that you 0:06:23.000,0:06:25.090 felt was not as good as it could have been 0:06:26.000,0:06:27.000 or you didn't do as well in it, 0:06:27.000,0:06:29.000 106A is a great place to start. 0:06:29.000,0:06:31.000 It actually is by all accounts 0:06:31.000,0:06:34.000 an extremely popular course at Stanford 0:06:34.000,0:06:36.090 and services a wide group of people 0:06:36.090,0:06:39.000 with a little bit of background or no background. 0:06:39.000,0:06:42.000 All very well getting them up to speed. 0:06:42.000,0:06:45.000 If you do have something like a solid first course experience 0:06:45.000,0:06:47.000 So you did well in 106A or took a similar course 0:06:47.000,0:06:48.970 or perhaps even self-taught your way 0:06:48.970,0:06:53.010 through a lot of those materials and you feel ready to move on, 106B. 0:06:53.010,0:06:55.000 An AP course in high school - 0:06:55.000,0:06:59.000 the A curriculum is a pretty good match for 106A here 0:06:59.000,0:07:00.000 so you're in a great place. 0:07:00.000,0:07:01.980 If you have this and you've got a little bit more going for you 0:07:01.980,0:07:04.000 or you're super enthused and you have a 0:07:04.000,0:07:06.000 lot of extra time this quarter 0:07:06.000,0:07:09.000 and want to sit in the company of only 0:07:09.000,0:07:11.000 the uber geeks, 0:07:11.000,0:07:13.000 you can check out 106X, 0:07:13.000,0:07:15.000 Which is a varient of B 0:07:15.000,0:07:17.000 which covers the same kind of topical ground 0:07:17.000,0:07:18.000 but at a different level intensity. 0:07:18.000,0:07:20.000 It amps up a little bit of the assignments, 0:07:20.010,0:07:22.960 covers some of the material that we won't get a chance to cover, 0:07:23.930,0:07:25.000 and 0:07:25.000,0:07:27.000 just pushes the envelope a little bit there. 0:07:27.000,0:07:30.000 If you have experience comparable to the first two courses 0:07:30.000,0:07:31.000 - you've 0:07:31.940,0:07:34.000 done all the things that we're talking about here in B 0:07:34.000,0:07:35.000 and you feel comfortable with it, 0:07:35.000,0:07:37.000 it might be that the right place for you is 107, 0:07:37.000,0:07:39.990 which is the third course in our sequence. 0:07:39.990,0:07:42.890 And just skipping over our 106 courses entirely 0:07:43.920,0:07:45.970 That's somewhat rare, 0:07:45.970,0:07:47.000 so if you're thinking about that, I encourage you to 0:07:47.000,0:07:49.010 talk to me a little bit to make sure 0:07:49.010,0:07:51.000 that you won't be missing out on something important 0:07:51.000,0:07:54.000 in doing so, but certainly there are students who have 0:07:55.000,0:07:56.970 for example, the AP CS A-B curriculum 0:07:56.970,0:07:59.000 is pretty comparable to this course here, 0:07:59.000,0:08:02.510 and so depending on how high quality the course you had was, 0:08:02.510,0:08:04.000 it might very well be that 107 is right. 0:08:04.000,0:08:06.000 In some situations where that course was a little bit lacking, 0:08:06.000,0:08:09.050 there may be some ways that we can help reinforce 0:08:09.050,0:08:10.970 the things you've learned and build a stronger foundation 0:08:10.970,0:08:14.030 to move forward from rather than jumping ahead. 0:08:15.000,0:08:18.000 Any questions about placement? 0:08:20.000,0:08:22.000 That sort of thing. 0:08:22.000,0:08:23.650 (Am I talking too fast?) 0:08:23.830,0:08:27.000 (good, I like that, you can sit in the front whenever you want) 0:08:27.980,0:08:30.000 Lets talk philosophy 0:08:30.000,0:08:34.000 I think there's a statement about what we officially are, 0:08:34.000,0:08:38.000 but I also think that 106 has a long tradition at Stanford 0:08:38.000,0:08:40.000 that comes back from student motivation. 0:08:40.860,0:08:43.000 I was here as an undergrad in the 80s 0:08:43.000,0:08:45.000 when 106s were just getting off the ground, 0:08:45.000,0:08:47.000 and at the time, Stanford only had a graduate 0:08:47.000,0:08:49.000 computer science department, and 0:08:49.000,0:08:52.000 the belief in the nsaid period for computer science 0:08:52.000,0:08:53.960 was you should get a math degree, 0:08:53.960,0:08:55.000 and only then would you be mature enough 0:08:55.000,0:08:57.000 to learn about computers. 0:08:57.000,0:08:59.510 You weren't ready as a freshman. 0:09:00.000,0:09:02.000 was a groundswell of Stanford students 0:09:02.000,0:09:04.950 were like said 'We want access to programming. We want it.' 0:09:04.950,0:09:06.000 That made it happen. 0:09:06.000,0:09:09.000 and so part of the 106 was a really careful thought about what the 106's 0:09:09.000,0:09:12.000 would be a Stanford and what we want them to be 0:09:12.000,0:09:13.960 in a philosophical sense. 0:09:13.960,0:09:16.210 One is that we welcome students of[br]all majors and backgrounds. 0:09:16.210,0:09:19.000 We don't have a version of 106 that's for the majors or 0:09:19.000,0:09:21.090 potential majors and a version that's for the non-majors 0:09:21.090,0:09:24.000 and a version that's terminal (you just want to get out of here). 0:09:24.000,0:09:27.000 We really think that we can bring you all together 0:09:27.000,0:09:31.000 and design a course that addresses this wide 0:09:31.000,0:09:32.990 disparate group but still service that well. 0:09:33.000,0:09:36.000 Partly because you don't know that[br]you are a CS major yet. 0:09:36.000,0:09:39.000 I'm going to turn you into a CS major.[br]That's my plan. 0:09:39.000,0:09:42.000 At Stanford right,[br]not having to make that choice about a major 0:09:42.000,0:09:44.000 until into junior year is a gift 0:09:45.000,0:09:49.000 to allow you to explore[br]and to feel unencumbered by having made some 0:09:49.000,0:09:51.000 decision when you applied,[br]and I think it's important to respect that 0:09:51.000,0:09:53.970 gift that Stanford gave you by[br]trying to make sure our courses don't 0:09:54.010,0:09:56.000 funnel you one way or[br]the other before you figure it out. 0:09:57.000,0:09:58.000 You are all welcome here. 0:09:58.000,0:10:00.000 We try to make it accessible to everyone. 0:10:00.000,0:10:03.000 We have certain plans [br]that help to make that work. 0:10:03.000,0:10:07.000 We do try to provide a solid,[br]practical foundation in programming 0:10:07.000,0:10:11.000 that given our placement at Stanford[br]in the middle of the Silicon Valley, 0:10:11.000,0:10:14.000 there's kind of a strong influence[br]for us to try to produce students 0:10:14.000,0:10:16.000 who from the get go are 0:10:16.000,0:10:18.000 learning things that are actually quite useful 0:10:18.000,0:10:19.000 outside of the classroom 0:10:19.000,0:10:22.000 rather than teach you a very academic 0:10:22.000,0:10:24.000 interesting and mathematical[br]language like Scheme 0:10:24.000,0:10:27.000 that is very 0:10:27.000,0:10:29.040 rarely used outside of the classroom. 0:10:29.040,0:10:31.000 We're trying to teach you on the tools, 0:10:31.000,0:10:34.000 languages and techniques that are actually in active practice. 0:10:34.000,0:10:38.000 We are using Java and C++,[br]two of the most prevalent languages 0:10:38.000,0:10:40.070 out in the industry, and[br]we do a lot of learn by doing. 0:10:40.070,0:10:42.000 We assign challenging, full-fledged[br]programs that you work on and you build 0:10:42.000,0:10:46.650 and so it's not designed to be[br]academic exercises. 0:10:47.000,0:10:54.040 You really are building skills[br]that have applicability here and[br]outside of the class. 0:10:55.000,0:10:58.000 We have a big emphasis on 0:10:58.000,0:10:59.050 truth and beauty. 0:11:01.000,0:11:04.010 This is one area in which some of the[br]substitute courses 0:11:04.010,0:11:07.000 that we have seen students come in with[br]have a little bit more trouble with 0:11:07.000,0:11:10.000 is tackling this part of it,[br]which is that there are 0:11:10.000,0:11:12.000 a lot of ways you can get a program to work. 0:11:12.000,0:11:14.000 Many of them are not pretty. 0:11:14.000,0:11:17.000 You can just type and type and type and[br](Monkies shakespeare, whatnot) 0:11:17.000,0:11:19.000 eventually, you can get your way to[br]something that works. 0:11:19.020,0:11:23.010 Well +1, -1, what if I move it here[br]what if I copy and paste this there 0:11:23.010,0:11:25.020 what if I change that name? 0:11:25.020,0:11:27.000 That, in the end,[br]might produce a program that from 0:11:27.000,0:11:28.000 external appearances works. 0:11:28.000,0:11:33.720 It plays hangman, or whatever was the[br]desired goal, but that internally is a mess. 0:11:34.000,0:11:36.980 It's not well structured.[br]It's not well commented. 0:11:36.980,0:11:40.000 It's not easy to understand.[br]It wouldn't be easy to modify. 0:11:40.000,0:11:42.000 It makes a lot of decision that are really sub optimal, 0:11:42.000,0:11:48.000 and we're really interested in producing[br]engineers 0:11:48.000,0:11:52.000 that have a good sense of design and [br]really appreciate what is involved in writing 0:11:52.000,0:11:56.000 good, well designed software, [br]not just working software. 0:11:56.000,0:11:57.000 We will be giving you feedback on 0:11:57.000,0:12:00.000 both the correctness and[br]functionality of your code 0:12:01.740,0:12:05.000 as important if not more so, 0:12:05.000,0:12:08.000 also on how well we think you did[br]at designing and implementing and 0:12:08.000,0:12:11.030 writing code that is of[br]a high quality. 0:12:11.030,0:12:12.030 We make a big deal out of that. 0:12:12.030,0:12:14.000 That is something that is not[br]always shared by other classes, 0:12:14.000,0:12:16.510 and so in particular, someone who is self-taught 0:12:16.510,0:12:20.000 or in a class that didn't emphasize this[br]might feel that there's a little bit of a gap there[br] 0:12:20.000,0:12:21.000 we need to make[br]that up with you, 0:12:21.000,0:12:23.490 and we can work with you. 0:12:23.490,0:12:26.000 This is a very individual thing,[br]because there's not one good example of 0:12:26.000,0:12:28.000 the perfect style 0:12:28.000,0:12:31.000 in the way that a lot of different people 0:12:31.000,0:12:34.000 express themselves in written communication 0:12:34.000,0:12:34.990 very well but differently. 0:12:34.990,0:12:36.500 The same thing is true about programs. 0:12:36.500,0:12:40.000 You will have your own unique style,[br]and we'll work with you to coach you on getting your 0:12:40.000,0:12:44.010 style to come through and[br]be beautiful and elegant. 0:12:46.000,0:12:50.000 This kind of comes back to point 1[br]we make heavy use of undergraduate 0:12:50.000,0:12:53.000 section leaders as mentors in this program. 0:12:53.000,0:12:59.000 We have a staff of 50 or so, undergraduates[br]who work with the 106A, B and X courses as a team. 0:12:59.000,0:13:02.000 They have specific responsibilities with their section, 0:13:02.000,0:13:06.000 so mentoring and grading and meeting with 0:13:06.000,0:13:09.000 sectionees to give individualized[br]feedback on their programs 0:13:09.000,0:13:10.000 as well as 0:13:10.000,0:13:13.760 answering questions, solving problems,[br]being in the lair 30 plus hours. 0:13:13.760,0:13:16.000 They're most weekday nights about six hours 0:13:16.000,0:13:17.000 and often 0:13:17.000,0:13:20.000 well past the midnight when it's supposed to cut off[br]solving people's problems, 0:13:20.000,0:13:23.000 helping when you get stuck,[br]answering your questions 0:13:23.000,0:13:26.000 and making sure you're all[br]making forward progress. 0:13:26.000,0:13:29.000 That comes back to point 1. 0:13:29.000,0:13:31.000 In some universities where they're[br]choosing to use their intro course as a weeder, 0:13:31.000,0:13:33.690 it's like let's separate the wheat[br]from the chaff early 0:13:33.690,0:13:35.000 and let's make it really hard and not 0:13:35.000,0:13:38.000 provide too much support,[br]and that way we'll make sure we get the people we want. 0:13:38.000,0:13:41.000 We have a different idea. 0:13:41.000,0:13:42.000 Programming is hard,[br]especially when you're learning. 0:13:42.000,0:13:46.000 There's a lot of complexity to master,[br]and there are a lot of details that can 0:13:46.000,0:13:49.000 interfere with moving forward,[br]and we don't want you 0:13:49.000,0:13:52.000 to get stuck on something that[br]we can very easily resolve for you. 0:13:52.000,0:13:55.980 So make sure you have accessible[br]staff members in person, in email 0:13:56.000,0:13:58.000 and regularly in section 0:13:58.000,0:14:04.000 to help get through the roadblocks[br]and keep you moving forward. 0:14:04.000,0:14:08.000 What do you need to know to be[br]sure you're going to do well? 0:14:08.000,0:14:12.000 There are people who think to[br]be a good computer programmer, 0:14:12.000,0:14:16.000 you need to be good at math,[br]logic, and drinking Jolt. 0:14:16.000,0:14:22.010 I think it it comes down to[br]personality traits than any 0:14:22.020,0:14:24.500 particular technique or skill. 0:14:24.500,0:14:26.000 You don't need to be good at math. 0:14:26.000,0:14:29.000 How much calculus and trig shows up in this? 0:14:29.000,0:14:32.000 Not very much.[br]A little bit of logic - that helps. 0:14:32.000,0:14:36.990 I think it comes down to traits like[br]curiosity and determination and hard work. 0:14:37.000,0:14:37.980 Starting early, 0:14:37.980,0:14:41.000 asking questions[br]when you don't understand something, 0:14:41.000,0:14:43.510 trying to solve the problem by logic[br]I think is very valuable 0:14:43.510,0:14:45.000 Knowing how to think,[br]how to make steps 0:14:45.000,0:14:47.960 why this case works and[br]why that case doesn't work 0:14:47.970,0:14:51.720 thinking about that logically 0:14:51.755,0:14:55.735 (well its like the movie theater now you guys will all go to sleep)[br](oh look they came back) [lights] 0:14:57.000,0:15:01.120 I think these are the skills[br]that serve you the best in this class 0:15:01.120,0:15:04.010 And probably[br]every other thing you'd want to tackle. 0:15:04.010,0:15:08.000 There is a lot of time that will be spent[br]to master this. 0:15:08.000,0:15:11.110 I can talk about programming all I want,[br](bla, bla, bla) 0:15:11.110,0:15:13.000 and you can go oh, yeah, that makes a[br]lot of sense. 0:15:13.000,0:15:16.000 But when you go to write it yourself,[br]it's a very different experience. 0:15:16.000,0:15:19.960 That's where being[br]focused and staying on task 0:15:20.000,0:15:25.040 and getting help when you get stuck[br]can help you move through that 0:15:25.080,0:15:28.080 (Any questions about 106?)[br](What we do,) 0:15:28.090,0:15:32.070 (Why we do what we do.)[br](You guys have nothing to say) 0:15:32.070,0:15:34.070 (your afraid of having your)[br](voice recorded aren't you?) 0:15:34.070,0:15:39.020 (For all time your parents will come and see)[br](that you come to class you can prove it) 0:15:40.010,0:15:44.000 My unbiased opinion about why 106B is[br]one of the best courses at Stanford 0:15:44.000,0:15:47.000 (of course I am not at all unbiased) 0:15:47.000,0:15:50.000 it's going to be 0:15:50.000,0:15:53.000 totally obvious when I say these things,[br]and you guys are going to have to go 0:15:53.000,0:15:54.960 along with it.[br]I'm actually a 0:15:55.000,0:15:58.000 geek, really big time,[br]and I happen to love programming. 0:15:58.000,0:16:00.000 That's why I'm a perfect fit for teaching this class. 0:16:00.000,0:16:01.490 I have taught 106 B or X more than I've taught 0:16:01.490,0:16:04.000 any other class that I've taught at[br]Stanford in my time here, 0:16:04.000,0:16:06.330 and that's because each quarter[br]when we're setting the schedule, 0:16:06.330,0:16:08.000 I say give me B.[br]Give me X. 0:16:08.000,0:16:09.000 Because there's no better course to teach. 0:16:09.000,0:16:12.000 Programming is just awesome. 0:16:12.000,0:16:15.000 If you love programming,[br]I think there's almost nothing better to do in the world. 0:16:15.000,0:16:17.510 You have this task.[br]You're trying to get there. 0:16:17.510,0:16:19.170 You're coding.[br]You're making stuff happen. 0:16:19.170,0:16:21.940 You're testing, iterating you're running.[br]You see stuff. 0:16:21.950,0:16:25.020 You build things.[br]When you're done, you know it works. 0:16:25.020,0:16:28.000 That feeling when you write a paper and go[br]"was it good enough?" 0:16:28.000,0:16:30.000 "well I dont know"[br]you could probably go bolster up this argument 0:16:30.000,0:16:32.280 When a program works,[br]you know it. 0:16:32.290,0:16:36.000 It does what it's supposed to do.[br]It gets the right answer. 0:16:36.000,0:16:38.020 It plays the game.[br]It solves the problem. 0:16:38.020,0:16:42.000 Finding and fixing that last bug[br]- although debugging is one of the last 0:16:42.000,0:16:45.000 aspects of programming a lot of people bemoan about;[br]I happen to think that if you 0:16:45.000,0:16:49.000 are driven by debugging,[br]that is one of the most awesome detective stories 0:16:49.000,0:16:53.980 Trying to figure out why it happened when you did this,[br]when you moved that why it went this way 0:16:54.000,0:16:57.000 and what this effect caused[br]and understanding once you make the fix how it fixes it 0:16:57.000,0:16:58.930 staying up late. 0:16:58.930,0:17:02.000 I have stayed up late more nights debugging[br]than anything else in my life, 0:17:02.000,0:17:04.000 and I'm not sad about that at all. 0:17:04.000,0:17:08.000 That means I'm in the right place.[br]Hopefully, some of that resonates with you. 0:17:09.020,0:17:12.000 If that sounds really awful to you, 0:17:12.000,0:17:14.000 hopefully we can change your mind a bit. 0:17:14.000,0:17:18.000 That is, in some ways,[br]part of what drives computer science is this 0:17:18.000,0:17:21.000 wanting to build things.[br]We are engineers. 0:17:21.000,0:17:24.000 We have this computer science name.[br]Just remember 0:17:24.000,0:17:29.000 - any subject[br]that's name is something science is not a science. 0:17:29.000,0:17:31.950 We're trying to puff ourselves up a bit. 0:17:32.000,0:17:34.000 We do a lot of really great work, 0:17:34.000,0:17:37.000 and there are a lot of neat scientific[br]principles and theories that 0:17:37.000,0:17:38.000 underpin what we do, 0:17:38.000,0:17:41.000 but in the end,[br]I think what drives a lot of us is just 0:17:41.000,0:17:44.990 the engineering[br]- building stuff that is really neat. 0:17:45.010,0:17:49.000 It kind of reminds me that my[br]husband's a mechanical engineer, and so I 0:17:49.000,0:17:52.220 used to be envious, because[br]he would always build things. 0:17:52.220,0:17:57.000 M.E.'s always toting foam core around the campus[br]on their paper bicycles and stuff, and it's like 0:17:57.000,0:18:00.000 they build all these things.[br]Now, having watched all the things he builds, it's like 0:18:00.000,0:18:02.000 mechan-e is really hard.[br]You need all these materials. 0:18:02.000,0:18:05.320 You need all these tools.[br]You need this mill, you need this lathe 0:18:05.320,0:18:07.430 You need the hotmelt glue gun,[br]which burns the heck out of your fingers 0:18:07.430,0:18:08.160 anytime you touch it. 0:18:08.160,0:18:10.660 To build anything. 0:18:10.930,0:18:12.560 In computer science, you don't need anything. 0:18:12.560,0:18:14.000 You need a compiler and you need a computer. 0:18:14.000,0:18:15.030 You need your thought. 0:18:15.030,0:18:18.000 It's like an abstraction we built out of our brains. 0:18:18.000,0:18:20.000 There's this relatively small set of things[br]that you need to master 0:18:20.000,0:18:23.990 and then you can combine them in these very[br]sophisticated and interesting ways to solve all sorts of problems. 0:18:24.000,0:18:26.000 There's a very low overhead, 0:18:26.000,0:18:30.000 and the range of things you can attack[br]with the same set of skills is huge. 0:18:30.000,0:18:36.020 Every domain out there can benefit from somebody[br]applying computers in a useful way without fail. 0:18:36.020,0:18:39.080 There's all sorts of problems[br]where technology is part of the answer 0:18:39.080,0:18:41.000 not the only answer,[br]but certainly something that you can take 0:18:41.000,0:18:44.000 whatever interest you have[br]and combine it with computer science 0:18:44.000,0:18:47.000 and construct something cool. 0:18:47.000,0:18:51.000 I happen to think that what[br]happens in the second course is amazing. 0:18:51.000,0:18:54.000 The first course,[br]you've kind of got to get up to speed, 0:18:54.000,0:18:57.000 and there's a lot of basic material[br]that needs to get covered, 0:18:57.000,0:19:00.000 and it does set you on the right path,[br]but in this course, we really 0:19:00.000,0:19:04.000 get to blossom beyond the basic things. 0:19:04.000,0:19:07.000 There are a bunch of really neat[br]and very accessible techniques 0:19:07.000,0:19:11.000 that a second quarter student can understand[br]and master and do really cool things with. 0:19:11.000,0:19:14.050 You can learn how to do something like[br]create a database 0:19:14.050,0:19:17.000 that has a million entries 0:19:17.000,0:19:20.900 and then ask for somebody by name and be able to[br]instantaneously be able to find that name. 0:19:20.900,0:19:23.000 Not by looking through a million[br]entries trying to find that name 0:19:23.000,0:19:26.000 Change the size of it.[br]Make it ten million, a billion, and still be able to 0:19:26.000,0:19:29.000 provide that kind of instantaneous access.[br]You're going to learn how to do that. 0:19:29.000,0:19:32.000 The technique is not some superhuman thing. 0:19:32.000,0:19:34.000 It's something very clever, admittedly, 0:19:34.000,0:19:36.000 but it's very accessible. 0:19:36.000,0:19:40.000 Taking that same million thing and[br]learning how to sort it efficiently. 0:19:40.000,0:19:42.000 What if you happen to know things about how it's[br]almost sorted but just a little but out of sorts? 0:19:42.000,0:19:47.000 Are there ways you can actually make it[br]even faster to put it in sorted order? 0:19:47.000,0:19:50.000 There are techniques, for example,[br]like recursion that take on problems that 0:19:50.000,0:19:53.000 you might not have any idea when you[br]first look at the problem how to solve 0:19:53.000,0:19:57.450 but once you've got your head around recursion,[br]you can look at that and say 0:19:57.450,0:20:01.030 "I can write a five line function[br]that will solve that problem." 0:20:01.030,0:20:05.669 This is the kind of power we're going to[br]give you with our quarter together. 0:20:05.669,0:20:10.000 There's a bunch of really amazing[br]theoretical and algorithmic stuff to explore. 0:20:10.000,0:20:14.000 That really increases the kind of things[br]you can do with programming. 0:20:14.000,0:20:17.840 I'm particularly fond of it. 0:20:18.010,0:20:20.010 [br]As always, I think 0:20:20.010,0:20:23.000 the section leading program that we have[br]created and built at Stanford 0:20:23.000,0:20:27.030 Is a huge part of what makes our 106[br]courses so successful, 0:20:27.030,0:20:28.000 and so 0:20:28.000,0:20:32.990 having somebody who's individually[br]working with you, meeting with you weekly 0:20:34.000,0:20:37.000 and giving you that feedback that's[br]individualized and personalized for you 0:20:37.000,0:20:41.000 and helping you get through the rough spots[br]is a lot of what helps to make the experience 0:20:41.000,0:20:44.000 very fun and very personal, too. 0:20:44.000,0:20:48.910 What section leaders do I have here?[br]Any? Not a one. 0:20:49.000,0:20:52.000 Those fabulous section leaders.[br]Where are they again? section leaders? 0:20:52.000,0:20:54.030 Did i say they were fabulous?[br]I meant. laughs Uhh no. 0:20:54.030,0:20:57.000 We haven't yet identified who's going[br]to what class, so maybe they're all 0:20:57.000,0:21:00.851 thinking they're going to go somewhere else,[br]but they're wrong. We'll get some. 0:21:03.940,0:21:05.000 106B - great. You agree? 0:21:05.000,0:21:07.000 Have I convinced you? 0:21:07.000,0:21:10.000 Is anybody still hesitant? 0:21:13.000,0:21:16.000 Is it a lot of work?[br]Oh, no. laughs 0:21:16.000,0:21:19.000 I just exude it. Osmosis. you learn it. 0:21:21.980,0:21:24.920 Let me tell you a little bit about logistics. 0:21:26.000,0:21:30.000 There are some random things you may want[br]to know about how the class works. 0:21:30.000,0:21:34.000 That the first day I am supposed to do.[br] 0:21:34.000,0:21:38.360 We're going to meet here[br]Monday, Wednesday, Friday 2:15 to 3:05. 0:21:38.360,0:21:41.920 In glorious download[br][ FIXME ] audiotorium 0:21:41.930,0:21:45.060 It looks like we almost[br]exactly fit in our classroom, 0:21:45.060,0:21:47.790 which means we're all[br]going to be very friendly and cozy. 0:21:47.790,0:21:51.131 The lectures are being taped[br]and are available online, 0:21:51.131,0:21:56.540 and so that has the neat side effect that[br]you can watch them and review them later.[br] 0:21:56.540,0:21:58.000 You could watch them lots of times. 0:21:58.000,0:22:01.000 It also means that if it were pouring rain and[br]you were sitting at home in your bunny slippers, 0:22:01.000,0:22:04.000 you could just say hey,[br]I'm not going outside and you could 0:22:04.000,0:22:06.000 turn on your computer and watch. 0:22:06.000,0:22:09.000 I'm a big fan of having you come in person.[br]That's because I don't want to 0:22:09.000,0:22:11.000 lecture to an empty room. 0:22:11.000,0:22:14.000 I also think there's an interaction there 0:22:14.190,0:22:19.000 that I'm fond of, and so I hope that you[br]will make every effort to attend in person[br]as much as you can. 0:22:22.010,0:22:26.990 It is nice to know that if you do miss a lecture or you 0:22:27.000,0:22:29.940 get caught up with something, you'll have a chance to review it later online. 0:22:30.000,0:22:32.000 We will have sections that will meet once a week, 0:22:32.000,0:22:34.970 just like 106A. 0:22:35.000,0:22:38.000 The section leader who meets with you is the one 0:22:38.000,0:22:41.000 who will be grading your programs and sitting with you[br]and doing the conferences. 0:22:41.000,0:22:45.940 What you need to do to get yourself[br]into a section - there are several section times listed. 0:22:45.960,0:22:47.960 They are totally bogus. (so ignore that) 0:22:51.000,0:22:53.000 What you do is you go to the online[br]- if you go to our class webpage, there's a link that tells 0:22:53.000,0:22:56.000 you how to sign up for a section.[br]The section times aren't up right now, but they will go up tomorrow, 0:22:56.000,0:22:58.000 and they'll be up through the weekend.[br]You go in and put in your preferences 0:22:58.000,0:23:03.930 about what times fit your schedule or not,[br]and there's this big computer program 0:23:04.000,0:23:08.790 that does this magic matching that gets[br]everyone into a section that fits their schedule. 0:23:08.880,0:23:11.880 That will happen early next week. 0:23:14.000,0:23:18.850 The signups will be up from Thursday at 5:00[br]until Sunday at 5:00. 0:23:18.960,0:23:22.000 If by Sunday at 5:00[br]you've got your schedule fixed, then you're fine. 0:23:22.000,0:23:25.000 If you happen to change after Sunday at 5:00 and after the assignments have been made, 0:23:25.000,0:23:27.000 at that point, it's a little bit harder. 0:23:27.000,0:23:28.000 We can make adjustments, but it's on a very case-by-case basis.[br] 0:23:28.000,0:23:31.000 Where we have space and where we can accomodate you. 0:23:31.000,0:23:33.000 The best thing you can do 0:23:33.000,0:23:36.000 is by Sunday at 5:00 have a pretty firm idea[br]about what you can and can't do. 0:23:36.000,0:23:37.000 There's a list of preferences,[br]so maybe what you can do 0:23:37.000,0:23:40.000 is pick things that you know will work no matter 0:23:40.000,0:23:41.000 what happens. 0:23:41.000,0:23:44.000 for antyhing that is variable if you just dont offer things that you know might 0:23:44.000,0:23:44.840 go away 0:23:44.980,0:23:49.930 so there is a list of 20 times and you say I can make these 5 0:23:49.930,0:23:52.390 And that way you wont get yourselves in trouble 0:23:52.390,0:23:54.910 in things that might change. 0:23:55.000,0:23:59.000 The workload - everybody wants[br]to know how much work.[br] 0:23:59.000,0:24:02.000 It's a five-unit class, and[br]it's a five unit engineering class. 0:24:04.000,0:24:06.000 You get your five units worth, 0:24:06.000,0:24:09.990 I would say, so don't worry about that. I won't shortchange you. 0:24:11.010,0:24:15.000 We have programming assignments not quite weekly.[br]I think there are seven of them across 0:24:15.000,0:24:18.960 ten weeks, so you can calculate it out.[br]It's about a week and a third 0:24:19.000,0:24:20.000 for any particular one. 0:24:20.000,0:24:22.030 The students report 0:24:22.030,0:24:25.000 that it's about a 15-20 hour project, each of them. 0:24:25.000,0:24:28.000 Some people get them done in less than that.[br]Some people take a little bit more. 0:24:28.000,0:24:33.030 I would say that's kind of the[br]mode range for what people are reporting. 0:24:33.030,0:24:37.000 I do think that of the people who report less,[br]some of those are 0:24:37.000,0:24:41.000 people who are naturally gifted,[br]but a lot of it has to do with your habits 0:24:41.000,0:24:43.000 about how you work and[br]how you make progress, so 0:24:43.000,0:24:46.000 if you are one of the people who feels [br]you might be more likely to be on the other 0:24:46.000,0:24:49.000 end, you can come and talk to[br]me and I can give you some suggestions. 0:24:49.000,0:24:55.630 Choosing to work in the lair where the[br]helpers are on duty has really positive effects 0:24:55.630,0:24:58.000 effects in that when you get stuck,[br]you have easy access to 0:24:58.000,0:24:59.000 somebody helping you work through it 0:24:59.000,0:25:02.000 rather than spending an hour or two[br]fighting something that turns out to be 0:25:02.000,0:25:05.000 simple but required knowing something[br]that you didn't yet know. 0:25:05.000,0:25:10.250 I'm a big fan of learning things yourself.[br]There's also a time when a well-placed 0:25:10.590,0:25:14.000 bit of advice from somebody[br]can save you a lot of time. 0:25:15.000,0:25:22.160 There will be a midterm and a final exam.[br]They'll both be in class, open book, open notes. 0:25:22.160,0:25:24.010 The midterm is actually technically out of class. 0:25:24.010,0:25:28.870 have it at night because we need more than[br]a 50-minute period to get any coverage of that. 0:25:28.870,0:25:31.067 Our final exam is scheduled in[br]our university-scheduled slot. 0:25:31.067,0:25:36.000 Sadly, that is at the very[br]end of the exam week, 0:25:36.000,0:25:37.980 but that's when the registrar put us,[br]and that's when we need to go. 0:25:38.030,0:25:44.010 You may want to take a look at that before[br]you head off to Acapulco for spring break. 0:25:44.010,0:25:45.010 you need to make sure[br]you are here for the exam. 0:25:45.010,0:25:48.980 Male audience: Is the course leader available online? 0:25:48.980,0:25:53.060 Unfortunately, our publisher will not allow me to distribute the course leader electronically. 0:25:54.000,0:25:57.000 They're not exactly very in the modern age on this. 0:26:00.080,0:26:02.000 I'm working on it is the truth. 0:26:02.000,0:26:06.040 By the time the world sees this, hopefully, we will have some other strategy. 0:26:06.040,0:26:08.800 We currently are in negotiations. 0:26:08.880,0:26:11.000 The nice thing about the course reader is that[br]we have not changed it in the last year. 0:26:11.000,0:26:14.000 If you know somebody who has[br]it from last fall or last spring. 0:26:14.000,0:26:18.000 it has some minor edits and typos that were fixed, 0:26:18.000,0:26:20.000 so if you can get a hold of an old one, it's good. 0:26:20.000,0:26:23.100 We are getting no royalties on it. 0:26:23.100,0:26:26.950 We're publishing it at production cost, so where it 0:26:26.950,0:26:31.970 would have been a $100.00 textbook[br]had it been bound and all snappy. 0:26:32.000,0:26:36.000 you're just getting what it cost to photocopy and bind the thing, and Eric and 0:26:36.070,0:26:39.980 I are eating ramen. 0:26:40.000,0:26:42.000 It's hopefully cheap enough that 0:26:42.000,0:26:44.000 you can find a way to get to one 0:26:44.000,0:26:47.500 or get an old one without it being[br]too much of an obstacle. 0:26:49.000,0:26:52.800 People in general find the course[br]reader to be an asset. 0:26:52.800,0:26:54.060 We do say it's required reading. 0:26:54.060,0:26:58.530 It does have a lot of material that's very[br]useful in understanding the course. 0:26:58.610,0:27:02.000 There are other people who[br]don't make as big a use of it, 0:27:02.000,0:27:05.000 but there are some sections that[br]are really very valuable 0:27:05.000,0:27:08.020 and other ones that may be more[br]or less depending on your learning style. 0:27:08.020,0:27:11.800 Whether you appreciate more of a chance to[br]read background material and more examples. 0:27:11.800,0:27:15.000 There's also a lot of good sample problems in it 0:27:15.000,0:27:18.600 and review questions in it that help to test your understanding. 0:27:22.000,0:27:23.000 You know, it's tricky, because the university[br]in general discourages you from giving 0:27:26.000,0:27:29.000 alternate exams because of 0:27:29.000,0:27:33.000 - you can imagine the issues[br]of having an exam that has been 0:27:33.000,0:27:35.000 seen by some number of students before[br]some other number of students take it. 0:27:35.000,0:27:38.180 Even though we're all bound by the honor code,[br]it does create a situation where 0:27:38.180,0:27:39.480 there is some temptation. 0:27:39.480,0:27:43.240 It's possible it could be a little bit[br]early without a lot of gap, but I 0:27:43.240,0:27:46.030 don't think early enough to make alot[br]of help is the truth. 0:27:46.030,0:27:49.000 We can talk about it.[br]The current plan is not, I would say. 0:28:03.011,0:28:07.994 A little bit about compilers.[br]We use C++. 0:28:07.994,0:28:09.050 and we also use 0:28:09.050,0:28:11.480 some custom libraries, which limits us[br]to distributing on a certain number of platforms 0:28:11.480,0:28:15.070 we've had a good chance to[br]test on and work with[br] 0:28:15.070,0:28:18.960 The compilers that we have[br]support for is X Code on the Macintosh. 0:28:18.960,0:28:22.040 xcode is apples free developer tools so 0:28:22.060,0:28:25.050 Anybody who has Mac OS 10 can freely[br]download that, and install our libraries. 0:28:25.050,0:28:29.000 We're using Microsoft's[br]Visual Studio Version 2005 on Windows, 0:28:29.000,0:28:32.000 we have an arrangement with Microsoft[br]where they have distributed the software 0:28:32.000,0:28:35.930 free of charge to students, so if you would[br]like to install that on your own Windows computer, 0:28:36.000,0:28:38.000 we'll give you some handouts on Friday that tell you 0:28:38.000,0:28:43.510 what to do to get the compiler[br]and get it installed on your systems. 0:28:43.570,0:28:48.020 Our cluster computers in the dorms[br]and the libraries and 0:28:48.050,0:28:53.340 the lair both operating systems have both[br]the compilers and libraries installed, 0:28:53.600,0:28:57.000 so if you work in a cluster,[br]you don't have to do anything special. 0:28:57.000,0:29:04.000 You just walk up and it's got the[br]stuff ready to go. 0:29:07.000,0:29:11.000 I'm a Mac person. I've been a Mac[br]person forever. 0:29:11.000,0:29:13.000 I can't get over the fact that you go to[br]the start menu to shut the machine down. 0:29:13.000,0:29:17.000 That makes Windows impossible for me to use. 0:29:19.000,0:29:24.970 I would say campus wide, there are more[br]Windows machines than Macs on campus, 0:29:25.010,0:29:29.000 So if you want to take a popular vote,[br]You could do that. 0:29:29.000,0:29:33.980 If you want to be on the side of the Mac bigot,[br]you can come and be with me in X Code. 0:29:44.790,0:29:49.000 I've got ten minutes to tell you a little[br]bit about C++. 0:29:49.000,0:29:54.040 That is the next journey that we're[br]going to go on together. 0:29:54.040,0:29:57.000 The first question is:[br]Why are we doing this to you? 0:29:57.000,0:30:02.000 I just got comfortable with Java and now[br]you're telling me to throw away my Java[br]and start over. 0:30:02.850,0:30:07.880 Let's generate a little bit of love for C++. 0:30:08.000,0:30:10.990 The advantages of early multilingualism. 0:30:10.990,0:30:14.000 - I have two small children at home[br]that are two and four, 0:30:14.000,0:30:18.000 and I read a lot about bilingualism. 0:30:19.000,0:30:22.000 It's very clear that for natural[br]languages, when you're 0:30:22.000,0:30:25.000 acquiring a language at those[br]young ages that that is the 0:30:25.000,0:30:27.840 best time to introduce a second[br]or third language. 0:30:27.970,0:30:30.920 Where you are building the[br]pathways and the neurons. 0:30:32.000,0:30:35.000 It's been looked at in terms of programming[br]languages as well, 0:30:35.000,0:30:38.000 that when you are learning a programming[br]language, there are certain kind 0:30:38.000,0:30:41.000 of ruts your mind gets into about[br]the way a language is 0:30:41.000,0:30:45.000 that is based on your early experiences.[br] 0:30:45.000,0:30:48.940 If you spend a very long time working [br]only in one language, those ruts get deeper, 0:30:49.000,0:30:52.000 and you have a certain way of thinking.[br]You're a little bit stuck in that paradigm and its approach. 0:30:52.000,0:30:55.680 What's easy to do in that language,[br]what's hard to do in that language 0:30:55.830,0:30:59.980 tends to make a stronger impression on[br]you in a way that makes it harder as you 0:31:00.000,0:31:04.000 grow and explore the languages to kind of get[br]out of those ruts and shake yourself out of it. 0:31:04.000,0:31:07.930 There's been some pretty good evidence[br]that somewhere between one 0:31:08.000,0:31:10.960 and two is a good time to think[br]about branching out 0:31:10.960,0:31:14.000 and starting to think about different [br]ways of doing stuff and seeing some 0:31:14.000,0:31:20.230 different syntax and some different ideas[br]to help build in the flexibility from[br] 0:31:20.230,0:31:26.450 an early age in your career to buy you[br]some strength later. 0:31:26.520,0:31:31.000 That's part of what we're doing.[br]Another part of it is actually that a lot of our upper division 0:31:31.000,0:31:36.010 courses rely on a knowledge of[br]C and C++, that family of languages, 0:31:36.010,0:31:39.000 and that the longer we postpone it,[br]the more painful it becomes. 0:31:39.000,0:31:43.950 In the later courses where you're learning[br]about compilers or graphics or networking, 0:31:44.000,0:31:48.000 they don't have the time in those classes to stop and teach you C or C++. 0:31:48.000,0:31:50.930 They need you to know C++ to get the work done. 0:31:51.000,0:31:54.940 Moving the foundation into a programming class 0:31:54.940,0:31:57.000 seems to make the most sense in the context of our curriculum. 0:31:57.000,0:32:00.000 We do switch you over here. 0:32:00.000,0:32:04.000 The good news is that it's not as big a change as it might sound at first glance. 0:32:04.000,0:32:07.000 Java is actually highly derivative of C++ for a start. 0:32:07.000,0:32:10.000 They're kind of cousins in the scheme of language design. 0:32:10.000,0:32:12.000 0:32:12.000,0:32:14.000 They have a lot of syntax. 0:32:14.000,0:32:18.110 How much C++ do you need to know to start?[br]The answer is zero. 0:32:18.110,0:32:21.000 You don't even need to know what the word means. 0:32:21.000,0:32:22.000 In fact, 0:32:22.000,0:32:25.000 you actually probably know a surprising[br]amount about C++ just by virtue of what 0:32:25.000,0:32:28.000 you already know just translated a little bit. 0:32:28.000,0:32:32.000 Things like the four loop of Java or the way you declare variables or 0:32:32.000,0:32:35.000 the way parameters are passed into a function 0:32:35.000,0:32:39.000 is exhibited in Java in very much the same way it is in C++. 0:32:39.000,0:32:42.000 There are a bunch of things you already know and you don't even realize. 0:32:42.000,0:32:45.470 It is not assumed that you know C or C++.[br] 0:32:45.590,0:32:49.000 If you happen to already know those things,[br]you're ahead of the game. 0:32:50.080,0:32:52.000 If you have not, 0:32:52.000,0:32:54.000 then not to worry. 0:32:54.000,0:32:57.000 How much C++ are you going to learn? 0:32:58.000,0:33:00.000 We will spend the first 0:33:00.000,0:33:02.000 three or four lectures 0:33:02.000,0:33:05.000 just talking about how things get expressed differently in C++ 0:33:05.000,0:33:07.000 and mostly talking about 0:33:07.000,0:33:12.000 the differences in the libraries.[br]The syntax itself is quite similar. 0:33:12.000,0:33:15.000 Some of the more extensive changes have to do with how the C++ 0:33:15.000,0:33:17.810 string is operated on versus the Java string. 0:33:17.810,0:33:20.000 How you do file input and output reading 0:33:20.000,0:33:23.000 in C++ is a little bit different than the way it's done in Java. 0:33:23.000,0:33:26.000 We'll spend some time saying here are some things you know how to express in one language. 0:33:26.000,0:33:29.000 We're going to teach you how to express them in another language. 0:33:29.000,0:33:31.000 It's just mapping from your previous vocabulary onto a new one. 0:33:32.000,0:33:35.000 Along the way, we will actually introduce some of the C++ 0:33:35.000,0:33:38.000 features that we need to support our pedagogical goals. 0:33:38.000,0:33:42.000 We'll be talking about how classes get designed in C++.[br]We'll see how to use classes. 0:33:44.000,0:33:45.000 those classes, We'll see how to define 0:33:45.000,0:33:49.000 and we'll look at things like templates, which is the C++ 0:33:49.000,0:33:52.000 construct for doing generics that you seen in Java - how you can build 0:33:52.000,0:33:56.000 containers that are type unspecific and things like that. We 0:33:56.000,0:34:01.000 will learn a little bit of some of the fancier features of C++ like 0:34:01.000,0:34:02.000 the pass by reference parameter, 0:34:02.000,0:34:05.000 but there's actually a very large amount of C++ that's just off the 0:34:05.000,0:34:07.000 table for us. 0:34:07.000,0:34:11.000 We will not make extensive use of the standard template library or 0:34:11.000,0:34:13.000 the 0:34:13.000,0:34:17.000 fancier features of 'static' and 'const' and a bunch of key words that 0:34:17.000,0:34:20.000 mean nothing to you and should mean nothing to you. 0:34:20.000,0:34:23.000 You will learn enough to have reading familiarity with 0:34:23.000,0:34:26.000 C++ and to be able to express yourself quite well in the subset we're using, but 0:34:26.000,0:34:29.000 it is a subset of C++ that you're being exposed 0:34:32.000,0:34:35.000 to. 0:34:35.000,0:34:39.000 If you find yourself really wanting to 0:34:39.000,0:34:42.000 master C++, 0:34:46.000,0:34:48.000 we are offering 0:34:48.000,0:34:52.000 CS106L. CS106L is a lab companion course that is 0:34:52.000,0:34:55.000 open to students enrolled in 106B or 106X. 0:34:55.000,0:34:57.000 It meets twice a week. 0:34:57.000,0:34:59.000 It's actually on Monday and Wednesday late afternoon. 0:34:59.000,0:35:02.000 It's 4:15 in Hewlett 0:35:02.000,0:35:04.000 103. It's being taught by a veteran section leader 0:35:04.000,0:35:09.000 who is very well versed in C++ and who of his own 0:35:09.000,0:35:13.000 volition volunteered and created this course because 0:35:13.000,0:35:16.000 he himself was a little frustrated as a prior 106 student 0:35:16.000,0:35:19.000 in wanting to get at some of those C++ things that weren't 0:35:19.000,0:35:20.000 fitting with our goals. 0:35:20.000,0:35:23.000 It is a place where you can 0:35:23.000,0:35:26.000 get more exposure to standard C++, do some exercises that help 0:35:26.000,0:35:29.000 you to test out those things and see how those things are expressed and get another 0:35:29.000,0:35:32.000 unit. It's a pass/fail lab course. 0:35:32.000,0:35:35.000 You can also just attend or grab the materials if you just want to look at 0:35:35.000,0:35:35.000 them. 0:35:35.000,0:35:38.000 It's a great way to 0:35:41.000,0:35:43.000 broaden that knowledge of C++ beyond what's 0:35:43.000,0:35:48.000 useful for us in terms of our goals. I'm going 0:35:48.000,0:35:53.000 to ask you some questions, because I don't get to do all the talking. 0:35:53.000,0:35:56.000 How much C++ do you need to know? Some of you may know nothing about it, 0:35:56.000,0:35:58.000 and that is perfectly fine. Some of you probably know something about it or at least 0:35:58.000,0:36:02.000 have heard something about it. I'm going to have you guys tell me 0:36:02.000,0:36:04.000 what it 0:36:05.000,0:36:09.000 is that people tell you about C++ that 0:36:09.000,0:36:13.000 makes you either excited to learn it or frightened to learn it or 0:36:13.000,0:36:15.000 interested in how it works. It's 0:36:15.000,0:36:17.000 what Java is based off of. It is what Java is 0:36:17.000,0:36:20.000 based 0:36:20.000,0:36:24.000 off of. That should be a little reassuring 0:36:24.000,0:36:28.000 that there is a syntax there that got adopted with some minor 0:36:28.000,0:36:31.000 changes. It should feel 0:36:31.000,0:36:34.000 more familiar than different when you look at it. 0:36:34.000,0:36:37.000 It was very strongly influenced by a generation of 0:36:37.000,0:36:39.000 programmers who C++ was their native language who designed the 0:36:39.000,0:36:42.000 Java language. That's a good thing to know. What else do you know 0:36:42.000,0:36:47.000 about C++? 0:36:47.000,0:36:49.000 It's extended 0:36:50.000,0:36:53.000 C. Yes. It's extended C. Here's how it fits in the spectrum. 0:36:53.000,0:36:56.000 C is kind of a 1970s creation. C++ is a 0:36:56.000,0:36:58.000 decade later. 0:36:58.000,0:37:01.000 C is the language which it is based on. It is an extended C. It's 0:37:01.000,0:37:05.000 called a superset. Everything that compiles and works in C 0:37:05.000,0:37:07.000 still exists in C++, but then they added a bunch of features. 0:37:07.000,0:37:10.000 Not only did they add a bunch of features but they tried to fix some of the things 0:37:10.000,0:37:13.000 about C++ by replacing existing things. For example, there's some 0:37:13.000,0:37:17.000 string handling in C that's kind of very primitive. They added a string 0:37:17.000,0:37:18.000 object 0:37:18.000,0:37:22.000 with much cleaner handling and safer semantics into the C++, but they kind of 0:37:22.000,0:37:23.000 left the old one around. 0:37:23.000,0:37:26.000 Some parts of C++ feel a little strange 0:37:26.000,0:37:32.000 because of this history to it - the legacy of incorporating everything C was plus the stuff 0:37:32.000,0:37:35.000 means at times there's a little bit of weirdness there. It also means 0:37:35.000,0:37:39.000 that the language, as a result, is very large. 0:37:40.000,0:37:44.000 C's 0:37:44.000,0:37:47.000 type safety 0:37:47.000,0:37:52.000 and runtime features were extended by what 0:37:52.000,0:37:56.000 got 0:37:56.000,0:38:00.000 added in C++. A friend of mine told me that [inaudible]. That's a 0:38:07.000,0:38:08.000 good thing 0:38:08.000,0:38:09.000 to know. 0:38:09.000,0:38:13.000 C++ might be a little bit more dangerous than Java. 0:38:13.000,0:38:17.000 That is true. Java is very 0:38:17.000,0:38:21.000 concerned with 0:38:21.000,0:38:25.000 safety, in particular since Java was designed for web 0:38:25.000,0:38:27.000 delivery of content. It was very important that the program have 0:38:27.000,0:38:29.000 very constrained 0:38:29.000,0:38:31.000 features on what it can and can't do, 0:38:31.000,0:38:35.000 and so as a result, Java tends to be very parental. When you 0:38:35.000,0:38:38.000 forget to initialize a variable or forget to 0:38:38.000,0:38:39.000 return from a function, 0:38:39.000,0:38:41.000 Java's 0:38:41.000,0:38:45.000 very aggressive about saying hey, you've got to fix this. C++ is a little 0:38:46.000,0:38:47.000 less 0:38:47.000,0:38:51.000 parental. Here's the overly protective mom, helicopter mom, 0:38:51.000,0:38:54.000 the ones who stand. That's Java. Java's making sure - oh, are you okay, 0:38:54.000,0:38:57.000 sweetie? Let me stand here 0:38:57.000,0:39:01.000 in case you fall. C++ is crack mom. She's like yeah, I'm over 0:39:01.000,0:39:05.000 here with my friends. Don't play 0:39:05.000,0:39:06.000 with 0:39:06.000,0:39:08.000 the kitchen knives. 0:39:08.000,0:39:11.000 It's a professional's tool, 0:39:11.000,0:39:13.000 and professionals don't want to feel encumbered. There are certain things they want 0:39:13.000,0:39:16.000 to do that require some of this 0:39:16.000,0:39:19.000 low-level access, and safety usually comes at a cost. 0:39:19.000,0:39:23.000 Any sort of feature where the language is double-checking for you is taking time and 0:39:23.000,0:39:26.000 efficiency. There's a cost associated with that. Every time you want 0:39:26.000,0:39:28.000 to get something out of an array, 0:39:28.000,0:39:30.000 it's checked to make sure that that number was 0:39:30.000,0:39:34.000 not off either end. Every array access costs you a little bit more. 0:39:34.000,0:39:35.000 C++ says 0:39:35.000,0:39:38.000 I'm not going to charge everybody that penalty. If you actually have the bad sense 0:39:38.000,0:39:43.000 to write a program that does those things, you deserve to be punished. 0:39:43.000,0:39:47.000 As a result, you will at some 0:39:47.000,0:39:49.000 point in this quarter get to experience some of that firsthand. Some of 0:39:49.000,0:39:53.000 it is a growth experience. Some 0:39:53.000,0:39:56.000 of it can be frustrating. It is part of what 0:39:56.000,0:39:58.000 professional tools often look like. They are making these tradeoffs 0:39:58.000,0:40:01.000 of efficiency over safety that 0:40:01.000,0:40:04.000 put more of the work back on you as the programmer to be a little more attentive on 0:40:04.000,0:40:05.000 those things. 0:40:05.000,0:40:09.000 You can write programs that crash in very spectacular ways 0:40:09.000,0:40:14.000 much more interesting and varied and dangerous than the kind of things you can do 0:40:18.000,0:40:21.000 in Java. Good to know. You want to 0:40:21.000,0:40:29.000 use 0:40:29.000,0:40:29.000 pointers. 0:40:29.000,0:40:31.000 You're going to get to use pointers. 0:40:31.000,0:40:35.000 Pointers are really neat, and they're also very challenging. Pointers are these 0:40:35.000,0:40:37.000 ways of building these very flexible and amazing 0:40:37.000,0:40:40.000 data structures - the kind of things that we're going to try to build. At some 0:40:40.000,0:40:43.000 point, they are going to be the only way to achieve those things well, so building 0:40:43.000,0:40:46.000 these things called trees, graphs and lists rely on understanding 0:40:46.000,0:40:49.000 a mastery of the pointer type. The pointer type is complicated, and it's part of 0:40:49.000,0:40:51.000 that danger thing, which is 0:40:51.000,0:40:53.000 having access to 0:40:53.000,0:40:57.000 rearranging memory by virtue of addresses opens up a lot of 0:40:57.000,0:40:59.000 opportunity for there to be mistakes. 0:40:59.000,0:41:02.000 Mistakes can be made in the passive voice 0:41:02.000,0:41:06.000 that have consequences. You'll get to experience firsthand what that's like. 0:41:06.000,0:41:09.000 There's joy in it, because getting it right is awesome, and there are things that you can 0:41:09.000,0:41:12.000 achieve that are really extraordinary with pointers, but 0:41:12.000,0:41:13.000 when it's not working, 0:41:13.000,0:41:17.000 it can 0:41:17.000,0:41:18.000 be frustrating. You're getting a 0:41:18.000,0:41:22.000 little 0:41:22.000,0:41:25.000 bit of both. It turns out C++ does not have a graphics system built 0:41:25.000,0:41:26.000 into it. 0:41:26.000,0:41:29.000 Java is actually distinguished from previous 0:41:29.000,0:41:32.000 languages. Java tries to solve all problems. Traditionally, a 0:41:32.000,0:41:33.000 programming language tends to have a set 0:41:33.000,0:41:34.000 of libraries that have 0:41:34.000,0:41:38.000 facilities for data management, reading and writing files and sometimes some 0:41:38.000,0:41:42.000 networking, but they don't tend to actually solve application layer problems. That 0:41:42.000,0:41:46.000 tended to be a different piece of technology. The Mac 0:41:46.000,0:41:49.000 OS might offer a graphics library that was written in C++, but C++ 0:41:49.000,0:41:50.000 the language 0:41:50.000,0:41:53.000 didn't have a windowing system or graphics system. 0:41:53.000,0:41:55.000 C++ does not have those features 0:41:55.000,0:41:56.000 itself, 0:41:56.000,0:41:58.000 so any C++ compiler 0:41:58.000,0:42:02.000 you get comes with these basic things about handling files and managing these types of 0:42:02.000,0:42:05.000 data structures, but it does not come a priori with a bunch of graphics routines. 0:42:05.000,0:42:07.000 That said, 0:42:07.000,0:42:09.000 Windows and Mac and Linux and all these things have graphics routines that are 0:42:09.000,0:42:12.000 written in C++, but they're all different. To say what are they 0:42:12.000,0:42:13.000 like 0:42:13.000,0:42:15.000 relative to Java? They're all different relative 0:42:15.000,0:42:16.000 to Java. It's not standardized. 0:42:18.000,0:42:21.000 There's a wide variety of them out there, and 0:42:21.000,0:42:24.000 they tend to have a lot of very impressive and different solved 0:42:24.000,0:42:27.000 problems, because C++ has a longer history than Java that a lot 0:42:27.000,0:42:30.000 of problems have been solved in C++ that are available to you, 0:42:30.000,0:42:32.000 too. There's a lot of existing code 0:42:32.000,0:42:36.000 other than what you might think is standard. 0:42:38.000,0:42:42.000 I 0:42:42.000,0:42:43.000 will 0:42:43.000,0:42:47.000 see you on Friday, and we'll be seeing some C++. If you have 0:42:47.000,0:42:58.000 questions about your situation, come and talk to me now.