CS 111: Program Design I Lecture 1: Introduction

Transcription

CS 111: Program Design ILecture 1: IntroductionRobert H. Sloan & Richard WarnerUniversity of Illinois at ChicagoAugust 23, 2016

Randall Munroe, XKCD, http://xkcd.com/863/FIRST: WHICH COMPUTERSCIENCE CLASS?

UIC CS ClassesnCS 100, Discovering Computer Science:qnCS for fun, no credit if in College of EngineeringCS 111, Program Design I (This course!)qStudents with little to no programmingexperience whonnnAre CS majors or minors, or CoE students planning touse CS 111–141, or any students wanting to learn moreNow in three flavors! (This is the “law” flavor)CS 141, Program Design II: If you alreadyhave programming experience

3 Versions of CS 111nLaw Themed: 11–12:15 am, 120 THqnGreen (Bio themed): 2–3:15 pm, 120 TH.qnTeam taught by Profs. Robert Sloan (UIC CS) andRichard Warner (Chicago-Kent Law School)Team taught by Profs. Tanya Berger-Wolf (CS)and Boris Igic (BioS)Traditional (media themed): 2–3:15 pm, 145BSB.qCS Prof. Pat Troy

What will everybody do in CS 111?nLearn the basics of programming in PythonqqqqnVery popular programming language, commonlyusedEasy to read and understandGreat for CS1 because can see realistic examplesearlierMore about “Why Python” soonAnd

One of (based on section)nUse media computationqnSolve biological problemsqnDraw pictures, manipulate images, manipulatesound filesE.g., DNA analysisInvestigate legal and privacy issuesqE.g., build heat maps of Chicago gun crime hotspots and discuss Chicago’s predictive policing;write encryption & discuss crypto law/policy

What if I already have programmingexperience? CS 111 Proficiency ExamnWed., Aug. 24th @ 9am, Rm 1000 SEOqnnnPlease sign up at bit.ly/cs111examWrite a single, complete program using penciland paperLanguage should be “C-derivative” (Python,C, C , Java, PHP, etc.)Should show you understand: Variables,loops, if statements, arrays (or perhaps lists ifPython), function calls

NEXT:A LITTLE BORING LOGISTICSSTUFF

Instructors: Robert Sloan & RichardWarnernSloan: UIC CS Prof.qqnCurrent Research: Policy & Legal issues relatingto electronic security & Privacy; ComputerScience EducationIn past: Theoretical CS, AI, Cryptography,SecurityWarner: IIT Chicago-Kent Law School Prof.qExpertise: Contracts, Philosophy, E-Commerce,Internet, and Privacy Law

Office HoursSloann SEO 1112n Tue 2:00–4:00n And by appointmentWarnern 845 Chicago-KentLaw School, AdamsSt. (about 1.2 miles)n Mondays 12:30–2:00n And by appointment

