Coding for Social Good

Fall 2021 Lathrop 292 Th 2:45p

CS 106S is a survey course on the applications of fundamental computer science concepts from CS 106B/X to problems in the social good space (such as health, government, education, and environment). Each week consists of in-class activities designed by student groups, local tech companies, and nonprofits. Some of the topics we will cover include mental health chatbots, tumor classification with basic machine learning, sentiment analysis of tweets on refugees, and matching algorithms in the context of COVID-19. Recommended prerequisite/corequisite: CS 106B or CS 106X.



Thanks for coming the first class! We've posted slides, starter code, and solutions for the first lecture in the syllabus section below. We're sorry about the audio issues for those who participated on Zoom. We're working on getting it sorted out for next week.


Welcome to CS106S! Our first class will be Thursday September 23, 2021 at 2:45 P.M. PDT in Lathrop 292, though we encourage you to participate via Zoom. (We emailed you the Zoom link; send us an email if you can't find it!) We can't wait to see you in class!

Course Details

We're looking forward to a great quarter with you in CS106S! We know you are being equipped with the tools to make super cool stuff. However, sometimes it is difficult to see where these tools fit in the larger scheme of things. We want to show you ways to put the skills you have learned to good social use! Here are our objectives:

  • Awareness: For students to gain awareness about the applicability of technology and computer science to enact social good in the world.
  • Exposure: For students to learn how to utilize their skills to build tools and projects that create positive social impact.
  • Utilization: For students to gain exposure to the variety of current projects and efforts to use computer science for social good.

Now, let's get into some important details: expectations, grading, and meeting time!

Student Expectations

Students are expected to attend class each week (in person or on Zoom) and participate in class lectures, discussions, and exercises. Every week will have a check-off form with some simple questions from class and feedback prompts for the teaching team. This will be the way we check your attendance.


Students will be graded on the basis of attendance and participation. Participation and attending a minimum of 8 out of 9 classes are requirements to receive credit. In the case that a student will miss more than one class due to extenuating circumstances, please contact the teaching staff to receive an excused absence (e.g., illness).

Meeting Time & Coursework

CS106S will meet every Thursday afternoon from 2:45p to 4:45p PT. The course will meet in-person in Lathrop 292, though we encourage you to join via Zoom. (The link was sent out to all enrolled students via email; send us an email if you don't have the link.) Students will receive 1 unit of S/NC credit. Except in cases where students miss class (which we will handle on a case by case basis), no work will be required outside of our class meetings.


We welcome auditors! Send an email to cs106s-aut2122-staff@lists.stanford.edu to be added to the mailing list and to receive the Zoom link. Due to space constraints and social distancing limitations, we can't accomodate auditors in-person.

Stanford Policies

All students are expected to abide by Stanford’s Honor Code and to wear a mask if attending in-person.

Students with Documented Disabilities

Students who may need an academic accommodation based on the impact of a disability must initiate the request with the Office of Accessible Education (OAE). Professional staff will evaluate the request with required documentation, recommend reasonable accommodations, and prepare an Accommodation Letter for faculty dated in the current quarter in which the request is being made. Students should contact the OAE as soon as possible since timely notice is needed to coordinate accommodations. The OAE is located at 563 Salvatierra Walk (phone: 650-723-1066)


Headshot of Matthew Early

Matthew Early

Headshot of Miles McCain

Miles McCain

Headshot of Dr. Katie Creel

Dr. Katie Creel

Headshot of Andy Jin

Andy Jin

Placeholder image for Cooper

Cooper De Nicola

Questions? Contact us at cs106s-aut2122-staff@lists.stanford.edu!


Note: this syllabus is subject to change.

Week 1

Introduction to JavaScript — 9/23, Matthew and Miles — Slides Starter Code Solution

Week 2

What is Social Good? — 9/30, Dr. Katie Creel — Slides

Week 3

Sentiment Analysis and Refugee Tweets — 10/7, Matthew — Slides Starter Code Solution (Basic) Solution (TF-IDF, Advanced)

Week 4

Open Source Software and Social Good — 10/14, Miles — Slides

Week 5

Cancer Diagnosis with K-nearest Neighbors — 10/21, Matthew

Week 6

COMPAS and Algorithmic Bias — 10/28, Miles

Week 7

Cryptography / Matching Algorithms — 11/4, Cooper

Week 8

ELIZA — 11/11, Andy

Week 9

CS + Social Good Speaker Panel — 11/18, teaching staff

Week 10

No class!

AMA Responses

Thanks for sending all your questions in! We've compiled our responses below. Feel free to reach out to us or ask in class if you have additional questions!

What's a good class to take after 106B for someone who's not a CS major but wants to keep some CS skills without spending tooooo much time on homework? New

Carta's hours-per-week feature is definitely your friend here. :D Here are some of my suggestions:

  • CS 51 + CS 52! CS Studio is a really fun class and great way to use your CS skills for social good! Definitely more going on than in this class, since you are expected to build something by the end, but you will have a team to support you and there's no letter grade at stake. Applications will probably open in the next couple of weeks -- join our mailing list to get notified when they open!
  • CS 106L, if you're interested in learning C++ standard libraries (that is, what's used in the "real world," not just the Stanford version you see in 106B).
  • CS 109, if you're okay/good with math/probability. 109 has a reputation of being the chillest class in the CS core. At the end you do some really cool machine learning stuff that totally blew me away! That said, it is still a 5 unit class, and the only all-nighter I've ever had to pull was when I severely underestimated how long the last 109 homework would take.
  • CS 124, if you're interested in NLP (e.g., if you thought week 3 of this class was interesting!). It's 4 units and generally pretty chill, with the exception of the first assignment (writing a ton of regex) and the final (group) project (building a pretty robust chatbot).
  • CS 182, if you're interested in ethics (which I assume you are if you're in this class!) and are okay with writing. I haven't taken this class yet (although it's definitely on my list!), but my friends who have said it is fairly similar to stuff we will be talking about week 6.
