cs 105: intro to computing, non-technical · 2020-07-07 · cs 105: intro to computing,...

35
CS 105: INTRO TO COMPUTING, NON-TECHNICAL Max Fowler (Computer Science) https://pages.github-dev.cs.illinois.edu/cs-105/web/ June 14, 2020

Upload: others

Post on 12-Jul-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

CS 105: INTRO TO COMPUTING,

NON-TECHNICAL

Max Fowler (Computer Science)

https://pages.github-dev.cs.illinois.edu/cs-105/web/

June 14, 2020

Page 2: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Video Series One Topics

What are the goals of this course (and why care?)

A few notes about the course

Computer and Programming Language Basics

Types and Type Conversion

Input vs Print

Page 3: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Goals

Page 4: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

What is Computer Science, anyways?

“Computers are to Computer Science what telescopes are to astronomy”

– Edsger Dijkstra

CS is concerned with understanding…

What is computable

How to [specify computation, perform computation, communicate between

computers] in the [fastest, most reliable, most secure, cheapest/lowest

resource] way

How to help humans solve problems with computers

Page 5: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

What are the course's learning objectives?

1. Given a small (5-10 line) Python program, students should be able to execute the

program in their head and correctly predict the outcome.

2. Given a small (5-10 line) Python function, students should be able to provide a

natural language description of what the function does.

3. Students should be able to write short (5-10 line) Python programs, including the

use of variables, expressions, conditionals, loops, and functions.

4. Students should be able to use built-in Python data structures including strings, lists,

and dictionaries.

5. Students should be aware of intermediate programming concepts including modules,

exception handling, user-defined types (classes)

6. Students should be capable of using basic and intermediate spreadsheet

operations (including INDEX, MATCH, and VLOOKUP), writing simple HTML

documents, and performing simple data analysis tasks.

Page 6: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

What is "Programming?"

A series of instructions that

can be carried out by a

computer

A startlingly useful skill

A skill that is useful even to

be "aware" of http://www.programmingbasics.org/en/beginner/img/commands4.png

Page 7: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Other terms for Programs

Programs

Software

Applications

Code

But not

"codes"!!

https://www.geeksforgeeks.org/caesar-cipher-in-cryptography/

https://twitter.com/m4tt/status/1138029336198561792

Page 8: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Programs do many things

Page 9: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Three parts of a program

Algorithms

A step-by-step process for achieving a result

Often written in pseudo-code

Ignore details

Increase generality

Programming

Express the commands in a form the computer understands

Testing and Debugging

Make sure the program works

And works correctly

Every time you run it

Page 10: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Why do we need programming languages?

"I saw the man in the park with the telescope"

Who had the telescope?

Who was in the park?

"With my telescope, I saw a man standing in a park…"

"I saw a man with a telescope standing across the street in the park…"

"While I was in the park with my telescope, I saw the man…"

Page 11: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Programming languages -> exact and unambiguous

Everything has a precise FORM (syntax) and precise

MEANING (semantics)

Syntax: Rules of what are acceptable programs

Semantics: Rules specifying WHAT a program does

Page 12: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

This is all are largely arbitrary

Humans and programming languages are human made

If you haven't seen this before, there isn't any reason why you should know any of it right away

Easiest bugs to find? The ones you've made before

No shortcut around mistakes

Even experts make mistakes…

Page 13: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Video Question – what is an algorithm?

Page 14: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Notes about the course

Page 15: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Do…

Give the course website a read – particularly the

syllabus and announcements!

Sign up for Piazza, get access to Prairie Learn, buy

the book, etc. -> details in the first announcement

Check the course calendar – the due dates are

already up for the summer!

Page 16: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

What is known about teaching and learning

No one can pay attention for 90 continuous minutes

Video snippets, rather than "a video" or "two videos"

Attention span? About 10-15 minutes

Watch with some focus

"Time on task" is a primary factor of how much gets learned

The course is intended to give you productive things to do

Doing is better for learning than reading or listening

Expending mental energy enables things to "stick"

Page 17: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

What is known about teaching and learning

You can most efficiently learn…

Things related to what you know

Things that are only slightly harder than the things you can already do

Long term retention comes from repeated, distributed practice

Best retention – a cycle of forgetting and re-learning

Best spaced in time: cramming will not produce long term retention

Page 18: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

What is the homework policy in CS 105?

Learning benefits from collaboration…

The extreme end – hire a stranger to tell you what

to type into homework

Page 19: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Formative vs Summative Assessment

Practice/Formative Assessment

Intended for learning, self-evaluation

In 105, this is the homework, reading activities, and labs

You may get help from ANYONE – but you need to type your answer

Summative Assessment

Evaluate how much has been learned

In 105 – The quizzes and the final

Has to be done by yourself (with limited materials)

Page 20: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

What are the quizzes and exams?

7 quizzes using the Computer-Based Testing Facility's online proctoring (every Monday from 6/22 onward)

Sign-up with CBTF proctoring

https://cbtf.engr.illinois.edu/sched

50 minutes

The final – one three hour "mega quiz" (although not strictly "three times" as large), time TBD

Page 21: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Video Question – what is the homework policy?

Page 22: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Computer & Programming Language Basics

Page 23: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

The major parts

Page 24: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Computers…

How many instructions a second can computers

execute?

Hundreds? Thousands? Millions?

GHz – billions of things a second!

Are computers "smart"?

No, they're dumb – and do exactly what you tell

them to do

Page 25: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Computers are dumb

On a "Linux" system

rm –rf / removes everything in "root", the / directory

Imagine deleting everything on your machine and not having an undo button…

https://jerrygamblin.com/2016/10/16/rm-rf-

still-works-on-osx/

Page 26: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Computers run low-level instructions

Computers don't "Play Despacito"

Instead, they…

Move a number from one storage to another

Add two numbers

Check if one number is larger than another

Go to a different place in code

Programming at this level…

Is tedious, error prone

Needs a LOT of code to do anything

Isn't portable – each processor type has their own "stuff"

Page 27: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

High-level Languages (like Python!)

Productive, safer, portable

Why Python? Super useful language, gentle learning curve

Once you've learned a language, it is easier to learn others!

We use Python 3 (not Python 2)

Interpreted language

Page 28: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

28

A

E

D

C

B

Where does Python run on the computer?

Page 29: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Video Question – which of the following is NOT

something a computer does as an instruction?

Page 30: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Types and Type Conversion

Page 31: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Python values have types

Early into the class, we'll meet two types: Strings: e.g., our string literals like “Hello CS 105!”

Integers: whole numbers of arbitrary precision

You can ask a value what its type is using: type(expression)

You can convert between them with str() and int()

It is important that you keep track of the types of your values!

31

Page 32: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Video Question – what is the type of x if x is

assigned using x = 23?

Page 33: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Input vs Print

Page 34: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Input vs print

input() gets user input (from a prompt) and returns a string

We can use input() empty OR with a prompt

print() prints OUTPUT to the screen – usually the same screen where

we get our input from!

What if I want to get a number input?

Page 35: CS 105: Intro to Computing, Non-Technical · 2020-07-07 · CS 105: Intro to Computing, Non-Technical Author: Anonymous Reviewer Created Date: 6/14/2020 9:44:15 PM

Video question on print

Assuming there is a variable value with the value 7, which of the

following statements prints: count = 7

A) print(“count =” value)

B) print(“count =”, end=“value”)

C) print(“count =”, value)

D) print(“count =” + value)

E) print(“count = $value”)