Top Banner
CIS 110 Introduction to Computer Programming www.cis110.com
56

CIS 110 - seas.upenn.edu

Jan 27, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CIS 110 - seas.upenn.edu

CIS 110Introduction to Computer Programming

www.cis110.com

Page 2: CIS 110 - seas.upenn.edu

What is Computing?

Page 3: CIS 110 - seas.upenn.edu

Computing: internet, e-mail, network…

Page 4: CIS 110 - seas.upenn.edu

Computing: Productivity…

Page 5: CIS 110 - seas.upenn.edu

Computing: Entertainment…

Page 6: CIS 110 - seas.upenn.edu

Computing: Entertainment…

Page 7: CIS 110 - seas.upenn.edu

- Edsger Dijkstra

Page 8: CIS 110 - seas.upenn.edu

Cutting Edge Computer Science

Page 9: CIS 110 - seas.upenn.edu

Mapping the EpigenomeDNAcontains the genetic blueprint forall humancells. but thereadingand execut;onof theblueprint inside each cel l is controlted in part by chemicalmarkers altached to the DNA.Scientists have begun to m ap someof these epigenetic markers. including CpGmethylation.

--.-.--CpG m et h ylationDNA isa codewritten withfourreuers: A. T. C and G. eachstanding for one nuc leotide.

In CpG methylation. a smallmarker cal led a m ethylgroup auaches10 the DNA at a CpG site. where a C and aG nucelotide sit next to eachother.

• Nucleotidebasepair

!,!.-....Cp G s i et

...Mothyt group

Reading the chartThe outer ring represents 35 millionbase pairs in Chromosome22. Orange marks highl igh t areas of the chromosome that were tested fo CpG methylation in a pilot study by the Human Epigenome Project.

Measuri ng CpG m ethy lationBar chartsindicate the average amount of CpG melh ylation found within the tested areas.Eachchart covers 100,000 base pairs. Some charts have been Shifted, shovmwithconnecting tines

AMOUNT OFMETHYLATION

0to20%20to80%

80 to 100% of CpGsites

Chromosome 22Of the 23 pairs of chromosomes in the human genome. 22 is the secondsmallesL.containingonly about 2percent of DNA inthe genome .

DD

Grayand white bandsonthe circular chart correspo11d to these balldSon thechromosome.

..,,,....nrtn.,,,",_,".",,.'

!J l , l \ l

"G"TU'oGnfl·2c,o,.G,G,l.>"'°"GG"

Page 10: CIS 110 - seas.upenn.edu

Chinook

• Chinook is the World Man-Machine Checkers Champion, developed by researchers at the University of Alberta.

• It earned this title by competing in human tournaments, winning the right to play for the (human) world championship, and eventually defeating the best players in the world.

• Visit http://www.cs.ualberta.ca/~chinook/ to play a version of Chinook over the Internet.

• The developers have fully analyzed the game of checkers and have the complete game tree for it.– Perfect play on both sides results in a tie.

• “One Jump Ahead: Challenging Human Supremacy in Checkers” Jonathan Schaeffer, University of Alberta (496 pages, Springer. $34.95, 1998).

Page 11: CIS 110 - seas.upenn.edu

Autonomous Cars

Penn’sAutonomousCar

Asof 2016

Page 12: CIS 110 - seas.upenn.edu

2011 Jeopardy!

• In February 2011, IBM Watson bested Brad Rutter (biggest all-time money winner) and Ken Jennings (longest winning streak)

• IBM is currently applying Watson’s technology to medical diagnosis and legal research

Page 13: CIS 110 - seas.upenn.edu

Robot Soccer

UPennalizers Robot Soccer Team

Aibo League

Page 14: CIS 110 - seas.upenn.edu

Areas in Computer Science

Computer Graphics

ComputerVision

Computer Security

Artificial Intelligence

Robotics Human-Computer Interaction

Ubiquitous Computing

Operating Systems

Computer Networking

Databases

Page 15: CIS 110 - seas.upenn.edu

What is Computer Science?Computer science is the study

of solving problems using computation

– Computers are part of it, but the emphasis is on the problem solving aspect

Computer scientists work across disciplines:MathematicsBiology (bioinformatics) ChemistryPhysics Geology

Geoscience Archeology Psychology Sociology Cognitive Science

Medicine/Surgery Engineering LinguisticsArt…

Page 16: CIS 110 - seas.upenn.edu

Computing is important

Page 17: CIS 110 - seas.upenn.edu

After ~10 years, we’ll finally have to change this slide! Welcome to the future.