Can sentiment analysis be applied to things such as emojis and other characters? New

Yes, absolutely! You could treat the emojis (or whatever character(s) in question) just like how we treated the words in class week 3 and do the exact same process! Of course, you will need data that comes from a source that has a lot of emojis, but Twitter definitely fits that bill!

Are there any good internship opportunities that fit with the material covered in this class? New

Yes!! Definitely keep an eye out for CS+SG's fellowships program! This is a program where the fellowship subteam matches students who apply with local non-profits/companies that have a social good-based mission to work together in a summer internship. Applications will open in winter (probably mid January), and you should join our mailing list to get the latest info!

What major(s) should I consider if I'd like to know more about ethics & CS?

Great question! While there are lots of ways to engage with ethics within the CS major, you might also consider Symbolic Systems and STS (Science, Technology, and Society) if you'd like to embed ethics even more deeply in your undergraduate education. You might also consider looking at the Ethics in Society program, which offers an Ethics and Technology minor.

Where is the best place to learn more about the M-E-R-N stack mentioned in week 1?

The MERN stack is a great way to build an entirely JavaScript web application. You can learn more about it here.

Does social good always come at the cost of profit?

That's a big question. You should talk about it with Katie!

What is CS + Social Good? What does CS+Social Good do as a club? How do people get involved? What are some sample projects and their measurable impact?

Thanks for these great questions! Our mission is to create a community of technologists, designers, and thinkers passionate about maximizing the benefits of technology and mitigating its harms. Our end-of-year booklet highlights all our key initiatives, projects, and impact from the most recent school year: bit.ly/cssg-eoy-2021.

To summarize, we lead several student-run courses (CS 106S, CS 51+52 "Studio", CS 21SI "AI for Social Good"), the tech-for-good Fellowships program, discussions, education outreach, and Impact Lab (which is a research lab connecting students to tech for good projects).

