Lecture 1 | Programming Abstractions (Stanford)
-
0:13 - 0:17This presentation is delivered by the
Stanford Center for Professional Development -
0:26 - 0:30Hi! Welcome, welcome to CS106B,
Programming Abstractions. -
0:30 - 0:33(maybe now our mic is on? Oh, that's iteresting.)
-
0:34 - 0:37The website was probably the most important
thing to take away from here, -
0:37 - 0:38where can you find information about the class
-
0:38 - 0:40for the talk today and give some
overview and stuff like that, -
0:40 - 0:42but this is the home base for all the material.
-
0:42 - 0:45If you managed to get the handouts
on the way in, you're golden. -
0:45 - 0:47Otherwise, you can grab them from the website.
-
0:47 - 0:49There's a lot of background information,
staff information, -
0:49 - 0:52office hours, all sorts of stuff gathered there.
-
0:52 - 0:53It's kind of one stop shopping for
-
0:53 - 0:56figuring things out about our course.
-
0:56 - 0:57Let me tell you what I'm going to do today.
-
0:58 - 1:00The first day of, I know a lot of you are shopping
-
1:00 - 1:01trying to figure out what's the right fit for you,
-
1:01 - 1:04so hopefully today, I'm going to
try to give you some information that will -
1:04 - 1:05help you make a good decision.
-
1:05 - 1:07I want to tell you a little bit
of what our course is about, -
1:07 - 1:09tell you a little bit about the
administration and logistics -
1:09 - 1:12most of that stuff is pretty ordinary,
and you can read about it. -
1:12 - 1:13Of course, I have to do a little bit of marketing.
-
1:13 - 1:15I get to give you my unbiased opinions
-
1:15 - 1:17of why this is the absolute
best class you could possibly take. -
1:17 - 1:20(I get paid per student, you know.)
-
1:20 - 1:22(That's not true.)
-
1:23 - 1:25Maybe we'll even have time to check out
-
1:25 - 1:27a little bit of the C++ language
before we're done and set today. -
1:27 - 1:30(and this needs to go away)
-
1:31 - 1:33Let me tell you about CS106.
-
1:33 - 1:37CS106 is the introductory programming
sequence here at Stanford. -
1:37 - 1:40It's our version of CS1,
where you start at the beginning -
1:40 - 1:43when you are interested in
learning more about programming. -
1:43 - 1:46We have a two-quarter sequence,
A and B, that kind of follow together. -
1:46 - 1:48They're not particularly tightly coupled, which is to say
-
1:48 - 1:51if you took A and you took little a break, you could come back to B.
-
1:51 - 1:54Or maybe you you actually took a variant of 106a type course
-
1:54 - 1:59that is similar at another institution,
you're probably in a fine place for starting mid stream. -
1:59 - 2:04We also have an alternate form of B, the CS106X, which is kind of an honors version of that second course.
-
2:04 - 2:07So after you've taken that first course and you're feeling really jazzed up,
-
2:07 - 2:11there is an alternative more intense way to get through the second course that's
-
2:11 - 2:14offered. It's offered this quarter, in fact, so if you're
-
2:14 - 2:17thinking actually about that, that is an option for you as well as
-
2:17 - 2:18sticking with us.
-
2:18 - 2:20What do we do in 106A?
-
2:20 - 2:22'A's official title is programming methodology.
-
2:23 - 2:25It is starting at the very beginning
-
2:25 - 2:26and assuming you have no background in programming.
-
2:26 - 2:29It's teaching you how it works,
-
2:29 - 2:32what the languages look like, what the syntax is like, what things you need
-
2:32 - 2:35to know about how to solve problems using a computer.
-
2:35 - 2:38It covers a lot of the fundamentals about logic control
-
2:38 - 2:41and in general, I think the big issues of 106A
-
2:41 - 2:44have less to do with any particular syntax or
-
2:44 - 2:46feature that you learn about a language but
-
2:46 - 2:48about how do you solve problems on a computer?
-
2:48 - 2:49Somebody gives you a specification of
-
2:49 - 2:50you need to write a program that does X,
-
2:50 - 2:52and you have to figure out how to make that happen,
-
2:52 - 2:54how to break it down,
-
2:54 - 2:57how to step through it, how to develop it, how to test it,
-
2:57 - 3:00how to iterate on it, how to make changes in it later,
-
3:00 - 3:04how to debug it when it's not working well,
-
3:04 - 3:07and those things, (I think), transcend any particular language.
-
3:07 - 3:09We happen to use the Java programming language in our 106A course
-
3:09 - 3:13because it's a great tool for introductory programming,
-
3:13 - 3:15but I don't think of that as being really critical.
-
3:15 - 3:17In fact, if your introductory course was in some other language,
-
3:17 - 3:19some other fairly modern, high level language
-
3:19 - 3:20- let's say
-
3:20 - 3:25you've learned in Python, C, Scheme, or something other than Java,
-
3:25 - 3:28you're probably still fine, 'cause what we're really counting on in B is that you know how to
-
3:28 - 3:30program and think like a computer scientist
-
3:30 - 3:32know how to solve problems
-
3:32 - 3:34Not a lot of the details of the syntax
-
3:34 - 3:37are going to be important to us.
-
3:37 - 3:40"B" picks up from there, saying okay, you've got some fundamentals.
-
3:40 - 3:43Let's start really learning some of the techniques that extend the range of
-
3:43 - 3:45problems you can solve.
-
3:45 - 3:48We look at recursion, which is one of the fundamental
-
3:48 - 3:50problem solving techniques that involves using
-
3:50 - 3:52something akin to mathematical induction
-
3:52 - 3:54to solve problems in terms of themselves.
-
3:54 - 3:56Looking at a lot of algorithms for sorting
-
3:56 - 3:57and searching and hashing and doing
-
3:57 - 3:58things efficiently, knowing how to compare
-
3:58 - 4:01and contrast alternatives in algorithms,
-
4:01 - 4:04having some formalisms by which to discuss those things,
-
4:04 - 4:08and learn some of the classics that are out there for solving these problems.
-
4:08 - 4:11The dynamic data structure, which involves use of pointers to construct things
-
4:11 - 4:14like lists, trees and heaps, graphs that
-
4:15 - 4:18model certain structures that are very effective in solving certain kinds of
-
4:18 - 4:20problems - we'll work through those.
-
4:20 - 4:22A large part of our time is spent on this concept
-
4:22 - 4:24of data abstraction, which is why
-
4:24 - 4:27abstraction shows up as the main word in our title.
-
4:29 - 4:31As we start to solve more and more complex problems,
-
4:31 - 4:34the code itself can kind of become overwhelming if we don't have some
-
4:34 - 4:36technique for managing that complexity.
-
4:36 - 4:40One of the big themes for 106B is how we can use this idea of abstraction,
-
4:40 - 4:42building something and dealing with the low level details but then
-
4:42 - 4:44closing up the box and now treating it as a
-
4:44 - 4:48a fixed entity and building on top of that
-
4:48 - 4:49and then closing another layer around that
-
4:49 - 4:52as a way of working on something, finishing it
-
4:52 - 4:53moving on to some larger piece without
-
4:53 - 4:56having those details clouding our way.
-
4:56 - 4:59It's a very powerful technique for solving larger problems.
-
4:59 - 5:00In that context,
-
5:00 - 5:04we'll be looking at some of the classic data structures,
-
5:04 - 5:06like stacks, queues, lists, maps and sets
-
5:06 - 5:08as part of the domain for that.
-
5:08 - 5:11We do happen to use the C++ programming language,
-
5:11 - 5:14but this is not a C++ course, so to be clear about what you're
-
5:14 - 5:16getting versus what you wanted,
-
5:16 - 5:18we use Java here (as a vehicle) [a].
-
5:18 - 5:20We use C++ here (as a vehicle) [b].
-
5:20 - 5:23We happen to think there are good reasons
-
5:23 - 5:24to actually expose you to both languages.
-
5:24 - 5:26(ill talk about that more later)
-
5:26 - 5:29In particular, C++ is an enormous language.
-
5:29 - 5:31It has a lot of language features as well as
-
5:31 - 5:32a very very large standard library,
-
5:32 - 5:34and our goal is not at all
-
5:34 - 5:36to turn you into this industrial strength
-
5:36 - 5:37knows every detail about quirks
-
5:37 - 5:38and ins and outs of C++.
-
5:39 - 5:41There is another class, 193D, that
-
5:41 - 5:43does attempt to do that.
-
5:43 - 5:45In fact, if that's what you're looking for,
-
5:45 - 5:47I suggest you take a look at that.
-
5:47 - 5:48What we're here about is learning
-
5:48 - 5:50advanced programming techniques
-
5:50 - 5:52taking those foundations and building on them
-
5:52 - 5:54to be able to solve more interesting problems.
-
5:54 - 5:55We happen to use C++.
-
5:55 - 5:56You will learn some C++, but I almost
-
5:56 - 5:58consider it a side effect
-
5:58 - 6:00of what we're doing.
-
6:04 - 6:06Just a little note on placement
-
6:06 - 6:09if you're kind of in between and not really sure,
-
6:09 - 6:13these are the very very rough guidelines, but they give you
-
6:13 - 6:17some idea of which groups gravitate where.
-
6:17 - 6:18If you are new to programming or
-
6:18 - 6:20you're not confident about your background
-
6:20 - 6:22- maybe it was a long time ago, if it was self-taught.
-
6:22 - 6:23Maybe it was in a course that you
-
6:23 - 6:25felt was not as good as it could have been
-
6:26 - 6:27or you didn't do as well in it,
-
6:27 - 6:29106A is a great place to start.
-
6:29 - 6:31It actually is by all accounts
-
6:31 - 6:34an extremely popular course at Stanford
-
6:34 - 6:36and services a wide group of people
-
6:36 - 6:39with a little bit of background or no background.
-
6:39 - 6:42All very well getting them up to speed.
-
6:42 - 6:45If you do have something like a solid first course experience
-
6:45 - 6:47So you did well in 106A or took a similar course
-
6:47 - 6:49or perhaps even self-taught your way
-
6:49 - 6:53through a lot of those materials and you feel ready to move on, 106B.
-
6:53 - 6:55An AP course in high school -
-
6:55 - 6:59the A curriculum is a pretty good match for 106A here
-
6:59 - 7:00so you're in a great place.
-
7:00 - 7:02If you have this and you've got a little bit more going for you
-
7:02 - 7:04or you're super enthused and you have a
-
7:04 - 7:06lot of extra time this quarter
-
7:06 - 7:09and want to sit in the company of only
-
7:09 - 7:11the uber geeks,
-
7:11 - 7:13you can check out 106X,
-
7:13 - 7:15Which is a varient of B
-
7:15 - 7:17which covers the same kind of topical ground
-
7:17 - 7:18but at a different level intensity.
-
7:18 - 7:20It amps up a little bit of the assignments,
-
7:20 - 7:23covers some of the material that we won't get a chance to cover,
-
7:24 - 7:25and
-
7:25 - 7:27just pushes the envelope a little bit there.
-
7:27 - 7:30If you have experience comparable to the first two courses
-
7:30 - 7:31- you've
-
7:32 - 7:34done all the things that we're talking about here in B
-
7:34 - 7:35and you feel comfortable with it,
-
7:35 - 7:37it might be that the right place for you is 107,
-
7:37 - 7:40which is the third course in our sequence.
-
7:40 - 7:43And just skipping over our 106 courses entirely
-
7:44 - 7:46That's somewhat rare,
-
7:46 - 7:47so if you're thinking about that, I encourage you to
-
7:47 - 7:49talk to me a little bit to make sure
-
7:49 - 7:51that you won't be missing out on something important
-
7:51 - 7:54in doing so, but certainly there are students who have
-
7:55 - 7:57for example, the AP CS A-B curriculum
-
7:57 - 7:59is pretty comparable to this course here,
-
7:59 - 8:03and so depending on how high quality the course you had was,
-
8:03 - 8:04it might very well be that 107 is right.
-
8:04 - 8:06In some situations where that course was a little bit lacking,
-
8:06 - 8:09there may be some ways that we can help reinforce
-
8:09 - 8:11the things you've learned and build a stronger foundation
-
8:11 - 8:14to move forward from rather than jumping ahead.
-
8:15 - 8:18Any questions about placement?
-
8:20 - 8:22That sort of thing.
-
8:22 - 8:24(Am I talking too fast?)
-
8:24 - 8:27(good, I like that, you can sit in the front whenever you want)
-
8:28 - 8:30Lets talk philosophy
-
8:30 - 8:34I think there's a statement about what we officially are,
-
8:34 - 8:38but I also think that 106 has a long tradition at Stanford
-
8:38 - 8:40that comes back from student motivation.
-
8:41 - 8:43I was here as an undergrad in the 80s
-
8:43 - 8:45when 106s were just getting off the ground,
-
8:45 - 8:47and at the time, Stanford only had a graduate
-
8:47 - 8:49computer science department, and
-
8:49 - 8:52the belief in the nsaid period for computer science
-
8:52 - 8:54was you should get a math degree,
-
8:54 - 8:55and only then would you be mature enough
-
8:55 - 8:57to learn about computers.
-
8:57 - 9:00You weren't ready as a freshman.
-
9:00 - 9:02was a groundswell of Stanford students
-
9:02 - 9:05were like said 'We want access to programming. We want it.'
-
9:05 - 9:06That made it happen.
-
9:06 - 9:09and so part of the 106 was a really careful thought about what the 106's
-
9:09 - 9:12would be a Stanford and what we want them to be
-
9:12 - 9:14in a philosophical sense.
-
9:14 - 9:16One is that we welcome students of
all majors and backgrounds. -
9:16 - 9:19We don't have a version of 106 that's for the majors or
-
9:19 - 9:21potential majors and a version that's for the non-majors
-
9:21 - 9:24and a version that's terminal (you just want to get out of here).
-
9:24 - 9:27We really think that we can bring you all together
-
9:27 - 9:31and design a course that addresses this wide
-
9:31 - 9:33disparate group but still service that well.
-
9:33 - 9:36Partly because you don't know that
you are a CS major yet. -
9:36 - 9:39I'm going to turn you into a CS major.
That's my plan. -
9:39 - 9:42At Stanford right,
not having to make that choice about a major -
9:42 - 9:44until into junior year is a gift
-
9:45 - 9:49to allow you to explore
and to feel unencumbered by having made some -
9:49 - 9:51decision when you applied,
and I think it's important to respect that -
9:51 - 9:54gift that Stanford gave you by
trying to make sure our courses don't -
9:54 - 9:56funnel you one way or
the other before you figure it out. -
9:57 - 9:58You are all welcome here.
-
9:58 - 10:00We try to make it accessible to everyone.
-
10:00 - 10:03We have certain plans
that help to make that work. -
10:03 - 10:07We do try to provide a solid,
practical foundation in programming -
10:07 - 10:11that given our placement at Stanford
in the middle of the Silicon Valley, -
10:11 - 10:14there's kind of a strong influence
for us to try to produce students -
10:14 - 10:16who from the get go are
-
10:16 - 10:18learning things that are actually quite useful
-
10:18 - 10:19outside of the classroom
-
10:19 - 10:22rather than teach you a very academic
-
10:22 - 10:24interesting and mathematical
language like Scheme -
10:24 - 10:27that is very
-
10:27 - 10:29rarely used outside of the classroom.
-
10:29 - 10:31We're trying to teach you on the tools,
-
10:31 - 10:34languages and techniques that are actually in active practice.
-
10:34 - 10:38We are using Java and C++,
two of the most prevalent languages -
10:38 - 10:40out in the industry, and
we do a lot of learn by doing. -
10:40 - 10:42We assign challenging, full-fledged
programs that you work on and you build -
10:42 - 10:47and so it's not designed to be
academic exercises. -
10:47 - 10:54You really are building skills
that have applicability here and
outside of the class. -
10:55 - 10:58We have a big emphasis on
-
10:58 - 10:59truth and beauty.
-
11:01 - 11:04This is one area in which some of the
substitute courses -
11:04 - 11:07that we have seen students come in with
have a little bit more trouble with -
11:07 - 11:10is tackling this part of it,
which is that there are -
11:10 - 11:12a lot of ways you can get a program to work.
-
11:12 - 11:14Many of them are not pretty.
-
11:14 - 11:17You can just type and type and type and
(Monkies shakespeare, whatnot) -
11:17 - 11:19eventually, you can get your way to
something that works. -
11:19 - 11:23Well +1, -1, what if I move it here
what if I copy and paste this there -
11:23 - 11:25what if I change that name?
-
11:25 - 11:27That, in the end,
might produce a program that from -
11:27 - 11:28external appearances works.
-
11:28 - 11:34It plays hangman, or whatever was the
desired goal, but that internally is a mess. -
11:34 - 11:37It's not well structured.
It's not well commented. -
11:37 - 11:40It's not easy to understand.
It wouldn't be easy to modify. -
11:40 - 11:42It makes a lot of decision that are really sub optimal,
-
11:42 - 11:48and we're really interested in producing
engineers -
11:48 - 11:52that have a good sense of design and
really appreciate what is involved in writing -
11:52 - 11:56good, well designed software,
not just working software. -
11:56 - 11:57We will be giving you feedback on
-
11:57 - 12:00both the correctness and
functionality of your code -
12:02 - 12:05as important if not more so,
-
12:05 - 12:08also on how well we think you did
at designing and implementing and -
12:08 - 12:11writing code that is of
a high quality. -
12:11 - 12:12We make a big deal out of that.
-
12:12 - 12:14That is something that is not
always shared by other classes, -
12:14 - 12:17and so in particular, someone who is self-taught
-
12:17 - 12:20or in a class that didn't emphasize this
might feel that there's a little bit of a gap there -
12:20 - 12:21we need to make
that up with you, -
12:21 - 12:23and we can work with you.
-
12:23 - 12:26This is a very individual thing,
because there's not one good example of -
12:26 - 12:28the perfect style
-
12:28 - 12:31in the way that a lot of different people
-
12:31 - 12:34express themselves in written communication
-
12:34 - 12:35very well but differently.
-
12:35 - 12:36The same thing is true about programs.
-
12:36 - 12:40You will have your own unique style,
and we'll work with you to coach you on getting your -
12:40 - 12:44style to come through and
be beautiful and elegant. -
12:46 - 12:50This kind of comes back to point 1
we make heavy use of undergraduate -
12:50 - 12:53section leaders as mentors in this program.
-
12:53 - 12:59We have a staff of 50 or so, undergraduates
who work with the 106A, B and X courses as a team. -
12:59 - 13:02They have specific responsibilities with their section,
-
13:02 - 13:06so mentoring and grading and meeting with
-
13:06 - 13:09sectionees to give individualized
feedback on their programs -
13:09 - 13:10as well as
-
13:10 - 13:14answering questions, solving problems,
being in the lair 30 plus hours. -
13:14 - 13:16They're most weekday nights about six hours
-
13:16 - 13:17and often
-
13:17 - 13:20well past the midnight when it's supposed to cut off
solving people's problems, -
13:20 - 13:23helping when you get stuck,
answering your questions -
13:23 - 13:26and making sure you're all
making forward progress. -
13:26 - 13:29That comes back to point 1.
-
13:29 - 13:31In some universities where they're
choosing to use their intro course as a weeder, -
13:31 - 13:34it's like let's separate the wheat
from the chaff early -
13:34 - 13:35and let's make it really hard and not
-
13:35 - 13:38provide too much support,
and that way we'll make sure we get the people we want. -
13:38 - 13:41We have a different idea.
-
13:41 - 13:42Programming is hard,
especially when you're learning. -
13:42 - 13:46There's a lot of complexity to master,
and there are a lot of details that can -
13:46 - 13:49interfere with moving forward,
and we don't want you -
13:49 - 13:52to get stuck on something that
we can very easily resolve for you. -
13:52 - 13:56So make sure you have accessible
staff members in person, in email -
13:56 - 13:58and regularly in section
-
13:58 - 14:04to help get through the roadblocks
and keep you moving forward. -
14:04 - 14:08What do you need to know to be
sure you're going to do well? -
14:08 - 14:12There are people who think to
be a good computer programmer, -
14:12 - 14:16you need to be good at math,
logic, and drinking Jolt. -
14:16 - 14:22I think it it comes down to
personality traits than any -
14:22 - 14:24particular technique or skill.
-
14:24 - 14:26You don't need to be good at math.
-
14:26 - 14:29How much calculus and trig shows up in this?
-
14:29 - 14:32Not very much.
A little bit of logic - that helps. -
14:32 - 14:37I think it comes down to traits like
curiosity and determination and hard work. -
14:37 - 14:38Starting early,
-
14:38 - 14:41asking questions
when you don't understand something, -
14:41 - 14:44trying to solve the problem by logic
I think is very valuable -
14:44 - 14:45Knowing how to think,
how to make steps -
14:45 - 14:48why this case works and
why that case doesn't work -
14:48 - 14:52thinking about that logically
-
14:52 - 14:56(well its like the movie theater now you guys will all go to sleep)
(oh look they came back) [lights] -
14:57 - 15:01I think these are the skills
that serve you the best in this class -
15:01 - 15:04And probably
every other thing you'd want to tackle. -
15:04 - 15:08There is a lot of time that will be spent
to master this. -
15:08 - 15:11I can talk about programming all I want,
(bla, bla, bla) -
15:11 - 15:13and you can go oh, yeah, that makes a
lot of sense. -
15:13 - 15:16But when you go to write it yourself,
it's a very different experience. -
15:16 - 15:20That's where being
focused and staying on task -
15:20 - 15:25and getting help when you get stuck
can help you move through that -
15:25 - 15:28(Any questions about 106?)
(What we do,) -
15:28 - 15:32(Why we do what we do.)
(You guys have nothing to say) -
15:32 - 15:34(your afraid of having your)
(voice recorded aren't you?) -
15:34 - 15:39(For all time your parents will come and see)
(that you come to class you can prove it) -
15:40 - 15:44My unbiased opinion about why 106B is
one of the best courses at Stanford -
15:44 - 15:47(of course I am not at all unbiased)
-
15:47 - 15:50it's going to be
-
15:50 - 15:53totally obvious when I say these things,
and you guys are going to have to go -
15:53 - 15:55along with it.
I'm actually a -
15:55 - 15:58geek, really big time,
and I happen to love programming. -
15:58 - 16:00That's why I'm a perfect fit for teaching this class.
-
16:00 - 16:01I have taught 106 B or X more than I've taught
-
16:01 - 16:04any other class that I've taught at
Stanford in my time here, -
16:04 - 16:06and that's because each quarter
when we're setting the schedule, -
16:06 - 16:08I say give me B.
Give me X. -
16:08 - 16:09Because there's no better course to teach.
-
16:09 - 16:12Programming is just awesome.
-
16:12 - 16:15If you love programming,
I think there's almost nothing better to do in the world. -
16:15 - 16:18You have this task.
You're trying to get there. -
16:18 - 16:19You're coding.
You're making stuff happen. -
16:19 - 16:22You're testing, iterating you're running.
You see stuff. -
16:22 - 16:25You build things.
When you're done, you know it works. -
16:25 - 16:28That feeling when you write a paper and go
"was it good enough?" -
16:28 - 16:30"well I dont know"
you could probably go bolster up this argument -
16:30 - 16:32When a program works,
you know it. -
16:32 - 16:36It does what it's supposed to do.
It gets the right answer. -
16:36 - 16:38It plays the game.
It solves the problem. -
16:38 - 16:42Finding and fixing that last bug
- although debugging is one of the last -
16:42 - 16:45aspects of programming a lot of people bemoan about;
I happen to think that if you -
16:45 - 16:49are driven by debugging,
that is one of the most awesome detective stories -
16:49 - 16:54Trying to figure out why it happened when you did this,
when you moved that why it went this way -
16:54 - 16:57and what this effect caused
and understanding once you make the fix how it fixes it -
16:57 - 16:59staying up late.
-
16:59 - 17:02I have stayed up late more nights debugging
than anything else in my life, -
17:02 - 17:04and I'm not sad about that at all.
-
17:04 - 17:08That means I'm in the right place.
Hopefully, some of that resonates with you. -
17:09 - 17:12If that sounds really awful to you,
-
17:12 - 17:14hopefully we can change your mind a bit.
-
17:14 - 17:18That is, in some ways,
part of what drives computer science is this -
17:18 - 17:21wanting to build things.
We are engineers. -
17:21 - 17:24We have this computer science name.
Just remember -
17:24 - 17:29- any subject
that's name is something science is not a science. -
17:29 - 17:32We're trying to puff ourselves up a bit.
-
17:32 - 17:34We do a lot of really great work,
-
17:34 - 17:37and there are a lot of neat scientific
principles and theories that -
17:37 - 17:38underpin what we do,
-
17:38 - 17:41but in the end,
I think what drives a lot of us is just -
17:41 - 17:45the engineering
- building stuff that is really neat. -
17:45 - 17:49It kind of reminds me that my
husband's a mechanical engineer, and so I -
17:49 - 17:52used to be envious, because
he would always build things. -
17:52 - 17:57M.E.'s always toting foam core around the campus
on their paper bicycles and stuff, and it's like -
17:57 - 18:00they build all these things.
Now, having watched all the things he builds, it's like -
18:00 - 18:02mechan-e is really hard.
You need all these materials. -
18:02 - 18:05You need all these tools.
You need this mill, you need this lathe -
18:05 - 18:07You need the hotmelt glue gun,
which burns the heck out of your fingers -
18:07 - 18:08anytime you touch it.
-
18:08 - 18:11To build anything.
-
18:11 - 18:13In computer science, you don't need anything.
-
18:13 - 18:14You need a compiler and you need a computer.
-
18:14 - 18:15You need your thought.
-
18:15 - 18:18It's like an abstraction we built out of our brains.
-
18:18 - 18:20There's this relatively small set of things
that you need to master -
18:20 - 18:24and then you can combine them in these very
sophisticated and interesting ways to solve all sorts of problems. -
18:24 - 18:26There's a very low overhead,
-
18:26 - 18:30and the range of things you can attack
with the same set of skills is huge. -
18:30 - 18:36Every domain out there can benefit from somebody
applying computers in a useful way without fail. -
18:36 - 18:39There's all sorts of problems
where technology is part of the answer -
18:39 - 18:41not the only answer,
but certainly something that you can take -
18:41 - 18:44whatever interest you have
and combine it with computer science -
18:44 - 18:47and construct something cool.
-
18:47 - 18:51I happen to think that what
happens in the second course is amazing. -
18:51 - 18:54The first course,
you've kind of got to get up to speed, -
18:54 - 18:57and there's a lot of basic material
that needs to get covered, -
18:57 - 19:00and it does set you on the right path,
but in this course, we really -
19:00 - 19:04get to blossom beyond the basic things.
-
19:04 - 19:07There are a bunch of really neat
and very accessible techniques -
19:07 - 19:11that a second quarter student can understand
and master and do really cool things with. -
19:11 - 19:14You can learn how to do something like
create a database -
19:14 - 19:17that has a million entries
-
19:17 - 19:21and then ask for somebody by name and be able to
instantaneously be able to find that name. -
19:21 - 19:23Not by looking through a million
entries trying to find that name -
19:23 - 19:26Change the size of it.
Make it ten million, a billion, and still be able to -
19:26 - 19:29provide that kind of instantaneous access.
You're going to learn how to do that. -
19:29 - 19:32The technique is not some superhuman thing.
-
19:32 - 19:34It's something very clever, admittedly,
-
19:34 - 19:36but it's very accessible.
-
19:36 - 19:40Taking that same million thing and
learning how to sort it efficiently. -
19:40 - 19:42What if you happen to know things about how it's
almost sorted but just a little but out of sorts? -
19:42 - 19:47Are there ways you can actually make it
even faster to put it in sorted order? -
19:47 - 19:50There are techniques, for example,
like recursion that take on problems that -
19:50 - 19:53you might not have any idea when you
first look at the problem how to solve -
19:53 - 19:57but once you've got your head around recursion,
you can look at that and say -
19:57 - 20:01"I can write a five line function
that will solve that problem." -
20:01 - 20:06This is the kind of power we're going to
give you with our quarter together. -
20:06 - 20:10There's a bunch of really amazing
theoretical and algorithmic stuff to explore. -
20:10 - 20:14That really increases the kind of things
you can do with programming. -
20:14 - 20:18I'm particularly fond of it.
-
20:18 - 20:20
As always, I think -
20:20 - 20:23the section leading program that we have
created and built at Stanford -
20:23 - 20:27Is a huge part of what makes our 106
courses so successful, -
20:27 - 20:28and so
-
20:28 - 20:33having somebody who's individually
working with you, meeting with you weekly -
20:34 - 20:37and giving you that feedback that's
individualized and personalized for you -
20:37 - 20:41and helping you get through the rough spots
is a lot of what helps to make the experience -
20:41 - 20:44very fun and very personal, too.
-
20:44 - 20:49What section leaders do I have here?
Any? Not a one. -
20:49 - 20:52Those fabulous section leaders.
Where are they again? section leaders? -
20:52 - 20:54Did i say they were fabulous?
I meant. laughs Uhh no. -
20:54 - 20:57We haven't yet identified who's going
to what class, so maybe they're all -
20:57 - 21:01thinking they're going to go somewhere else,
but they're wrong. We'll get some. -
21:04 - 21:05106B - great. You agree?
-
21:05 - 21:07Have I convinced you?
-
21:07 - 21:10Is anybody still hesitant?
-
21:13 - 21:16Is it a lot of work?
Oh, no. laughs -
21:16 - 21:19I just exude it. Osmosis. you learn it.
-
21:22 - 21:25Let me tell you a little bit about logistics.
-
21:26 - 21:30There are some random things you may want
to know about how the class works. -
21:30 - 21:34That the first day I am supposed to do.
-
21:34 - 21:38We're going to meet here
Monday, Wednesday, Friday 2:15 to 3:05. -
21:38 - 21:42In glorious download
[ FIXME ] audiotorium -
21:42 - 21:45It looks like we almost
exactly fit in our classroom, -
21:45 - 21:48which means we're all
going to be very friendly and cozy. -
21:48 - 21:51The lectures are being taped
and are available online, -
21:51 - 21:57and so that has the neat side effect that
you can watch them and review them later. -
21:57 - 21:58You could watch them lots of times.
-
21:58 - 22:01It also means that if it were pouring rain and
you were sitting at home in your bunny slippers, -
22:01 - 22:04you could just say hey,
I'm not going outside and you could -
22:04 - 22:06turn on your computer and watch.
-
22:06 - 22:09I'm a big fan of having you come in person.
That's because I don't want to -
22:09 - 22:11lecture to an empty room.
-
22:11 - 22:14I also think there's an interaction there
-
22:14 - 22:19that I'm fond of, and so I hope that you
will make every effort to attend in person
as much as you can. -
22:22 - 22:27It is nice to know that if you do miss a lecture or you
-
22:27 - 22:30get caught up with something, you'll have a chance to review it later online.
-
22:30 - 22:32We will have sections that will meet once a week,
-
22:32 - 22:35just like 106A.
-
22:35 - 22:38The section leader who meets with you is the one
-
22:38 - 22:41who will be grading your programs and sitting with you
and doing the conferences. -
22:41 - 22:46What you need to do to get yourself
into a section - there are several section times listed. -
22:46 - 22:48They are totally bogus. (so ignore that)
-
22:51 - 22:53What you do is you go to the online
- if you go to our class webpage, there's a link that tells -
22:53 - 22:56you how to sign up for a section.
The section times aren't up right now, but they will go up tomorrow, -
22:56 - 22:58and they'll be up through the weekend.
You go in and put in your preferences -
22:58 - 23:04about what times fit your schedule or not,
and there's this big computer program -
23:04 - 23:09that does this magic matching that gets
everyone into a section that fits their schedule. -
23:09 - 23:12That will happen early next week.
-
23:14 - 23:19The signups will be up from Thursday at 5:00
until Sunday at 5:00. -
23:19 - 23:22If by Sunday at 5:00
you've got your schedule fixed, then you're fine. -
23:22 - 23:25If you happen to change after Sunday at 5:00 and after the assignments have been made,
-
23:25 - 23:27at that point, it's a little bit harder.
-
23:27 - 23:28We can make adjustments, but it's on a very case-by-case basis.
-
23:28 - 23:31Where we have space and where we can accomodate you.
-
23:31 - 23:33The best thing you can do
-
23:33 - 23:36is by Sunday at 5:00 have a pretty firm idea
about what you can and can't do. -
23:36 - 23:37There's a list of preferences,
so maybe what you can do -
23:37 - 23:40is pick things that you know will work no matter
-
23:40 - 23:41what happens.
-
23:41 - 23:44for antyhing that is variable if you just dont offer things that you know might
-
23:44 - 23:45go away
-
23:45 - 23:50so there is a list of 20 times and you say I can make these 5
-
23:50 - 23:52And that way you wont get yourselves in trouble
-
23:52 - 23:55in things that might change.
-
23:55 - 23:59The workload - everybody wants
to know how much work. -
23:59 - 24:02It's a five-unit class, and
it's a five unit engineering class. -
24:04 - 24:06You get your five units worth,
-
24:06 - 24:10I would say, so don't worry about that. I won't shortchange you.
-
24:11 - 24:15We have programming assignments not quite weekly.
I think there are seven of them across -
24:15 - 24:19ten weeks, so you can calculate it out.
It's about a week and a third -
24:19 - 24:20for any particular one.
-
24:20 - 24:22The students report
-
24:22 - 24:25that it's about a 15-20 hour project, each of them.
-
24:25 - 24:28Some people get them done in less than that.
Some people take a little bit more. -
24:28 - 24:33I would say that's kind of the
mode range for what people are reporting. -
24:33 - 24:37I do think that of the people who report less,
some of those are -
24:37 - 24:41people who are naturally gifted,
but a lot of it has to do with your habits -
24:41 - 24:43about how you work and
how you make progress, so -
24:43 - 24:46if you are one of the people who feels
you might be more likely to be on the other -
24:46 - 24:49end, you can come and talk to
me and I can give you some suggestions. -
24:49 - 24:56Choosing to work in the lair where the
helpers are on duty has really positive effects -
24:56 - 24:58effects in that when you get stuck,
you have easy access to -
24:58 - 24:59somebody helping you work through it
-
24:59 - 25:02rather than spending an hour or two
fighting something that turns out to be -
25:02 - 25:05simple but required knowing something
that you didn't yet know. -
25:05 - 25:10I'm a big fan of learning things yourself.
There's also a time when a well-placed -
25:11 - 25:14bit of advice from somebody
can save you a lot of time. -
25:15 - 25:22There will be a midterm and a final exam.
They'll both be in class, open book, open notes. -
25:22 - 25:24The midterm is actually technically out of class.
-
25:24 - 25:29have it at night because we need more than
a 50-minute period to get any coverage of that. -
25:29 - 25:31Our final exam is scheduled in
our university-scheduled slot. -
25:31 - 25:36Sadly, that is at the very
end of the exam week, -
25:36 - 25:38but that's when the registrar put us,
and that's when we need to go. -
25:38 - 25:44You may want to take a look at that before
you head off to Acapulco for spring break. -
25:44 - 25:45you need to make sure
you are here for the exam. -
25:45 - 25:49Male audience: Is the course leader available online?
-
25:49 - 25:53Unfortunately, our publisher will not allow me to distribute the course leader electronically.
-
25:54 - 25:57They're not exactly very in the modern age on this.
-
26:00 - 26:02I'm working on it is the truth.
-
26:02 - 26:06By the time the world sees this, hopefully, we will have some other strategy.
-
26:06 - 26:09We currently are in negotiations.
-
26:09 - 26:11The nice thing about the course reader is that
we have not changed it in the last year. -
26:11 - 26:14If you know somebody who has
it from last fall or last spring. -
26:14 - 26:18it has some minor edits and typos that were fixed,
-
26:18 - 26:20so if you can get a hold of an old one, it's good.
-
26:20 - 26:23We are getting no royalties on it.
-
26:23 - 26:27We're publishing it at production cost, so where it
-
26:27 - 26:32would have been a $100.00 textbook
had it been bound and all snappy. -
26:32 - 26:36you're just getting what it cost to photocopy and bind the thing, and Eric and
-
26:36 - 26:40I are eating ramen.
-
26:40 - 26:42It's hopefully cheap enough that
-
26:42 - 26:44you can find a way to get to one
-
26:44 - 26:48or get an old one without it being
too much of an obstacle. -
26:49 - 26:53People in general find the course
reader to be an asset. -
26:53 - 26:54We do say it's required reading.
-
26:54 - 26:59It does have a lot of material that's very
useful in understanding the course. -
26:59 - 27:02There are other people who
don't make as big a use of it, -
27:02 - 27:05but there are some sections that
are really very valuable -
27:05 - 27:08and other ones that may be more
or less depending on your learning style. -
27:08 - 27:12Whether you appreciate more of a chance to
read background material and more examples. -
27:12 - 27:15There's also a lot of good sample problems in it
-
27:15 - 27:19and review questions in it that help to test your understanding.
-
27:22 - 27:23You know, it's tricky, because the university
in general discourages you from giving -
27:26 - 27:29alternate exams because of
-
27:29 - 27:33- you can imagine the issues
of having an exam that has been -
27:33 - 27:35seen by some number of students before
some other number of students take it. -
27:35 - 27:38Even though we're all bound by the honor code,
it does create a situation where -
27:38 - 27:39there is some temptation.
-
27:39 - 27:43It's possible it could be a little bit
early without a lot of gap, but I -
27:43 - 27:46don't think early enough to make alot
of help is the truth. -
27:46 - 27:49We can talk about it.
The current plan is not, I would say. -
28:03 - 28:08A little bit about compilers.
We use C++. -
28:08 - 28:09and we also use
-
28:09 - 28:11some custom libraries, which limits us
to distributing on a certain number of platforms -
28:11 - 28:15we've had a good chance to
test on and work with -
28:15 - 28:19The compilers that we have
support for is X Code on the Macintosh. -
28:19 - 28:22xcode is apples free developer tools so
-
28:22 - 28:25Anybody who has Mac OS 10 can freely
download that, and install our libraries. -
28:25 - 28:29We're using Microsoft's
Visual Studio Version 2005 on Windows, -
28:29 - 28:32we have an arrangement with Microsoft
where they have distributed the software -
28:32 - 28:36free of charge to students, so if you would
like to install that on your own Windows computer, -
28:36 - 28:38we'll give you some handouts on Friday that tell you
-
28:38 - 28:44what to do to get the compiler
and get it installed on your systems. -
28:44 - 28:48Our cluster computers in the dorms
and the libraries and -
28:48 - 28:53the lair both operating systems have both
the compilers and libraries installed, -
28:54 - 28:57so if you work in a cluster,
you don't have to do anything special. -
28:57 - 29:04You just walk up and it's got the
stuff ready to go. -
29:07 - 29:11I'm a Mac person. I've been a Mac
person forever. -
29:11 - 29:13I can't get over the fact that you go to
the start menu to shut the machine down. -
29:13 - 29:17That makes Windows impossible for me to use.
-
29:19 - 29:25I would say campus wide, there are more
Windows machines than Macs on campus, -
29:25 - 29:29So if you want to take a popular vote,
You could do that. -
29:29 - 29:34If you want to be on the side of the Mac bigot,
you can come and be with me in X Code. -
29:45 - 29:49I've got ten minutes to tell you a little
bit about C++. -
29:49 - 29:54That is the next journey that we're
going to go on together. -
29:54 - 29:57The first question is:
Why are we doing this to you? -
29:57 - 30:02I just got comfortable with Java and now
you're telling me to throw away my Java
and start over. -
30:03 - 30:08Let's generate a little bit of love for C++.
-
30:08 - 30:11The advantages of early multilingualism.
-
30:11 - 30:14- I have two small children at home
that are two and four, -
30:14 - 30:18and I read a lot about bilingualism.
-
30:19 - 30:22It's very clear that for natural
languages, when you're -
30:22 - 30:25acquiring a language at those
young ages that that is the -
30:25 - 30:28best time to introduce a second
or third language. -
30:28 - 30:31Where you are building the
pathways and the neurons. -
30:32 - 30:35It's been looked at in terms of programming
languages as well, -
30:35 - 30:38that when you are learning a programming
language, there are certain kind -
30:38 - 30:41of ruts your mind gets into about
the way a language is -
30:41 - 30:45that is based on your early experiences.
-
30:45 - 30:49If you spend a very long time working
only in one language, those ruts get deeper, -
30:49 - 30:52and you have a certain way of thinking.
You're a little bit stuck in that paradigm and its approach. -
30:52 - 30:56What's easy to do in that language,
what's hard to do in that language -
30:56 - 31:00tends to make a stronger impression on
you in a way that makes it harder as you -
31:00 - 31:04grow and explore the languages to kind of get
out of those ruts and shake yourself out of it. -
31:04 - 31:08There's been some pretty good evidence
that somewhere between one -
31:08 - 31:11and two is a good time to think
about branching out -
31:11 - 31:14and starting to think about different
ways of doing stuff and seeing some -
31:14 - 31:20different syntax and some different ideas
to help build in the flexibility from -
31:20 - 31:26an early age in your career to buy you
some strength later. -
31:27 - 31:31That's part of what we're doing.
Another part of it is actually that a lot of our upper division -
31:31 - 31:36courses rely on a knowledge of
C and C++, that family of languages, -
31:36 - 31:39and that the longer we postpone it,
the more painful it becomes. -
31:39 - 31:44In the later courses where you're learning
about compilers or graphics or networking, -
31:44 - 31:48they don't have the time in those classes to stop and teach you C or C++.
-
31:48 - 31:51They need you to know C++ to get the work done.
-
31:51 - 31:55Moving the foundation into a programming class
-
31:55 - 31:57seems to make the most sense in the context of our curriculum.
-
31:57 - 32:00We do switch you over here.
-
32:00 - 32:04The good news is that it's not as big a change as it might sound at first glance.
-
32:04 - 32:07Java is actually highly derivative of C++ for a start.
-
32:07 - 32:10They're kind of cousins in the scheme of language design.
-
32:10 - 32:12
-
32:12 - 32:14They have a lot of syntax.
-
32:14 - 32:18How much C++ do you need to know to start?
The answer is zero. -
32:18 - 32:21You don't even need to know what the word means.
-
32:21 - 32:22In fact,
-
32:22 - 32:25you actually probably know a surprising
amount about C++ just by virtue of what -
32:25 - 32:28you already know just translated a little bit.
-
32:28 - 32:32Things like the four loop of Java or the way you declare variables or
-
32:32 - 32:35the way parameters are passed into a function
-
32:35 - 32:39is exhibited in Java in very much the same way it is in C++.
-
32:39 - 32:42There are a bunch of things you already know and you don't even realize.
-
32:42 - 32:45It is not assumed that you know C or C++.
-
32:46 - 32:49If you happen to already know those things,
you're ahead of the game. -
32:50 - 32:52If you have not,
-
32:52 - 32:54then not to worry.
-
32:54 - 32:57How much C++ are you going to learn?
-
32:58 - 33:00We will spend the first
-
33:00 - 33:02three or four lectures
-
33:02 - 33:05just talking about how things get expressed differently in C++
-
33:05 - 33:07and mostly talking about
-
33:07 - 33:12the differences in the libraries.
The syntax itself is quite similar. -
33:12 - 33:15Some of the more extensive changes have to do with how the C++
-
33:15 - 33:18string is operated on versus the Java string.
-
33:18 - 33:20How you do file input and output reading
-
33:20 - 33:23in C++ is a little bit different than the way it's done in Java.
-
33:23 - 33:26We'll spend some time saying here are some things you know how to express in one language.
-
33:26 - 33:29We're going to teach you how to express them in another language.
-
33:29 - 33:31It's just mapping from your previous vocabulary onto a new one.
-
33:32 - 33:35Along the way, we will actually introduce some of the C++
-
33:35 - 33:38features that we need to support our pedagogical goals.
-
33:38 - 33:42We'll be talking about how classes get designed in C++.
We'll see how to use classes. -
33:44 - 33:45those classes, We'll see how to define
-
33:45 - 33:49and we'll look at things like templates, which is the C++
-
33:49 - 33:52construct for doing generics that you seen in Java - how you can build
-
33:52 - 33:56containers that are type unspecific and things like that. We
-
33:56 - 34:01will learn a little bit of some of the fancier features of C++ like
-
34:01 - 34:02the pass by reference parameter,
-
34:02 - 34:05but there's actually a very large amount of C++ that's just off the
-
34:05 - 34:07table for us.
-
34:07 - 34:11We will not make extensive use of the standard template library or
-
34:11 - 34:13the
-
34:13 - 34:17fancier features of 'static' and 'const' and a bunch of key words that
-
34:17 - 34:20mean nothing to you and should mean nothing to you.
-
34:20 - 34:23You will learn enough to have reading familiarity with
-
34:23 - 34:26C++ and to be able to express yourself quite well in the subset we're using, but
-
34:26 - 34:29it is a subset of C++ that you're being exposed
-
34:32 - 34:35to.
-
34:35 - 34:39If you find yourself really wanting to
-
34:39 - 34:42master C++,
-
34:46 - 34:48we are offering
-
34:48 - 34:52CS106L. CS106L is a lab companion course that is
-
34:52 - 34:55open to students enrolled in 106B or 106X.
-
34:55 - 34:57It meets twice a week.
-
34:57 - 34:59It's actually on Monday and Wednesday late afternoon.
-
34:59 - 35:02It's 4:15 in Hewlett
-
35:02 - 35:04103. It's being taught by a veteran section leader
-
35:04 - 35:09who is very well versed in C++ and who of his own
-
35:09 - 35:13volition volunteered and created this course because
-
35:13 - 35:16he himself was a little frustrated as a prior 106 student
-
35:16 - 35:19in wanting to get at some of those C++ things that weren't
-
35:19 - 35:20fitting with our goals.
-
35:20 - 35:23It is a place where you can
-
35:23 - 35:26get more exposure to standard C++, do some exercises that help
-
35:26 - 35:29you to test out those things and see how those things are expressed and get another
-
35:29 - 35:32unit. It's a pass/fail lab course.
-
35:32 - 35:35You can also just attend or grab the materials if you just want to look at
-
35:35 - 35:35them.
-
35:35 - 35:38It's a great way to
-
35:41 - 35:43broaden that knowledge of C++ beyond what's
-
35:43 - 35:48useful for us in terms of our goals. I'm going
-
35:48 - 35:53to ask you some questions, because I don't get to do all the talking.
-
35:53 - 35:56How much C++ do you need to know? Some of you may know nothing about it,
-
35:56 - 35:58and that is perfectly fine. Some of you probably know something about it or at least
-
35:58 - 36:02have heard something about it. I'm going to have you guys tell me
-
36:02 - 36:04what it
-
36:05 - 36:09is that people tell you about C++ that
-
36:09 - 36:13makes you either excited to learn it or frightened to learn it or
-
36:13 - 36:15interested in how it works. It's
-
36:15 - 36:17what Java is based off of. It is what Java is
-
36:17 - 36:20based
-
36:20 - 36:24off of. That should be a little reassuring
-
36:24 - 36:28that there is a syntax there that got adopted with some minor
-
36:28 - 36:31changes. It should feel
-
36:31 - 36:34more familiar than different when you look at it.
-
36:34 - 36:37It was very strongly influenced by a generation of
-
36:37 - 36:39programmers who C++ was their native language who designed the
-
36:39 - 36:42Java language. That's a good thing to know. What else do you know
-
36:42 - 36:47about C++?
-
36:47 - 36:49It's extended
-
36:50 - 36:53C. Yes. It's extended C. Here's how it fits in the spectrum.
-
36:53 - 36:56C is kind of a 1970s creation. C++ is a
-
36:56 - 36:58decade later.
-
36:58 - 37:01C is the language which it is based on. It is an extended C. It's
-
37:01 - 37:05called a superset. Everything that compiles and works in C
-
37:05 - 37:07still exists in C++, but then they added a bunch of features.
-
37:07 - 37:10Not only did they add a bunch of features but they tried to fix some of the things
-
37:10 - 37:13about C++ by replacing existing things. For example, there's some
-
37:13 - 37:17string handling in C that's kind of very primitive. They added a string
-
37:17 - 37:18object
-
37:18 - 37:22with much cleaner handling and safer semantics into the C++, but they kind of
-
37:22 - 37:23left the old one around.
-
37:23 - 37:26Some parts of C++ feel a little strange
-
37:26 - 37:32because of this history to it - the legacy of incorporating everything C was plus the stuff
-
37:32 - 37:35means at times there's a little bit of weirdness there. It also means
-
37:35 - 37:39that the language, as a result, is very large.
-
37:40 - 37:44C's
-
37:44 - 37:47type safety
-
37:47 - 37:52and runtime features were extended by what
-
37:52 - 37:56got
-
37:56 - 38:00added in C++. A friend of mine told me that [inaudible]. That's a
-
38:07 - 38:08good thing
-
38:08 - 38:09to know.
-
38:09 - 38:13C++ might be a little bit more dangerous than Java.
-
38:13 - 38:17That is true. Java is very
-
38:17 - 38:21concerned with
-
38:21 - 38:25safety, in particular since Java was designed for web
-
38:25 - 38:27delivery of content. It was very important that the program have
-
38:27 - 38:29very constrained
-
38:29 - 38:31features on what it can and can't do,
-
38:31 - 38:35and so as a result, Java tends to be very parental. When you
-
38:35 - 38:38forget to initialize a variable or forget to
-
38:38 - 38:39return from a function,
-
38:39 - 38:41Java's
-
38:41 - 38:45very aggressive about saying hey, you've got to fix this. C++ is a little
-
38:46 - 38:47less
-
38:47 - 38:51parental. Here's the overly protective mom, helicopter mom,
-
38:51 - 38:54the ones who stand. That's Java. Java's making sure - oh, are you okay,
-
38:54 - 38:57sweetie? Let me stand here
-
38:57 - 39:01in case you fall. C++ is crack mom. She's like yeah, I'm over
-
39:01 - 39:05here with my friends. Don't play
-
39:05 - 39:06with
-
39:06 - 39:08the kitchen knives.
-
39:08 - 39:11It's a professional's tool,
-
39:11 - 39:13and professionals don't want to feel encumbered. There are certain things they want
-
39:13 - 39:16to do that require some of this
-
39:16 - 39:19low-level access, and safety usually comes at a cost.
-
39:19 - 39:23Any sort of feature where the language is double-checking for you is taking time and
-
39:23 - 39:26efficiency. There's a cost associated with that. Every time you want
-
39:26 - 39:28to get something out of an array,
-
39:28 - 39:30it's checked to make sure that that number was
-
39:30 - 39:34not off either end. Every array access costs you a little bit more.
-
39:34 - 39:35C++ says
-
39:35 - 39:38I'm not going to charge everybody that penalty. If you actually have the bad sense
-
39:38 - 39:43to write a program that does those things, you deserve to be punished.
-
39:43 - 39:47As a result, you will at some
-
39:47 - 39:49point in this quarter get to experience some of that firsthand. Some of
-
39:49 - 39:53it is a growth experience. Some
-
39:53 - 39:56of it can be frustrating. It is part of what
-
39:56 - 39:58professional tools often look like. They are making these tradeoffs
-
39:58 - 40:01of efficiency over safety that
-
40:01 - 40:04put more of the work back on you as the programmer to be a little more attentive on
-
40:04 - 40:05those things.
-
40:05 - 40:09You can write programs that crash in very spectacular ways
-
40:09 - 40:14much more interesting and varied and dangerous than the kind of things you can do
-
40:18 - 40:21in Java. Good to know. You want to
-
40:21 - 40:29use
-
40:29 - 40:29pointers.
-
40:29 - 40:31You're going to get to use pointers.
-
40:31 - 40:35Pointers are really neat, and they're also very challenging. Pointers are these
-
40:35 - 40:37ways of building these very flexible and amazing
-
40:37 - 40:40data structures - the kind of things that we're going to try to build. At some
-
40:40 - 40:43point, they are going to be the only way to achieve those things well, so building
-
40:43 - 40:46these things called trees, graphs and lists rely on understanding
-
40:46 - 40:49a mastery of the pointer type. The pointer type is complicated, and it's part of
-
40:49 - 40:51that danger thing, which is
-
40:51 - 40:53having access to
-
40:53 - 40:57rearranging memory by virtue of addresses opens up a lot of
-
40:57 - 40:59opportunity for there to be mistakes.
-
40:59 - 41:02Mistakes can be made in the passive voice
-
41:02 - 41:06that have consequences. You'll get to experience firsthand what that's like.
-
41:06 - 41:09There's joy in it, because getting it right is awesome, and there are things that you can
-
41:09 - 41:12achieve that are really extraordinary with pointers, but
-
41:12 - 41:13when it's not working,
-
41:13 - 41:17it can
-
41:17 - 41:18be frustrating. You're getting a
-
41:18 - 41:22little
-
41:22 - 41:25bit of both. It turns out C++ does not have a graphics system built
-
41:25 - 41:26into it.
-
41:26 - 41:29Java is actually distinguished from previous
-
41:29 - 41:32languages. Java tries to solve all problems. Traditionally, a
-
41:32 - 41:33programming language tends to have a set
-
41:33 - 41:34of libraries that have
-
41:34 - 41:38facilities for data management, reading and writing files and sometimes some
-
41:38 - 41:42networking, but they don't tend to actually solve application layer problems. That
-
41:42 - 41:46tended to be a different piece of technology. The Mac
-
41:46 - 41:49OS might offer a graphics library that was written in C++, but C++
-
41:49 - 41:50the language
-
41:50 - 41:53didn't have a windowing system or graphics system.
-
41:53 - 41:55C++ does not have those features
-
41:55 - 41:56itself,
-
41:56 - 41:58so any C++ compiler
-
41:58 - 42:02you get comes with these basic things about handling files and managing these types of
-
42:02 - 42:05data structures, but it does not come a priori with a bunch of graphics routines.
-
42:05 - 42:07That said,
-
42:07 - 42:09Windows and Mac and Linux and all these things have graphics routines that are
-
42:09 - 42:12written in C++, but they're all different. To say what are they
-
42:12 - 42:13like
-
42:13 - 42:15relative to Java? They're all different relative
-
42:15 - 42:16to Java. It's not standardized.
-
42:18 - 42:21There's a wide variety of them out there, and
-
42:21 - 42:24they tend to have a lot of very impressive and different solved
-
42:24 - 42:27problems, because C++ has a longer history than Java that a lot
-
42:27 - 42:30of problems have been solved in C++ that are available to you,
-
42:30 - 42:32too. There's a lot of existing code
-
42:32 - 42:36other than what you might think is standard.
-
42:38 - 42:42I
-
42:42 - 42:43will
-
42:43 - 42:47see you on Friday, and we'll be seeing some C++. If you have
-
42:47 - 42:58questions about your situation, come and talk to me now.
- Title:
- Lecture 1 | Programming Abstractions (Stanford)
- Description:
-
The first lecture by Julie Zelenski for the Programming Abstractions Course (CS106B) in the Stanford Computer Science Department.
Julie Zelenski gives an introduction to the course, recursion, algorithms, dynamic data structures and data abstraction; she also introduced the significance of programming and gives her opinion of what makes 106B "great;" C++ is introduced, too.
Complete Playlist for the Course:
http://www.youtube.com/view_play_list?p=FE6E58F856038C69CS 106B Course Website:
http://cs106b.stanford.eduStanford Center for Professional Development:
http://scpd.stanford.edu/Stanford University:
http://www.stanford.edu/Stanford University Channel on YouTube:
http://www.youtube.com/stanforduniversity/ - Video Language:
- English
- Duration:
- 43:03
![]() |
Estivo Alexio edited English subtitles for Lecture 1 | Programming Abstractions (Stanford) | |
![]() |
Estivo Alexio edited English subtitles for Lecture 1 | Programming Abstractions (Stanford) | |
![]() |
Estivo Alexio edited English subtitles for Lecture 1 | Programming Abstractions (Stanford) | |
![]() |
Estivo Alexio edited English subtitles for Lecture 1 | Programming Abstractions (Stanford) | |
![]() |
Estivo Alexio edited English subtitles for Lecture 1 | Programming Abstractions (Stanford) | |
![]() |
Estivo Alexio edited English subtitles for Lecture 1 | Programming Abstractions (Stanford) | |
![]() |
Estivo Alexio edited English subtitles for Lecture 1 | Programming Abstractions (Stanford) | |
![]() |
rand.m.poster edited English subtitles for Lecture 1 | Programming Abstractions (Stanford) |