Page 18: CIS 110 - seas.upenn.edu

Computing is Consistently Ranked Among the Best Occupations

CNN’s Top100 Jobs2010 (GraphicbyFocus.com)

CS-Related Jobs Highlighted in Red

The 25 BestJobs of 2017

#1 Software Developer #6 Statistician

#2 Dentist #7 Pediatrician

#3 Physician’s Assistant #8 Obstetrician and Gynecologist

#4 Nurse Practitioner #8 Oral andMaxillofacial Surgeon

#5 Orthodontist #8 PhysicianCS Careers Rank Highly In:

• Job satisfaction• Salary• Work/life balance

• Growth potential• Employment rate• Work environment

Page 19: CIS 110 - seas.upenn.edu

…many different companies … need to hire computer scientists. They aren't tied to one particular industry.

Page 20: CIS 110 - seas.upenn.edu

Computing has consequences

Page 21: CIS 110 - seas.upenn.edu
Page 22: CIS 110 - seas.upenn.edu
Page 23: CIS 110 - seas.upenn.edu

Administrivia

Page 24: CIS 110 - seas.upenn.edu

Overview

CIS 110: Introduction to Programming and Computer Science

Goals:□ How can we use computers to solve problems?□ How can we formulate problems so that we can solve

them via computation?

Topics:□ Programming in Java□ Computer organization and assembly language□ Applications to science, engineering, and art

“ Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate, and brilliant; together they are powerful beyond imagination. ” − Albert Einstein

Page 25: CIS 110 - seas.upenn.edu

The BasicsInstructor: Travis McGaha

□ Travis’ Regular Office Hours: TBA□ [email protected]

Instructor: Harry Smith□ Harry’s Regular Office Hours: Monday & Wednesday, 10-11AM (Zoom for now, link on cal.)□ [email protected]

Only email the instructors for personal or sensitive communication; everything else should be sent through Piazza.

TA Office Hours:□ Help with debugging□ Office Hours on OHQ.io, Mon-Thurs 3:30pm-9:30pm (full schedule TBD soon!)□ Only use Piazza, office hours, or email to contact your TAs.

– Do not emaila TAunlessyou’ve spoken with them directlyabout it aheadof time.

Full details: www.cis110.com

Page 26: CIS 110 - seas.upenn.edu

Reaching Out To Course StaffCIS 110 has about 200 students this semester.

We have two instructors and 45 TAs.

You will be part of a recitation with at most 19 other students.

If you need support in the course, please reach out to instructors & Head TAs!But: PLEASE MAKE SURE TO CONTACT YOUR RECITATION TAs, TOO!

Page 27: CIS 110 - seas.upenn.edu

GradingGrade Breakdown:• Homeworks + Project: 64%• Exam 1: 11%• Exam 2: 11%• Recitation Attendance: 6%• Check-in Quizzes : 6%• Code Reviews: 2%

Exam 1: March 1st (7:00-9:00pm)

Exam 2: During Finals, time and date set by registrar (TBD)

Notes:□ You can check your grades on GradeScope

Page 28: CIS 110 - seas.upenn.edu

Recitation

● Mandatory!● You must be registered for exactly one recitation section

■ Some sections are 1 hour, others are 2 hours.

■ 2 hour recitations are designed to give more support to students who anticipate needing it.

■ You can pick which type you want.

■ As long as you are registered for one recitation section, you are set to go.

● Benefits of recitation:■ Review course material

■ Get TA mentorship

■ Small class environment: make friends, get more attention from instructor.

Page 29: CIS 110 - seas.upenn.edu

Course Website: www.cis110.com□ Programming assignments and checklists□ Course schedule□ Lecture slides

Interactive lecture notes available in Codiosoon

Course Materials

Page 30: CIS 110 - seas.upenn.edu

What You Need To Know in CIS 110

● Everything covered during lectures.● Everything contained in the homework assignments.● Everything covered during recitation.

What You Might Find Helpful, But Isn’t Mandatory● Codio Lecture Notes (the assignments with colorful logos)

Page 31: CIS 110 - seas.upenn.edu

Homework Programming Assignments

Due: 11:59pm on Thursday nights on GradeScope 4 late days to use throughout semester (max 2 per homework) No other late submissions allowed Lowest homework dropped See course webpage for other policies

Computing equipment: Your desktop/laptop Codio

Page 32: CIS 110 - seas.upenn.edu

Advice

Start on HWs early! Debugging can take time.

Office hours are less crowded if you show up early in the week

Do not hesitate to ask for help. If you have been trying to debug something for an hour and are getting frustrated, remember that we are there to help you.

