Welcome to Lesson 1

Learning Objectives for Today's Lesson

By the end of today's lesson, you will know...
  • The Growth Mindset
  • Why study computer science?
  • Policies and procedures for this class
  • Name and describe the five main components of a computer.
  • Describe the difference between hardware and software.
  • Give the definition of an algorithm and write your own algorithms for tasks.
  • Describe the difference between natural (human) and programming languages.
  • Describe and define a compiler.
  • Change numbers in the decimal system to the binary system and vice versa.

1. Welcome to the Class!

Congratulations! You are making a smart decision to take a course in computer science. Here's why:

Why Study Computer Science?

1. Studying Computer Science will make you smarter.
  • You will learn a whole new way of thinking and solving problems.
  • Computer science is challenging and will help you exercise your brain.
  • Salman Khan, of the Khan Academy:
    • Wrote an article called "The Learning Myth: Why I Will Never Tell My Son He Is Smart
    • No one is born knowing how to do anything. We get smarter as we learn.
    • "The brain is like a muscle; the more you use it, the more it grows."
    • "[N]eural connections form and deepen most when we make mistakes doing difficult tasks rather than repeatedly having success with easy ones."
    • "Our intelligence is not fixed, and the best way we can grow our intelligence is to embrace tasks where we might struggle and fail."
    • You can learn anything! (as long as you are prepared to try, struggle and sometimes to fail).
    • ***This is the philosophy with which I would like us to approach this class!***

Everybody in the country should learn how to program a computer because it teaches you how to thing. - Steve Jobs

  • Remember: You learn more when you answer a question wrong than when you answer it right!

2. Studying Computer Science is FUN!
  • Computer science is a lot of fun if you are the type of person who enjoys creating things and solving puzzles.
  • If you don't enjoy those kinds of things now, maybe you will by the end of the class.
  • From the first day: Lots of hands on activities.
  • Every class you will be creating your own programs.

3. You Can Get a High-Paying Job

Bureau of Labor Statistics summary of data regarding recent college grads

Statistics for software engineers locally:

Comparison with Other Types of Employment:

Recent Grad Salaries at Top Companies:

Plus, many job perks such as free snacks and food, free laundry, flexible schedules, telecommuting opportunities and more!

4. Computer Science Is Important In Any Career Path

  • Learning how to program is an important skill for any field.
  • You don't have to be a software engineer to use your programming skills.
  • Some examples, based on possible student interests:
Medical Field
  • New York Times Article by David Patterson, a CS Prof at UC Berkeley: "Computer scientists may have the best skills to fight cancer in the next decade — and they should be signing up in droves." Computer programs can sequence the genes of a patient's tumor to determine which medications will be most effective. Programmers are changing the way cancer is treated.
  • January 2018 NPR article on cancer vaccines using computer programming
  • Another NYT Article, this time by Austin Frakht entitled Your New Medical Team: Algorithms and Physicians: Doctors assisted by computers can provide more accurate diagnosis of patient conditions.
Professional Sports
  • Sports statisticians using programming skills to help them analyze data about professional sports and make recommendations to coaches.
Space and Aviation
The Environment
Art and Literature
  • Artists and writers can create interactive works of art and fiction using programming skills. Here is an example of interactive fiction by famous author Emily Short.
You might not think that programmers are artistis, but programmings is an extremely creative profession. It's logic-based creativity - John Romero, Game Programmer (Doom)


  • Important fields that combine knowledge of psychology and computer science:
  •  Human Computer Interaction (HCI) - the study, planning, design and uses of interfaces between humans and computers.
  • Cognitive Science - the interdisciplinary study of the human mind and its processes. In this field, computers are used to simulate the human brain, enhance its thinking powers or to help scientists test their theories about human thinking. Cognitive scientists often take many programming classes. (More information)
  • E-agriculture is an emerging field focused on enhancing agriculture through the use of technology. For example, designing programs to help model ways of increasing crop yields.
Video games
  • Learn how to design and program your own games!

Learning how to program will open up a lot of opportunities for you!: 