TAZhu (“Ellen” Wangzwang260@uic.eduLabs: Mon 11-11:50, 12-12:50Office hours: Mon 1-2:30pm & Wed 12-1:30pmPiazza!

Everything is on some websitenBlackboard:grades, assignmentsblackboard.uic.edunCourse website:Syllabus, schedule, readings, lecture slideswww.cs.uic.edu/CS111LawnPiazza: Forum (more next slide)

Use Piazza instead of emailingpiazza.com/uic/fall2016/cs111/homenFor public questions (lab and project questions)qqqnYour classmates benefit from your questionsYour classmates can answer your questionsWe will check the forum frequentlyFor personal questions (grades)qqqCan ask questions to instructors onlyMeans any of us (Profs & TAs) can answer yourquestionAll CS 111 communication is in one place

Clickers!nnnLets you vote on multiple choice questions inreal time.Like pub trivia, except the subject is alwaysCS 111Buy at bookstore unless you already have;register on blackboard before next class!

Register your clicker online so we can giveyou pointsnnIn Blackboard, on the side of the course pageYour votes will be saved before you register,just not associated with you

This classusesPythonRandall Munroe, XKCDhttp://xkcd.com/353/16

Course “Textbook”nHow to Think Like a Computer Scientist:Interactive Edition, selected portions only, notnecessarily in order, online, free (as in beer,not “libre” as we may discuss ic/thinkcspy/index.htmlqnCovers introduction to Python programmingSome assigned readings on legal topics

For Next ClassnRegister for PiazzanRegister your clicker on blackboardnRead first chapter of online textbook:qn“1. General Introduction”If you want to get ahead: Install Python usingour instructions on your machine (else in labMonday)

Randall Munroe, XKCD, http://xkcd.com/1425/INTRODUCTION TOCOMPUTER SCIENCE (CS)

What is computer science?nnnBiology study of living thingsChemistry study of structure andcomposition of matterWhat is computer science the study of?

What is computer science?nnnnBiology study of living thingsChemistry study of structure andcomposition of matterWhat is computer science the study of?Computer Science study of computers!

What is computer science?nnnnnBiology study of living thingsChemistry study of structure andcomposition of matterWhat is computer science the study of?Computer Science study of computers!Computer Science is primarily study of:qProcesses Algorithms Programs Recipes

Some Pioneers’ 1967 Vision of CS“The theory and design of computers,as well asthe study of all the phenomena arisingfrom them”Allen Newell, Alan Perlis, Herb Simon, Science, 1967

Some Pioneers’ 1967 Vision of CS“The theory and design of computers,as well asthe study of all the phenomena arisingfrom them”Allen Newell, Alan Perlis, Herb Simon, Science, 1967Only really big difference today: Design of computers is itsown field: Computer Engineering

CS’sDisciplinaryRootstodayCS’s Disciplinary g."AdditionalconnectionstoAdditionalconnectionsto artsdigitalmedia,law&&entertainment,public policy,business, publicpolicy, " art .business,

What about programming?nnnComputer science programming!But lawyers, researchers, businessexecutives, computer scientists, etc., all studywriting to communicate for at least 13 yearsProgramming is other main way computerscientists communicate; requires extensivestudy

What about programming?nnnnComputer science programming!But lawyers, researchers, businessexecutives, computer scientists, etc., all studywriting to communicate for at least 13 yearsProgramming is other main way computerscientists communicate; requires extensivestudyAlmost all computer scientists spend some oftheir working time programming just asalmost all lawyers spend some time writing

What about programming?nnnnComputer science programming!But lawyers, researchers, businessexecutives, computer scientists, etc., all studywriting to communicate for at least 13 yearsProgramming is other main way computerscientists communicate; requires extensivestudyAlmost all computer scientists spend some oftheir working time programming just asalmost all lawyers spend some time writingqOne ironic exception: Some CS professors!

If Computer Sciencennnis the study of computation, meaningProcesses Algorithms Programs RecipesThen the next question is:

What’s computation good fornnComputer science is the study of recipesComputer scientists study qqqqHow the recipes are written (algorithms, softwareengineering)The units used in the recipes (data structures,databases)What can recipes be written for (systems,intelligent systems, theory)How well the recipes work (human-computerinterfaces)

Key concept:The COMPUTER does the recipe!Make it as hard, tedious, complex as you want!nnnnLook through 100,000 documents in a lawsuit topick out the 17 or the 42,000 containing aparticular phrase? Easy-peasy!Crank through a million genomes? No problem!Find one person on UIC’s 29,000 studentcampus? Yawn!Process a million dots on a screen or a bazillionsound samples?q(What the media computation course will do)

Heading to Python Programs?2 eggs1 c milk1 c sifted flour½ t vanilla extract12 oz. farmer's cheese4 oz. cream cheese,softened⅓ c sugar1 t lemon juice1 t vanilla extract1 egg yolkBatter: Combine eggs, milk, salt and vanillaand blend well. Gradually add flour. Beatwell.Filling: Combine cheeses, sugar, juice, vanillaand egg yolk in a bowl and mix together untilsmooth.Repeat until all the batter is used:Put a ladleful of batter into heated greasedskillet. Tilt pan to swirl the batter so it coversthe bottom of the skillet. Fry on one side untilbubbles form, the top is set, and bottom isgolden brown. Carefully loosen edges of thecrepe and slip it out of the skillet onto a plate.Fill each fried crepe:Place 1 tablespoon of filling on one edge.Roll once to cover filling. Fold sides into thecenter and continue rolling until completelyclosed.After all are assembled, heat 2 tablespoonsof butter in the skillet and place each crepe,seam side down, in the skillet and fry 2minutes on each side, turning once.

Features of recipennnnnnFixed vocab of words, abbreviations, symbolsSyntax: Rules about what can be said &whereSequence of operations to be done in orderSometimes, a repetition of a partAssumed knowledge about contextAn expected result (yum!)

Additional feature of recipesnAnd other common analogies, such asqqKnitting patterns for knittingSheet music for playing music and

Additional feature of recipesnAnd other common analogies, such asqqnKnitting patterns for knittingSheet music for playing music andIf you go to a great restaurant, one with afancy table in the kitchen where you canwatch the chefs all night long, and you gothere 3 times a week for 15 weeks, then:

Additional feature of recipesnAnd other common analogies, such asqqnKnitting patterns for knittingSheet music for playing music andIf you go to a great restaurant, one with afancy table in the kitchen where you canwatch the chefs all night long, and you gothere 3 times a week for 15 weeks, then:qYou must make more money than professors! And

Additional feature of recipesnAnd other common analogies, such asqqnKnitting patterns for knittingSheet music for playing music andIf you go to a great restaurant, one with afancy table in the kitchen where you canwatch the chefs all night long, and you gothere 3 times a week for 15 weeks, then:qqYou must make more money than professors! AndYou won’t learn how to cook!

INTRODUCTION TO THELAW COMPONENT

Why Law and Computer Science?nnnIsn’t law about rules? About memorizingrules?Partly, but you won’t have to memorize legalrules.We will talk about the other thing law isabout:q Policies: what kind of society should we livein?

That Belongs With Computer Science?nIt does.qqnnThe language of computation is the languagethrough which computer science shapessociety.Lawyers do the same with talk about laws andlegal concepts.Now more than ever they need to talk to eachother.And: even if you will not be lawyer or acomputer scientist, you need to understandand be part of that conversation.

Here’s One Reasonn“History will record what we, here in the earlydecades of the information age, did to fosterfreedom, liberty, and democracy. Did webuild information technologies that protectedpeople’s freedoms . . .? Or did we buildtechnologies that could easily be modified towatch and control?”qBruce Schneier

Here’s Another ReasonnnIt is important to seeing your life in a contextthat reveals the meaning and importance ofyour particular actions.An important part of the modern context ishow computer science and law shape ourworld.

Can We Really Pull This Off?nnnnYes.We are not offering what is really twocourses: one part computer science, one partlaw.We are offering one course with those twoblended together.That is how you learn to speak and think CS law.

Law TopicsnnYou will learn to write code thatq analyzes data,q Accesses online information.Your code illustrates our two main law topics:q Using computers to encroach on privacy.q Defending online data from unauthorizedaccess.

An ExamplennnnYou will write a program (a web crawler) thatextracts information from websites.In preparing for this course, I tested a simpleprogram. All it did was open a web site.I was careful about what websites.Why?

Because . . .nnn“You will not . . . access Facebook, usingautomated means (such as harvesting bots,robots, spiders, or scrapers) without our priorpermission.” https://www.facebook.com/legal/termsThe program I ran would not violate this.But what if I made a mistake?nnSuppose it ran forever—opening the siteagain, and again, and again.That would violate the clause, and it would bea crime for which I could go to prison.

Should Things Be That Way?nThe best answers will come from those whospeak CS Law.

(Switch to syllabus on the web!)BORING SYLLABUS STUFF

UIC CS Classes n CS 100, Discovering Computer Science: q CS for fun, no credit if in College of Engineering n CS 111, Program Design I (This course!) q Students with little to no programming experience who n Are CS majors or minors, or CoE students planning to use CS 111-141, or any students wanting to learn more n Now in three flavors!