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