2. Introduction to the Course

1. 36A vs 35A

2. Course Format

  • 2 Lessons Assigned per Week - released on Sunday
    • Watch lesson videos on Canvas
    • Complete Activities for first lesson due Tuesday at 11:59pm
    • Complete Activities for second lesson due Thursday at 11:59pm
  • 2 Assignments per week
    • first Assignment due Friday at 11:59pm
    • second Assignment due the following Tuesday at 11:59pm
    • Assignments to be completed in pairs following rules of pair programming outlined in class
    • Find a partner using Piazza and meet up using Zoom
3. My advice
  • This class will get harder as it goes along
    • As you learn more, there is more you can do
  • Do your work the night it is assigned
    • You will have plenty of time to get help
  • Get help right away!
    • Email... office hours... TA office hours... piazza
  • Expect to get stuck sometimes
    • Computer Science is challenging!
    • It is perfectly normal to find something hard.
    • You can do it! But, don't put off getting help!
  • Don't be intimidated by those who have studied computer science before

Activity 1.1: The Growth Mindset (10 pts)

  • Watch the video by Salman Kahn and read the associated article.
  • Then, watch this video where Kahn interviews Stanford's Carol Dweck, who researched growth mindset.
  • Then, answer the questions on the below worksheet
  • Upload your completed assignment to Canvas as a pdf, doc, docx, txt, or odt file

Activity 1.2: How to Make Friends with Stress (10 pts)

  • Watch the video by Dr Kelly McDonigal
  • Then, answer the questions on the below worksheet
  • Upload your completed assignment to Canvas as a pdf, doc, docx, txt, or odt file

3. Main Components of a Computer

Background Information

  • Computer Science focuses on the design and creation of computer software
  • Computer Engineering focuses on the design and creation of computer hardware.
  • Although we are studying Computer Science (software), it is still important for us to have a general understanding of computer hardware.

Computer Hardware

    • Input device(s) - allow a user to communicate to a computer. Mouse, keyboard.
    • Output device(s) - allow computer to communicate to you. Screen (Monitor), Printer. Speakers.
    • CPU - Central Processing Unit - the "brain" of the computer. Executes programs, performs simple calculations, moves data from one memory location to another.
the 5 components of the computer

  • Main memory - Also known as RAM or Random Access Memory. This is the memory that people refer to when they say "How much memory does your computer have?" 
    • Main memory consists of numbered memory locations. Each location in memory is given an "address." The RAM can access each memory location directly by going to that "address." 
    • Think of the RAM as the computer's scratch paper or short term memory. It doesn't store information permanently there. But, uses the memory addresses to temporarily store information it needs as it does its calculations.
the computer memory organized into slots with addresses

  • Secondary memory - This is the permanent memory. The hard disk, CDs, Flash drives, external hard drives. Can you think of anything else?
    • Memory here is stored as files. Secondary memory is generally slower because the computer must search through memory locations sequentially to find a file. Unlike the RAM, the computer cannot access a file directly by its address in secondary memory.

More Information

  • PC World article on the difference between the hard drive (HD) and a solid state drive (SSD)

Group Activity: Where are the different components located on your computer?

  1. Input devices
  2. Output devices
  3. CPU
  4. Main memory
  5. Secondary memory
Q: How many programmers does it take to change a lightbulb? A: None. It's a hardware problem

4.1. Computer Software and Algorithms


    • Program - a sequence of instructions given to a computer. These instructions are executed in order by the Central Processing Unit (CPU).
    • The computer follows the instructions in the program to complete some task.
    • In the Hour of Code, the instructions you give your character are executed in order.
