Today: Last lecture, 3x tech and society, your future in CS, conclusions
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.
Thanks To Juliette and the Section Leaders
Thanks to Juliette 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.
Office Hours Today + Thu
I have office hours right after class today and Juliette will be joining us, and I also have hours Thu. Please feel free to stop by for any sort of discussion you are interested in.
Data Art Show
Thanks to all those who submitted data art. Here are the category winners..
Data Art Show Winners
A last tech / society question...
How Does Python Exist?
You have noticed that Python works well on your machine, and yet it's free. How does that work?
Python is a great example of "open source" software.
Much of the internet is based on open standards - TCP/IP, HTML, JPEG - and open source software: Python (language), Linux (operating system), R (statistics system).
How Open Source Works:
Let's look at Python
Open Source License - Contributions
- Python is distributed for free
- The "source code" is the code to produce Python itself
- Python has an "open source" license
Basically encourages contributing improvements back to Python source code
- There are many variations in open source licenses, but free and "contribute-back" are the keys
Open Source Economics
- This is an incredibly successful model
- Anyone can build their work on Python, free, not dependent on one vendor
e.g. Build on Microsoft Visual Basic
Microsoft charged for it
And eventually they discontinued it
Building your expensive technology depending on one vendor looks bad!
- Google, Microsoft, and Apple .. all compete with each other
- But they all use Python
- All contribute to it
- Open source: common infrastructure, we'll all use, nobody's competitive advantage
- Advantage: notice lack of duplication of effort
Apple, Microsoft, Google .. all using the same infrastructure code!
This creates some value, not duplicating effort
- Obviously in other domains they have their own tech and compete
3 High level thoughts about CS106A..
1. How Far Have You Come?
- CS106A - learn by doing
- CS106A - a series of hurdles
Each hurdle a little higher than your comfort level
Always practicing the next thing
- As a result, always feel a little off-balance
- Look back over the 10 weeks .
Appreciate what a long way you've come
- You are now a Python programmer
Functions, strings, lists, indexing, loops, if, variables, booleans, tests, ..
2. Have You Learned All Programming Features?
No!
Python and the space of all programming techniques is huge. A bigger space than you might think.
What's most important is that you have learned the core: loops, lists, strings, functions, tests. 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.
3. What is the Central Technique of CS?
- What is the central technique of CS?
- Is it Loops?
- My guess: work on a broken system, fixing it
What Do You Do With Broken Code?
- Normal state of project - broken
- Wrong: look for silver bullet fix
- Right:
Run code, it doesn't work right
Try it, look at output
Look at code, think about it
Try something, run again
- What is this skill?
Patience?
Systematic in the face of chaos?
- A very big picture take-away from CS106A
Aside: The LaIR
- You might think everyone else just types in their code perfect
- There is a physical space on campus, the LaIR
- It is not fancy!
- You are there, looking at your broken code
- You look out .. see 25 other people with broken code
- Don't think it's just you spending time working out bugs!
CS106A - future paths..
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
Women in CS Trend
Slide from Mehran Sahami, Stanford CS-Education. The bars is number of students, the line is percentage of women - both are going up which is great, I interpret as a slow broadening of the field.
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
High programmer pay is also a symptom 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
Story: I was on a bicycle, wearing ratty clothes and a "Python" t-shirt stopped for a red light. A passerby in walking in the cross-walk stopped, turned to me and asked if I was looking for work.
Like how desperate for programmers was that guy? Conclusion: programmer shortage!
Pre CS106B chat..
Key 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, collections
- Good programming style:
Divide and conquer, decomposition
Testing functions
Readability
Your Second Programming Language
- There are many computer languages
- Other languages: C++, Javascript .. have the same elements as Python
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++ or Java .. easy to pick up
Here is some C++ code
// comments start with 2 slashes
int i = 0; // declare type of var
while (true) { // curly braces
i += 1; // same as py, semicolons
if (i == 100) { // same as py + braces
break;
}
i += "Hello"; // error detected
// int/string types different,
// Error is flagged at edit-time:
// earlier than python, an improvement
}
- C++ code looks different
- Actually 80% familiar
- Picking up C++ will be no problem
- Advantage of heavier syntax: more auto error checking
- Also C++ runs much faster than Python
- Disadvantage: more to type in
- Fun fact: Python 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.
Next "CS106" CS106B
- The next step in CS - mixture of coding and CS
- Coding is a bit harder and more impressive
- Could take in the next quarter or two
- 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
Scientific Python CME 193
- Python and scientific computing
- Applied (vs. CS fundamentals)
- See CME193
CS129 Applied Machine Learning
Map of CS Major
- Programming core sequence:
CS106A, CS106B, CS107, CS110
- CS Mathematical core sequence:
CS103, CS109, CS161 (integer mathematics, probability)
- Then there are more courses in an area of concentration
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 - like code, like helping people
- Open secret: SLs pick up fantastic skills
debugging, organizing ideas, public speaking, confidence
CS Major Tracks / Concentrations
- If interested in majoring in CS
- Undergraduate CS concentration areas:
Artificial Intelligence (AI)
Human Computer Interaction (HCI)
Systems
Graphics
Biocomputation, (others)
- 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
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
- 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
- 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
- "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
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
- Office hours right after class + thu
Feel free to reach out or come by, chat about anything
In closing, I'll say that teaching this class is very satisfying endeavor - it's great to see the light in someone's eyes (even on Zoom!) when the power we know in CS starts working for that student.
Best of luck with your future projects!