To stay updated on our events and projects, join our mailing list by signing up here — bit.ly/cssg-interest-2122. If you'd like to join CS+Social Good, our applications are currently open till Saturday, October 2nd, at bit.ly/cssg2122. Note that you do not need to join CS+SG to attend discussions events, or apply for opportunities like Fellowships, Impact Lab, or Studio.

How competent do you have to be in coding to be involved with CS for Social Good?

Not very - as long as you are comfortable with CS106A-level material (e.g., loops, conditionals, arrays), you will be fine!

Any good internships for frosh with up to CS 106B experience? Any faculty willing to do research for the same frosh?

What a great opportunity for some self-promo!

I would strongly recommend you apply to CS+SG's fellowship and/or Impact Lab programs! The CS+SG fellowship program tries to match Stanford students with local social-good-adjacent non-profits looking for would-be interns with some CS experience to help them over the summer. Impact Lab is a CS+SG program that pairs CS students with social-impact-focused Stanford research projects. Both are fantastic opportunities that frosh have often been involved in in the past, including frosh with no prior intern/research experience.

And speaking of various CS+SG programs, I can't forget about Studio! Studio is a two-quarter pair of CS courses (CS 51 and CS 52, winter and spring). In the first quarter, students work with local community partner organizations to identify a problem and plan an app/website/whatever to go about trying to solve it, while in the second quarter, students actually implement their project.

Fellowships and Impact Lab will have their application cycle in Winter, and Studio applications will be due mid/late October. For more info on when applications are due, you should definitely join the CS+SG mailing list at bit.ly/cssg-interest-2122!

The CS department also has the CURIS program for undergrad research. If you're interested in research, this is a great way to get first-hand experience; some projects may require a more substantial background (e.g., the AI/ML ones), but definitely check out the offerings and reach out to professors of the ones you're interested in.

How does JavaScript interact with other scripts from languages like Python?

There are a few ways that you can use JavaScript to complement code in other languages, like Python. The most common situation where JavaScript enters the mix is when you have a website running on a server somewhere and that server code is written in a different language, like Python. (If this is confusing for you, don't worry! This is a more advanced topic for future classes.) If you want your website to be interactive, however, you'll need to write code that runs in the browser — and that's where JavaScript comes in.

Using technologies like Node.js also makes it possible for you to run JavaScript scripts outside of the browser, so you're not limited to using your new JavaScript skills just for websites.

(If you're curious, it's also possible to run JavaScript in Python scripts and vice versa using subprocesses, but don't worry about this. It's something you learn in CS 110/111.)

What is CS 106M like?

Unfortunately none of us really have a sense of what 106M is like, as it didn’t exist when any of us took 106B. From looking at the website, my impression is that 106M is more focused on implementing algorithms, whereas 106S focuses more on topics that we are able to tie back to social good. And to be clear: it’s not our intention for students to only be able to take one of 106S or 106M — the two classes just happened to be scheduled at the same time this quarter, and there’s not really anything we can do about it. :(

Are there tutorials / office hours?

Since CS 106S is a 1-unit S/NC class, we don’t have formal office hours. That being said, if you want to meet with the teaching team, feel free to send us an email or find us after class!

Difficulty of getting into CS coterm as a non-CS major? I am a history major and I want to have a good strategy for applying.

The most important thing is to have done a solid chunk of the CS core (and ideally some electives as well) and to have done well in them. Additional tips would be to highlight the reasons you wish to pursue a CS coterm, such as opening up career opportunities, as well as articulate the general direction you wish to steer your coterm toward, such as specific tracks and even classes. For non-CS majors, you could explore how having a more technical background through the COterm could help you pursue your primary/additional fields of interest, such as history, with greater depth and insight. That said, the most important thing for CS Coterm is to have a strong track record of performance in CS classes—both core and non-core.

Can we make a class chat? I'd love to see if other people in the class would want to work on some projects together (outside of class).

You’re absolutely welcome to create a student group chat! We encourage someone in the class to create a GroupMe. While this would be an unofficial student group chat (that is, the teaching team wouldn’t be in it), we think it’d be a great way for you all to foster community.