Hour of Code puzzle


  • Programs are often based on algorithms which are converted into code by the programmer.
  • An algorithm is a sequence of precise instructions on how to accomplish a task
  • The process of developing algorithms is much in demand in today's computerized world
  • For example:
    • Game characters follow algorithms to respond to game events.
    • Medical equipment measures and monitors people's medical conditions following algorithms.
    • Day Traders on Wall Street write computer algorithms to decide when to buy and sell stocks.
  • In everyday life we can develop algorithmic solutions to natural problems and improve our lives.
  • For example, we may develop an algorithm for the easiest or most efficient way to get to school.
  • To develop an algorithm, we start with an analysis and decompose the problem into steps.
  • When we have an algorithm for one problem, we then generalize it to solve similar problems.
  • Examples of algorithms:
    1. A recipe is an algorithm created so others can replicate a dish
    2. When a composer writes music, she is creating an algorithm to play a song
    3. A coach creates a play in a team sport, like football or soccer, which is an algorithm for the players to follow during a game.
    4. In mathematics, people follow algorithms for math operations such as adding numbers with several columns of digits:
      1. Add the numbers in each column
      2. Then add the partial sums
Algorithm: Step by step instructions to solve a problem

How to Write an Algorithm

  • When we design algorithms, we need to write them simply so anyone can use them
  • This means that we cannot have long formulas or compound statements that are difficult to understand
  • Instead we must break everything down into simple steps
  • Every statement can only say how to do one simple thing
  • A good first approach is to work out an example. Then, try to generalize from the example.
  • As we will see, this is how computers work

Activity 1.1: Sandwich Algorithm (10 pts)

  • Imagine that you have a friend who has never made a sandwich before.
  • Can you give step-by-step instructions for how to make a peanut butter sandwich?
  • Copy and paste the contents of this worksheet into a blank document (MS Word or another Google doc).
  • Write your name at the top.
  • Fill in the remaining steps for making a peanut butter sandwich
    • Try to write your own algorithm - don't just copy off the internet
  • When you are finished, upload your worksheet to Canvas under Activity 1.1

4.2. Programming Languages and the Compiler

  • What are some examples of languages you speak?
    • These languages are used to communicate with people.
  • Programming languages are similar to human languages, but are designed to communicate with machines.
    • Used to communicate instructions to the computer.
  • The problem: Computers only understand 1s and 0s.
  • Difficult for humans to understand 1s and 0s.
  • We need a translator!
  • Java is a programming language which was created because it is easy for humans to use and understand. It is called a high-level language. Computers cannot understand Java directly because the instructions are not written in 1s and 0s.
  • Other high level languages include PHP, Python, C, C++.
  • Instructions written in these languages are called source code.
  • Programs written in these languages need to be translated into a format the computer can understand.
  • Compiler is a program that translates a high-level language program, such as a Java program, into a machine-language program that the computer can directly understand and execute.
  • Compilers are also useful because they let you know when you have made certain types of mistakes in your program.
Compilers translate source code into machine executable code and also generate error reports

5. Introduction to Binary Numbers - The Language Computers Understand

  • Video: How Computers Work Part 1
  • Bit = a binary digit = one 0 or 1 digit.
  • Byte = 8 bits
  • Why does a computer understand only 0s and 1s?
  • Understanding Base 10 (Decimal) (on white board)
  • Understanding Base 2 (Binary) (on white board)
Image showing one hobbit and 8 hobbits (a hobyte)

Activity 1.2: Binary and Decimal Worksheet (10 pts)
  • Copy and paste the binary-decimal worksheet into a new document on Word, Open Office, Libre Office, Notepad or Google Docs.
  • Convert the given binary numbers to decimal numbers and decimal numbers to binary numbers
  • Please show your steps
  • Upload the completed worksheet to Canvas when you are finished under Activity 1.2.

Wrap Up

  • Answer the following questions:
    1. What are the five main components of a computer?
    2. What is the difference between hardware and software?
    3. What is an algorithm? What is a program? How are they different?
    4. Why does a computer only understand 1s and 0s?
    5. Define a programming language
    6. What is a compiler?

Upcoming Assignments

  • Activity 1.1 and 1.2 due Tuesday at 11:59pm
  • Quiz 1 due Friday at 11:59pm on Canvas
  • Assignment 1 due Friday at 11:59pm on Canvas

~ Have a Great Day! ~