Your best sources for help are the instructors, the TAs and Piazza (NOT GOOGLE!)

Please read and follow the collaboration policy Do not use Stack Overflow or other online discussion boards

Page 33: CIS 110 - seas.upenn.edu

1. Register for Piazza!2. Register for Codio!3. Familiarize yourself with the course rhythm:1. Lecture MWF2. HWs due Thursdays (usually)3. Rinse and repeat

Action Items

Page 34: CIS 110 - seas.upenn.edu

Navigating Codio

34

Page 35: CIS 110 - seas.upenn.edu

Thefiletree

All filesyouuse will livehere.

You can click on them to show them in the editor.

When you first open a project:

Page 36: CIS 110 - seas.upenn.edu

Save Al l Files

Open File..

Rename Item ..

Delete Item ..

Upload..

Close File

Close All Files

Al t • C t c l +Shif t - N

Ctc l - S

Ctc l - 0

Alt +W

Page 37: CIS 110 - seas.upenn.edu

CREATE NEW FILE

CURRENT PATH

Root folder

FILE NAME

Hello Wor ld.java

- CANCEL

Page 38: CIS 110 - seas.upenn.edu

Theeditor

HelloWorld.java (an empty file) is now open in the editor for editing!

The new file appearsin the filetree!

Page 39: CIS 110 - seas.upenn.edu

This isthe Syllabus page of the website

Page 40: CIS 110 - seas.upenn.edu

Highlight everything, andthenCOPYit…

Page 41: CIS 110 - seas.upenn.edu

..andPASTEITintohere!

Page 42: CIS 110 - seas.upenn.edu

Our First Program

42

Page 43: CIS 110 - seas.upenn.edu

Learning Objectives

● To be familiar with the structure of a Java program● To be familiar with print commands● To be familiar with comments● To write a program that prints something● To recognize and fix common syntax errors

Page 44: CIS 110 - seas.upenn.edu

Code goeshere!44

Page 45: CIS 110 - seas.upenn.edu

Code goeshere!

ClassName (must matchthe filename)

Page 46: CIS 110 - seas.upenn.edu

Code goeshere!

ClassName (must matchthe filename)

Comments (notes,not runas code!)

Page 47: CIS 110 - seas.upenn.edu

Code goeshere!This is called “the body of our main

method.”

ClassName (must matchthe filename)

Comments (notes,not runas code!)

Page 48: CIS 110 - seas.upenn.edu

Anatomy of a Java program

Java keywords. Beyond the scope of this course

A Java program is a class. More on classes later

The name of your program

The main methoddeclaration. More on this later

every open curly brace {must have a matched close curly brace }

Curly braces are used to start and end class definitions and method definitions

Page 49: CIS 110 - seas.upenn.edu

Print commands

● Display information on the screen● Two types of print commands:

○ System.out.println(value): prints the value followed by a new line (ln)

○ System.out.print(value): prints the value without advancing to the next line

Page 50: CIS 110 - seas.upenn.edu

Print text

● prints out the characters between the first " and the second " followed by a new line

System.out.println("Hello world "); A semicolon ends the command (statement)

Page 51: CIS 110 - seas.upenn.edu

Print hello world

Page 52: CIS 110 - seas.upenn.edu

Comments

● // is used to mark the beginning of a comment (single-line)● /* … */ is used for multi-line comments● The compiler (program that runs your program!) skips comments● Comments are used to make notes to ourself and to annotate the code

Page 53: CIS 110 - seas.upenn.edu

Thefiletree

All filesyouuse will livehere.

You can click on them to show them in the editor.

CompilebuttonClick thisbutton to compile all .java filesin your filetree.

View RunningProgram ButtonShowsyou the visual output of your program.

54

Page 54: CIS 110 - seas.upenn.edu

After clickingthe Compilebutton…

TheTerminalThis isspacewhere we can write individual commands to communicate with the computer.

Page 55: CIS 110 - seas.upenn.edu

Runningour prograWe typed “java”followed by ourprogram’sname(“HelloWorld”). Thehit enter.

TheOutputWhatever we asked our program to print will appear on the following line(s). In this case, our program prints “Hello, World!”

Page 56: CIS 110 - seas.upenn.edu

Syntax Errors

● The compiler report errors● Most common errors are syntax errors ● A syntax error is reported when the code is not correctly written● Common Syntax errors:

○ Missing a semicolon (;) at the end of a statement

○ Open curly brace ({), or quote (") or parenthesis (() without a matching closing brace (}), quote (") or parenthesis ())