Today: Last lecture, your future in CS, conclusions
Final Exam
- Mon Dec 12th, 10:00-11:30 am
Arrive a little early to get settled
- Time/place logistics will be on the course page by Fri
- Similar structure to midterm
1.5 hours, closed note
Enough time to write code, not extra time
A little harder than the midterm, curved
- Covers the whole quarter, weighted towards post-midterm
- Improved final exam score can compensate for a poor midterm score
- Exam problems look like homework functions
- Not on final exam:
Bit
Writing main()
Calling matplotlib
- See course page for review materials: final-prep, 2x previous exams
Lots of problems for practice
Taped review session - see course page
- Section this week - work some review problems
Chat After Class
I'm happy to talk to people after class at Bytes cafe with any sort of CS questions, then heading over to Durand. (Office hours 2-3 merged into this). Also on Zoom at 3:10 for remote people.
Python Guide
I'm gradually working on and expanding the Python Guide, aiming to keep it as a free resource on the web. If you want to find it in the future, it's linked from my home page and the CS106A page.
Pre-CS106A
- Computer is impressive
- But opaque and mysterious
- How do you control this thing?
Post-CS106A
- Things said on the first day
- The computer just follows mechanical instructions
- The ideas and insights are from the programmer
- We've done this so much, it scarcely needs mentioning
Learned All The Programming Techniques?
No!
Learned the Important Core
Here is the deal: Python and the space of all programming techniques is very large. A bigger space than you might think.
You have learned the most important 80% core: loops, lists, strings, functions, tests, files
There's a few more important techniques in CS106B. Most programs, even very advanced programs, are centered around those core features. If you need to use a less-common technique, you may look it up and figure out as you go. That's how most programmers proceed - the core they know well, the other stuff they look up as they go.
Women in CS Trend - 1994 - 2020
Slide from Mehran Sahami, Stanford CS-Education. The bars is number of students. The line is the percentage of women. Both are going up which is great, and it looks like a gradual broadening of the field.
Fact: Programmer Shortage
- A fact for you to internalize
- What percentage in the US know how to code?
- Walking around Stanford .. you would think it's like 25%
- Approx 1% of the population work formally as programmers
Formal "programmer" jobs in the US statistics
There are additional programmer-adjacent jobs, but still a tiny number
- For comparison approx 12% of population works in health care
- Lots of programming problems are not being solved due to lack of programmers
- In other words, there is a programmer shortage
Very high pay for programmers is another bit of evidence of the shortage
- Not that we need to make any Stanford student's head any bigger...
- But by these numbers, knowing Python makes you a little special
Why is there a Programmer Shortage?
- Coding seems impossible
- People are scared off before trying, weird syntax
- Don't see themselves as programmers, keep a distance
- They tried programming and they don't like it
Of course, CS is just one of many possibilities in life
Opportunity vs. obligation
Nick Python T-Shirt Story
I was on a bicycle, wearing ratty clothes and a "Python" t-shirt stopped for a red light. A person walking in the cross-walk in front of me, stopped, turned to me, and asked if I was looking for work.
Not to disillusion you about graduating from Stanford, but that is not how hiring is normally done.
Like how desperate for programmers was that person? That is what an extreme programmer shortage looks like!
Background: Many Computer Languages
- There are many different computer languages
Python, C++, Javascript, Java, C, Rust
- Each language is good at different things
Python Niche - Programmer Efficient
- Python is great at letting the programmer express their ideas with minimal code
- At what cost?
- Python runs slow and uses more memory than code in other languages
- In some sense, shifting costs from the programmer to the computer
- That's a great tradeoff in many situations!
Code Ideas We've Seen in Python
- Code ideas we've seen in Python
- Storing data
ints, floats, strings, lists, dicts
- Language features:
functions, parameters, strings, loops, if-logic, lists, dicts
- Good programming style:
Divide and conquer, decomposition
Testing functions
Readability
Your Second Programming Language
- Your second computer language
C++ or Javascript or Java or whatever..
- Has those some features:
ints, loops, strings, if-statements, ..
- Computer languages are 80% similar to each other
- Different syntax - superficial
- Your second language is surprisingly easy to learn
(you may be skeptical)
- Python has a "light" syntax
other languages have more to type in
- C++ (CS106B)
Here is some C++ code
// comments start with 2 slashes
int i = 0; // must declare var
while (i < 100) { // parens + braces
i += 1; // same as py + semicolon
if (is_bad(i)) { // parens + braces
return;
}
i += "Hello"; // error detected
// int/string types different,
// so above does not work.
// Error is flagged at edit-time:
// earlier than python, an improvement
}
- C++ code looks different
- Actually 80% familiar
- Picking up C++ will not be a big problem
- Advantage of heavier syntax: more automatic error detection
- Also C++ runs much faster than Python
- Disadvantage: more to type in
- Fun fact: the Python interpreter is itself written in the language C, related to C++
Possible Next Steps
Most Stanford students take 1 or 2 CS classes and keep with their chosen major. It's easy to imagine they use Python here and there as part of their work.
After CS106A ..
- Even if you don't write code any more
Now you know code is not a magic box
Algorithms thought up by people
Expressed as code for the computer
- Code some more..
Perhaps a little code alongside, say, your bio research
- Interested in more CS .. take CS106B
See how far you like going
- Hidden agenda:
Many students coming to Stanford don't see themselves in CS
CS106A tries to pick off a few was-not-planning-to-like-CS students
Next "CS106" CS106B
- The next step in CS - mixture of coding and CS
- Coding problems are harder and more impressive compared to 106A
- Has section leaders
- Many non-CS-majors take this
- More powerful algorithms
- Uses C++ language - don't worry about this
- Recursion (beautiful) .. e.g. solving a maze
A sort of jaw-dropping idea when you get it
- Really understand: hash table (dict), sorting algorithms
- More hands-on use of memory
If you want to take CS106B, we generally recommend taking it within 6 months.
It happens topics and workload in CS106B go up or down somewhat depending on who's teaching it, so you have to think a little bit which quarter is right for you. Any version of CS106B is fine for going on in the major.
Think About Section Leading
- Few schools have this opportunity
- Section Leader program - amazing thing at Stanford
- Section leaders are drawn from students who have completed CS106B
Don't need to be a CS major
- Section leaders - not for everyone
like code, like helping people
- Open secret: SLs pick up fantastic skills
debugging, organizing ideas, public speaking, confidence
Map of CS Major
- Programming core sequence:
CS106A, CS106B, CS107, CS111
- CS Mathematical core sequence:
CS103, CS109, CS161 (integer mathematics, probability)
- Then there are more courses in an area of concentration
Aside: What is CS Integer Mathematics?
- CS Integer mathematics (vs. calculus real-number)
int div and mod (// %)
- Hash Table (dict) - how is this so fast?
- Not so much: integrals, differential equations
- Calculus is not the ceiling, it's a branch
- Integer mathematics is its own domain
- Relates to list/string algorithms we've done
- Personal take:
I was tired of Calculus, but integer mathematics seemed neat and applied
- CS106B goes down the path of integer mathematics a little
CS Major Tracks / Concentrations
- If interested in majoring in CS
- Don't have to pick an area at first
- Undergraduate CS concentration areas:
Artificial Intelligence (AI)
Human Computer Interaction (HCI)
Systems (operating systems, networks)
Graphics
Biocomputation
- Choose a concentration, take advanced courses in that area
- HCI - call this one out, since most don't realize this field exists (below)
- CS Minor is a good deal
Up through CS107 and CS109 + 2 electives
This gives a strong CS background
Minor is a better idea than double-major
Some Select Courses
We'll just mention a few courses you could take, build the picture that there are many different areas of CS you might explore. Many of these require CS106B as the pre-requisite.
Scientific Python CME 193
- Python and scientific computing
- Prereq: CS106A basically
- 1 unit s/nc
- Applied Python (vs. CS fundamentals)
- See CME193
Applied Machine Learning CS129
- Machine Learning is the cutting edge AI technique
Drawing conclusions from data
- Prereq: CS106B, linear algebra / Math 51
- See CS129
Human Computer Interaction (HCI) CS147
- How to design systems to work well with humans
- Details below about HCI
- Prereq: CS106B
- See CS147 intro HCI
Web Applications CS142
- Building a web server and pages
- Prereq: CS107
- See CS142
Graphics CS148
- 3d imagery
- Prereq: CS107, Math 51
- How does Mario Cart work?
- See CS148
Human Computer Interaction - HCI Design
- What if you don't want to write code all the time?
- An unexpected part of CS
- Human Computer Interaction Design
- Anyone working in management in a computer field should take this course
- You can do an undergrad or grad emphasis in HCI
- More info: CS147 intro HCI
- aka "interaction design" - product manager, designer
- Demo Image search: push pull handle HCI
- Door Push-Pull Handle
- The appearance communicates to the subconscious
- Great design works without the user thinking!
(analogy: film making to create an emotion in the audience)
- Mostly we notice HCI in the world when it is done badly
You click a control, and are surprised by what happens
- Nick's Open Question: what is the greater drag on human potential on earth:
Missing software, not coded up yet (CS106B)
Software with bad HCI design (CS147)
Symbolic Systems Major
A sibling to the CS major - similar intellectual domains but less focus on coding
An interdisciplinary major that uses the lenses of CS, Philosophy, Psychology and Linguistics to study systems that use symbols to represent information. In Symsys you can concentrate on AI, Neuroscience, Natural Language, Philosophical Foundations or design your own concentration.
Big Data - Machine Learning
- Very hot areas in CS these days...
- Big Data
- Machine Learning
- Think about the Ghost project
Ghost Example
- Suppose you show Ghost to your parents
- Ask them how it works
- Like does it "think" about the images?
No!
- But now you know the internal story..
- Break it into a bunch of little numbers
- Programmer has an algorithm, computer follows the code
- This points towards Machine Learning...
Machine Learning Sketch
- This is just a sketch of the idea of Machine Learning
- Machine Learning - computed insights
- Cancer cell grading research
- e.g. Show the computer many example cell slides
- Program the computer to break out many different metrics of each slide
dark/light, dark/light of boundaries, colors, number of cells, texture, ...
- Do not pre-bias the computer about the meaning of the various metrics
- Also give the computer the outcome data associated with each slide
- What if you have a million such slides
- Let the computer recombine all the data, sift out the patterns
- Not insight like a human
- Insight by looking at masses of data, guided by a human plan
Machine Learning - Programmer + Computer
- Machine Learning is solving real problems in the world
- Much more sophisticated math than in Ghost
The math insight / framework is from the programmer
- The computer is sifting through the details
Self-Driving Cars - Machine Learning
- I think this will work someday, at least for freeways
- A vision / radar problem - see all the possible collisions
- Machine Learning to try to recognize the things around the car
Understand Driving from Difficult Case
One difficult case shows how this is not so easy! Shows that even these rare 0.05% cases need to work too.
Where is the Magic in CS?
- The computer seems magic
- Such neat output
- But where is the magic?
Where is the Insight? The Power?
Where is the power in this story?
- You are the power in this story
- You have an insight about a problem to solve in the world
- Your idea makes the algorithm
- Python is just your instrument
- The computer solves a real problem, driven by your idea
- This is great story
Thanks To Elyse and the Section Leaders
Thanks to Elyse and the section leaders! The only way this course can work is with their prodigious and generous efforts. Juliette and the section leaders are a tribe selected for technical skill and generosity - a fantastic group of people and we are lucky to have them.
Fare Well Python Programmers!
In closing, I'll say that teaching this class is very satisfying endeavor - it's great to see the light in someone's eyes when the power we know in CS starts working for that student.
Best of luck with your future projects!