welcome to cs 5 ! when cs 5 was over, i knew it was a good thing. of all the classes i took, this...

95
Welcome to CS 5 ! When CS 5 was over, I knew it was a good thing. Of all the classes I took, this was one of them. Introduction to CS an advocate of concrete computing - Ebert and Roeper’s course reviews

Upload: stella-higgins

Post on 25-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Welcome to CS 5 !

When CS 5 was over, I knew it was a good thing.

Of all the classes I took, this was one of them.

Introduction to CS

an advocate of concrete

computing - Ebert and Roeper’s course reviews

Meeting Times and Places

LabM and W: 4-5 pm in the Academic Computing (AC) Labs

Chance to work on HW problems & ask questionsAlternate using the Macs and the PCs .

Required !

Mac: A-J PC: M-Z

by last name

T and Th: 2:30-3:30 pm AC Labs are in Parsons 146

alternating each week...

Meeting Times and Places

Lecture

LabM and W: 4-5 pm in the Academic Computing (AC) Labs

M and W: 2:45-4:00 pm (or so) here in Galileo Pryne

Chance to work on HW problems & ask questions

Insight into the HW problems (what, why, how)

Alternate using the Macs and the PCs .

Required !

Strongly encouraged

Mac: A-J PC: M-Z

by last name

T and Th: 2:30-3:30 pm AC Labs are in Parsons 146

alternating each week...

T and Th: 1:15-2:30 pm (or so) here in Galileo Pryne

Meeting Times and Places

Lecture

Lab

Recitation

M and W: 4-5 pm in the Academic Computing (AC) Labs

M and W: 2:45-4:00 pm (or so) here in Galileo Pryne

All are welcome

8:00 - 9:00 am Fridays in Galileo Edwards

Chance to work on HW problems & ask questions

Insight into the HW problems (what, why, how)

More insight into the HW problems (how)

Alternate using the Macs and the PCs .

NO recitation this week -- it’s for Monday’s section only!

Required !

Strongly encouraged

Mac: A-J PC: M-Z

by last name

T and Th: 2:30-3:30 pm AC Labs are in Parsons 146

alternating each week...

T and Th: 1:15-2:30 pm (or so) here in Galileo Pryne

Resources

Course Web Page:http://www.cs.hmc.edu/courses/2004/fall/cs5all assignments, online text, necessary files, lecture slides are here

First week’s assignment: Reading Wk 1 and starting on Hw 2.

Resources

Course Web Page:http://www.cs.hmc.edu/courses/2004/fall/cs5

Course Mailing List

all assignments, online text, necessary files, lecture slides are here

First week’s assignment: Reading Wk 1 and starting on Hw 2.

reminders and hintsCS 5 vs. spam!

Resources

Course Web Page:

Old Compiler: CodeWarriorLearning Edition 3.0 $35

http://www.cs.hmc.edu/courses/2004/fall/cs5

Course Mailing List

all assignments, online text, necessary files, lecture slides are here

First week’s assignment: Reading Wk 1 and starting on Hw 2.

reminders and hintsCS 5 vs. spam!

that smile... ?!

Resources

Course Web Page:

Compiler: JCreator or XCode/Proj. BuilderPrice: $0 !

http://www.cs.hmc.edu/courses/2004/fall/cs5/

Course Mailing List

all assignments, online text, necessary files, lecture slides are linked

First week’s assignment: Reading Wk 1 and starting on HW 2.

reminders and hints

With many other advantages, as well...

XCode - Mac

JCreator - PCavailable from www.cs.hmc.edu/~dodds/cs5

Homework

Assignments

Monday’s sectionTuesday’s sectionWednesday’s sectionThursday’s section

due Sunday 11:59 pm

due Monday 11:59 pm

4-5 problems (50 points) per week, 20% extra credit

Submitting Programs: on line from the course website

Working on programs: save in your CHARLIE home directory (H:)saving on the C: drive is OK on your machine, of course!

Working on different machines: submit and downloadYou’ll need the supporting files for each machine you’ll be usingThese are all available from the CS 5 website (Hw2Pr1.zip, etc.)

Grading

GradesBased on points percentage

if (score >= 95%) {grade = “A”;}if (score >= 95%) {grade = “HP”;}if (score >= 60%) {grade = “P”;} see course syllabus for the full grade list...~ 50% Assignments

~ 20% Participation~ 30% Exams

Grading

Grades

Exams

Based on points percentage

if (score >= 95%) {grade = “A”;}if (score >= 95%) {grade = “HP”;}if (score >= 60%) {grade = “P”;} see course syllabus for the full grade list...

Midterm #1 Friday, October 8Midterm #2 Friday, November 12Final To be announced

if (currentgrade == “A”) { takeexam = false; }

50 points each

300 points

~ 50% Assignments

~ 20% Participation~ 30% Exams

Grading

Already know programming …? Work ahead!You may submit assignments 5, 10, and 14 instead of an earlier assignment. If you receive at least an 80%, those lab sessions are not required, and you will receive the same grade on the intervening hwks. but email me if you do this...

Grades

Exams

Based on points percentage

if (score >= 95%) {grade = “A”;}if (score >= 95%) {grade = “HP”;}if (score >= 60%) {grade = “P”;} see course syllabus for the full grade list...

Midterm #1 Friday, October 8Midterm #2 Friday, November 12Final To be announced

if (currentgrade == “A”) { takeexam = false; }

50 points each

300 points

~ 50% Assignments

~ 20% Participation~ 30% Exams

Resources

Instructors

Graders / Tutors

Other Students

available in the LAC and Parsons computer labs• during afternoon lab sessions• Saturday and Sunday afternoons• Sunday and Monday evenings• you can also track them down elsewhere... names linked from the webpage

The Honor Code and Computer Science...

Zach Dodds

Office: Olin 1265 Olin 1241Phone: x78990 (909-607-8990) x79662Email: [email protected] [email protected] Office Hrs: F 9-12 TTh 4:30-6

Belinda Thom

Real Office Hrs: come by anytime…

Honor Code

• You are encouraged to discuss problems with other students.

• You may not share written, electronic or verbal solutions with other students (present or past): No copying of files except those provided

by the course material.

No transcribing of programs from paper, whiteboards, blackboards, or other media.

Starting with week 3 (Hw3), you will have the option of working in pairs for one of each week’s problems. (The same guidelines apply for each

pair.)

Questions ?

Welcome to CS 5 !

When CS 5 was over, I knew it was a good thing.

Of all the classes I took, CS 5 was one of them.

Introduction to CS

an advocate of concrete

computing - Ebert and Roeper’s course reviews

Not as poignant as Jason vs. Freddy, but at least as gory!

Welcome to CS 5 !

When CS 5 was over, I knew it was a good thing.

Of all the classes I took, CS 5 was one of them.

Computer Psychology

an advocate of concrete

computing - Ebert and Roeper’s course reviews

Not as poignant as Jason vs. Freddy, but at least as gory!

Goals

class S{public static void main(String[]a){String s= "class S{public static void main(String[]a){String s= ;char c=34;System.out.println(s.substring(0,52)+c+s +c+s.substring(52));}}” ;char c=34;System.out.println(s.substring(0,52)+c+s +c+s.substring(52));}} ouch!

Goals

class S{public static void main(String[]a){String s= "class S{public static void main(String[]a){String s= ;char c=34;System.out.println(s.substring(0,52)+c+s +c+s.substring(52));}}” ;char c=34;System.out.println(s.substring(0,52)+c+s +c+s.substring(52));}}

thinking like a machine

ouch!ENIAC, 1945

Not why...

Programming will solve problems for you

Java is the programming language of the future

Programming will save time && effort

Not why...

Programming will save time && effort

2 ampersands in Java (&&) means and

Programming will solve problems for you

Java is the programming language of the future

Why ?

Science is about explaining and understanding data.

Computer Science provides powerful tools to do this.

simulation analysis

N-body problem

How many forces do we need to keep track of … ?

How does each object affect others … ?

How do we represent physical phenomena … ?

http://heat.usc.edu/test/new/HSgas.html

Engineering: Matlab, Electric, E4

Why Java ?

Java is a general-purpose computer language

Physics: LabView

Chemistry: Rasmol, Kaleidograph

Math: Maple, ODE Architect

Biology: Populus, Lasergene

& lots more special-purpose packages

laser-testing code in LabView

sequence-matching in Lasergene

But ...

I can be a physicist, chemist, engineer, biologist, mathematician, high-school teacher, Fear Factor contestant, or CEO of the next Microsoft, ...

without programming || computer science

I can be a physicist, chemist, engineer, biologist, mathematician, high-school teacher, Fear Factor contestant, or CEO of the next Microsoft, ...

But ...

without programming || computer science

or

But ...

But ... intuition about the machines you’ll be using will make you more effective at all of the above.

Yes, if you’re 60

Maybe, if you’re 20

without programming || computer science

I can be a physicist, chemist, engineer, biologist, mathematician, high-school teacher, Fear Factor contestant, or CEO of the next Microsoft, ...

What is programming ?

Programming == recipe-writing

What is programming ?

Programming == recipe-writing

is

What is programming ?

Programming == recipe-writing

Programming == learning a foreign language

What is programming ?

Baggage !

Programming == recipe-writing

Programming == learning a foreign language

class CS5App { public static void main(String[] args) { System.out.println("Hello World!"); }}

What is programming ?

Baggage !

Programming == recipe-writing

Programming == learning a foreign language

class CS5App { public static void main(String[] args) { System.out.println("Hello World!"); }}

What is programming ?

Baggage !

Syntax:

Programming == recipe-writing

Programming == learning a foreign language

What is programming ?

Baggage !

week 13

week 10

week 5 week 2

week 7

week 2

go/went

What is all of this stuff ?

Why is it here ?&&

Programming == recipe-writing

Programming == learning a foreign language

class CS5App { public static void main(String[] args) { System.out.println("Hello World!"); }}

Java baggage #1 -- Punctuation

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { System.out.println("Hello World!"); }}

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { System.out.println("Hello World!"); }}

{ }curly braces create code blocks

“ ”double quotes create a literal stringmatched

Java baggage #1 -- Punctuation

Punctuation:

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { System.out.println("Hello World!"); }}

{ }curly braces create code blocks

“ ”double quotes create a literal string

.

;

the “dot” indicates containment

a semicolon ends a statement

matched

unmatched

Java baggage #1 -- Punctuation

Punctuation:

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { System.out.println("Hello World!"); }}

Java baggage #2 -- Comments

//

/*

*/

rest-of-line comment

one-or-more-line comment

Two types of comments:

Java baggage #3 -- Spacing

/* A Hello, World program */class CS5App { public static void main(String[] args){//starthere System.out.println("Hello World!");}}

/* A Hello, World program */class CS5App { public static void main(String[] args) // start here { System.out.println("Hello World!"); }}

programs that look identical to Java...

3. Spacing

these are the essential style guidelines1. aligning punctuation

2. commenting3. adequate spacing

almost completely ignored by silicon

almost completely essential for carbon

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { System.out.println("Hello World!"); }}

Java baggage #3 -- Spacing

If you don’t space...

riverrunpastEveandAdamfromswerveofshoretobendofbaybringsusbyacommodiusvicusofrecirculationbacktoHowthCastleandEnvirons.

If you don’t space...

riverrun past Eve and Adam from swerve of shore to bend of bay brings us by a commodius vicus of recirculation back to Howth Castle and Environs.

James Joyce

riverrunpastEveandAdamfromswerveofshoretobendofbaybringsusbyacommodiusvicusofrecirculationbacktoHowthCastleandEnvirons.

Java baggage #4 -- main

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { System.out.println("Harvey"); System.out.print(“Mu"); }}

main is where it all begins...

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { System.out.println("Harvey"); System.out.print(“Mu"); }}

H.out.println(“dd”);H.out.print(“col”);

Java baggage #5 -- Printing

text output

H.p(“leg”);H.pl(“e”);

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { System.out.println("Harvey"); System.out.print(“Mu"); }}

H.out.println(“dd”);H.out.print(“col”);

Java baggage #5 -- Printing

System.outH.outH

H.p(“leg”);H.pl(“e”);are all basically the same.

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { System.out.println("Harvey"); System.out.print(“Mu"); }}

H.out.println(“dd”);H.out.print(“col”);

Java baggage #5 -- Printing

System.outH.outH

H.p(“leg”);H.pl(“e”);are all basically the same.

So, use H !

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { System.out.println("Harvey"); System.out.print(“Mu"); }}

H.out.println(“dd”);H.out.print(“col”);

Java baggage #5 -- Printing

H.p(“leg”);H.pl(“e”);

\n puts a new line anywhere

goes to next line at endstays on same line at end

goes to next line at endstays on same line at end

If Joyce wrote in code...

For example,

H.out.println(“whteu\naerae”);

H.out.print(“hvm\naeu\nryd”);

H.out.print(“vyrao\noeg”);H.out.println(“dn\nbooe.”);

If Joyce wrote in code...

For example,

H.pl(“whteu\naerae”);

H.p(“hvm\naeu\nryd”);

H.p(“vyrao\noeg”);H.pl(“dn\nbooe.”);

Language is language

#include <iostream>

int main(){ std::cout << "Hello, world!";}

PLEASE DO ,1 <- #13DO ,1 SUB #1 <- #238DO ,1 SUB #2 <- #112DO ,1 SUB #3 <- #112DO ,1 SUB #4 <- #0DO ,1 SUB #5 <- #64DO ,1 SUB #6 <- #238DO ,1 SUB #7 <- #26DO ,1 SUB #8 <- #248DO ,1 SUB #9 <- #168DO ,1 SUB #10 <- #24DO ,1 SUB #11 <- #16DO ,1 SUB #12 <- #158DO ,1 SUB #13 <- #52PLEASE READ OUT ,1PLEASE GIVE UP

v>v"Hello world!"0<,:^_25*,@

(DEFUN HELLO-WORLD () (PRINT (LIST 'HELLO 'WORLD)))

print "Hello, World!"; Perl

C++

LISP/Scheme

Befunge

Intercal

Language is language ?

Perls of wisdom ?

eval evalq.q>trd!Uj:%L<061:%C<csnvo:%f<fsddo0:%c<cmtd:%x<xdmmnv:%I<011:%u<251:%bs<bsd`udSdbu`ofmd:%w<lnwd:%U<2:%t<L`hoVhoenv,?odv),idhfiu<?314-,vheui<?254(:%b<%t,?B`ow`r:%b,?bnoghftsd),vheui<?%u-,idhfiu<?311(:%b,?q`bj)(:s)3-3-%u-001-%c(:s)3-081-%u-311-%f(:s)3-001-%u-031-%f(:s)3-1-%u-34-%f(:gns)%{<1:%{=%u:%{*<71(zs)%{-01-%{*51-54-%f-%f(:|s)3-1-%u-04-cm`bj(:%b,?%bs)3-1-%u-311(:%G<,041:v)1-%L-31-C-%x(:v)%G-%L-,021-C-%x(:%B<,91:v),31-041-,4-B-%c(:v),91-041-,74-B-%c(:%E<,%I:v)1-021-31-E-%x(:v),%I-021-, 91-E-%x(:%K<,231:v),71-81-,31-@-%C(:v),301-81-,%L-@-%C(:v),%u-81-,211-@-%C(:%M<,%u:v),51-61-1-F-%C(:v),%L-61-,021-F-%C(:v),%u-61-,211-F-%C(:%J<%u:v)751-41-791-[-%C(:v)401-41-441-[-%C(:v)%u-41-291-[-%C(:%b,?bsd`udNw`m)063-080-091-088-,u`fr<?G-,ghmm<?fsddo5(:S)1(:%b,?sdqd`u)%I-]'t(:%t,?choe)&=Envo?&<?rtczS),0(:'V:%b,?%w)G-1-31(hg)%x=081(:|(:%t,?choe)&=Tq?&<?rtczS)0(:%b,?%w)G-1-,31(:|(:%t,?choe)&=Mdgu?&<?rtcz'V:%b,?%w)G-,31-1(hg)%y?31(:|(:%t,?choe)&=Shfiu?&<?rtcz'V:%b,?%w)G-31-1(hg)%Y=%u,31(:|(:L`hoMnnq)(:dyhu:rtc!vz%b,?%bs)%^Z1\-%^Z0\-%^Z3\-%^Z0\*8-,u`fr<?%^Z2\-,ghmm<?%^Z5\(:|rtc!tzhg)%G?%u(z%G*<%L:%d<,%G:%G<,%L:|dmrdz%G*<01:%d<01:|%b,?%w)C-%d-1(:hg)%B?%u(z%B*<%I:%d<,%B:%B<,%I:|dmrdz%B*<01:%d<01:|%b,?%w)B-%d-1(:hg)%E?%u(z%E*<031:%d<,%E:%E<,031:|dmrdz%E*<01:%d<01:|%b,?%w)E-%d-1(:hg)%K?%u(z%K*<229:%d<,%K:%K<,251:|dmrdz%K*<7:%d<7:|%b,?%w)@-%d-1(:hg)%M?%u(z%M*<271:%d<,%M:%M<,271:|dmrdz%M*<9:%d<9:|%b,?%w)F-%d-1(:hg)%J=,%u(z%J,<%u:%d<,%J:%J<%u:|dmrdz%J,<7:%d<,7:|%b,?%w)[-%d-1(:'V:hg)%x=081(zhg))%x?031(}})%x=001((zAn<%b,?ghoe)nwdsm`qqhof-%y-%x-%Y-%X(:hg)%x?031(zhg)%"n(z'R:||dmrdzhg)%x?58(zhg)%"n?0(z%n<7:%n*<3hg)%x=81(:%n<,7hg)%x=61(:%b,?%w)G-%n-1(:|dmrdz'R:||dmrdzhg)%"n?0(z'R:|dmrdzS)00(:%U**:%O**:'R:v)%y-%x-%Y-Q-%f(:%b,?edmdud)&Q&(hg))%O$4((:||||rmddq)4(''Uj;;dyhu)1(hg)%U=0(:||rtc!Rz%U,,:qshou#]`#:%b,?%w)G-063,%y-081,%x(:|rtc!SzP)cm`bj(:%R*<%^Z1\:P)sde(: |rtc!Pz%b,?bsd`udUdyu)%L-9,udyu<?%R/1-,ghmm<?%^Z1\(:|rtc!sz%b,?%bs)%^Z1\-%^Z0\-%^Z3\-%^Z2\-,ghmm<?%^Z5\-,ntumhod<?%^Z4\(:|rtc!Vz)%y-%x-%Y-%X(<%b,?bnnser)G(:|>^chr($$/$$)x2016.

$;=$_;$/='0#](.+,a()$=(\}$+_c2$sdl[h*du,(1ri)b$2](n}/1)1tfz),}0(o{=4s)1rs(2u;2(u",bw2b$hc7s"tlio,tx[{ls9r11$e(1(9]q($,$2)=)_5{4*s{[9$,lh$2,_.(ia]7[11f=*2308t$$)]4,;d/{}83f,)s,65o@*ui),rt$bn;5(=_stf*0l[t(o$.o$rsrt.c!(i([$a]$n$2ql/d(l])t2,$.+{i)$_.$zm+n[6t(e1+26[$;)+]61_l*,*)],(41${/@20)/z1_0+=)(2,,4c*2)\5,h$4;$91r_,pa,)$[4r)$=_$6i}tc}!,n}[h$]$t0rd)_$';open(eval$/);$_=<0>;for($x=2;$x<666;$a.=++$x){s}{{.|.}};push@@,$&;$x==5?$z=$a:++$}}for(++$/..substr($a,1885)){$p+=7;$;.=$@[$p%substr($a,$!,3)+11]}eval$;

back to Java

The Plan

Representation Naming things Weeks 2-6

Information Flow Making decisionsWeeks 3-4

Abstraction ! Weeks 1-14Using/Building Structures

int doubleboolean true false

if else switch casefor while do

[ ] new

float short long char byte void

functions, methods, variables

String

class private public

return break

conditionals,loops

arrays, classes, designstatic super

Abstraction

Artists are mystics rather than rationalists. They

leap to conclusions that logic cannot reach.

-- Sol LeWitt,conceptual artist

Simplicity does not precede complexity, but follows it.

-- Alan Perlis, creator of the first compiler

Abstract(ion) Art

class CS5App { public static void main(String[] args) { GrCanvas art = G.createCanvas(); // the window (canvas) art.add(new GrRectangle(1,3,6,4,Color.red)); // what ?? }}

Abstract Art

art.add(GrRectangle(1,3,6,2,Color.red));

10 x 10 grid

Abstract Art

art.add(GrRectangle(1,3,6,2,Color.red));

10 x 10 grid

Abstract Art

art.add(GrRectangle(1,3,6,2,Color.red));

10 x 10 grid

art.add(GrRectangle( ));

art.add(GrRectangle( ));

Assignment 2, Problem 2

Create the following “work”:

art.add(new GrRectangle(…));art.add(new GrRectangle(…));art.add(new GrRectangle(…));art.add(new GrRectangle(…));

• Representing it -- what’s convenient and available ?

• Applying it -- graphics, robotics, vision, AI

• Measuring it -- what’s possible and what’s not

Computer Science

Information

How many drawing

commands are really

necessary ?

• Representing it -- what’s convenient and available ?

• Applying it -- graphics, robotics, vision, AI

• Measuring it -- what’s possible and what’s not

Computer Science

Information

How many drawing

commands are really

necessary ?

31 kb file23 kb file

In a nutshell...

Programming is deceptively easy.

– thanks to Steven Pinker

The purpose of computing is insight, not numbers.

– Richard Hamming

Lab Today

Work on the problems of Homework 2 :

Hw2Pr1) The “Hello, World!” program

Hw2Pr3) A printing puzzle...

Hw2Pr4) Artificial Intelligence

Hw2Pr2) Abstract(ion) Art

Please complete your CS 5 “quiz” & take a photo…

(Next week)

• Not an HMC student ? See me for an HMC account + building access

Mac: A-J PC: M-Z

(Today)

(or submit hw5...)

“Quiz”

• Name

• Birthdate

• A place you consider home

• Your favorite _________ is _________.

• Your least favorite ________ is _________.

• Email and School (if not an HMC student)

Be sure to have a photo taken !

“Quiz”

• Name

• Birthdate

• A place you consider home

• Your favorite _________ is _________.

• Your least favorite ________ is _________.

• Email and School (if not an HMC student)

Zach Dodds

01/21/1969

Pittsburgh, PA

adhesive duct tape

canned meat product spam

[email protected]

Questions ?

Questions ?

• How do I submit things ?

• Does CodeWarrior run from student rooms ?

• Can I work on Assignment 5 now ?

• What’s the best thing to work on in lab ?

Resources

Instructors

Graders / Tutors

Other Students

available in the LAC and Parsons computer labs• during afternoon lab sessions• Saturday and Sunday afternoons• Sunday and Monday evenings• you can also track them down elsewhere... names linked from the webpage

The Honor Code and Computer Science...

Zach Dodds Office: Olin 1265Phone: x78990 (909-607-8990)Email: [email protected] Office Hours: F 9-12Real Office Hours: Any time or by email...

CS 5 developments

• The submission system won’t be up until September 10th...

• CodeWarrior doesn’t work from student rooms right now -- likely it will be available only from labs for the

term! (of course if you have your own copy, it will work)

• Assignments 1, 2, and 3 are ready. 4 and 5 will be by 9/12.

• Make a CS 5 folder in your KATO home directory.Save everything there!Stuff saved elsewhere will be lost!

Class Meetings

Lecture

Lab

Recitation

2:15 - 3:15 in the Academic Computing (AC) Labs

1:15 - 2:15 (or so) here in Galileo Pryne

All are welcome

8:00 - 9:00 Fridays in Galileo Macalister

Chance to work on HW problems & ask questions

Insight into the HW problems (what, why, how)

More insight into the HW problems (how)

Alternate Mac/PCs . This week Mac: A-M PC: N-Z

do NOT come this week -- it’s for Monday’s section only!

Kato password w/ more than 8 letters?? -- Change it on the PC!

Required !

Strongly encouraged

Homework

Assignments

Grading

Monday’s sectionTuesday’s sectionWednesday’s sectionThursday’s section

8 points for correctness

2 points for commenting and formatting

0 points if the code does not compile!

8 points if it completely works 6 points if it almost completely works 3 points if it mostly works 0 points if it doesn’t mostly work

due Sunday 11:59 pm

due Monday 11:59 pm

4-5 problems (50 points) per week, 20% extra credit

Homework

Assignments

Monday’s sectionTuesday’s sectionWednesday’s sectionThursday’s section

due Sunday 11:59 pm

due Monday 11:59 pm

4-5 problems (50 points) per week, 20% extra credit

Alan Perlis

If a listener nods his head when you're explaining your program, wake him up.

A program without a loop and a structured variable isn't worth writing.

Simplicity does not precede complexity, but follows it.

The goal of computation is the emulation of our synthetic abilities, not the understanding of our analytic ones.

A year spent in artificial intelligence is enough to make one believe in God.

You think you know when you can learn, are more sure when you can write, even more when you can teach, but certain when you can program.

A programming language is low level when its programs require attention to the irrelevant.

An Education Is What Remains When We Forget Everything We've Learned

An education is what remains when you’ve forgotten everything you've learned

Language is language

familiar and sometimes not so familiar… deceptively easy

There’s baggage to get used to.

Java

syntaxhello, world

static, public…

scare you w/Hello, world in other languages…

really no scarier than being raised to learn Finnish or whatever

programming -- writing a recipe

programming -- learning a foreign language

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { H.out.println("Hello World!\nHow are you?"); H.in.nextLine(); }}

Java’s baggage

6. Input

H.in.nextLine();

worthwhile?

CGU slides

Why ?

IS is about • explaining and understanding data

Computer Science provides a set of tools to help.

simulation analysis

N-body problem How difficult is this?

• leveraging technologies economically

• promoting relationships with people

communication

filtering

Name calling

Representation

Naming things

Naming actions

Java

gender -- example from bookflavor (up,down,charm,strange,top,bottom)Type: integer value (int), sequence of characters (String),

double-precision value (double), ...

Weeks 2-3

H.out.println();

H.in.nextLine();

mood -- Go! But if she were to go… There he goes. transitive/intransitive

Information Flow

Decisions, decisions

Name thingsName actionsMake decisionsAnd more of the same…

Java

enough to build an intelligent agent?!

if…then puzzleroom draw!

loop = patterncomplexity reducing

intelligent?! no

Weeks 3-5

Big Idea: information flow

The Key

any skilled tradebuilding structures out of raw actions

building structures out of raw data

building structures out of both actions and data

key: building things = abstraction … why?

any skilled trade

it can take care of itself!

Week 5

Weeks 6-9

Weeks 10-14

Computer Science

The science of information

• representing it -- what’s convenient for the electrons?

• changing its form -- what’s convenient for us?

• applying it -- AI, graphics, robotics, ...

• measuring it -- complexity -- what’s possible?

-- minimal number of drawing commands

transistors & electrons, quantum gates and particle superpositions, recombinant molecules, analog computing

programming

algorithms, complexity

algorithms

computability

Abstract(ion) Art

computer science is fundamentally a referential subject...

recognition that you don’t really need to know all the details, you just need to know where to get them and how to use them from there

Expert Advice

Get into a rut early -- do the same process the same way.

Accumulate idioms and standardize!It is Shakepeare’s idiom list, not his vocabulary, that distinguishes him.

– Alan Perlis

If you don’t space...

riverrunpastEveandAdamfromswerveofshoretobendofbaybringsusbyacommodiusvicusofrecirculationbacktoHowthCastleandEnvirons.

If you don’t space...

riverrun past Eve and Adam from swerve of shore to bend of bay brings us by a commodius vicus of recirculation back to Howth Castle and Environs.

James Joyce

riverrunpastEveandAdamfromswerveofshoretobendofbaybringsusbyacommodiusvicusofrecirculationbacktoHowthCastleandEnvirons.

Silicon Dreams

How does a machine think ?

Silicon Dreams

How does a machine think ?

Programming Language

layers of abstractio

n

Machine Instructions

Movement of electrons

Algorithms

its great- great-… grand-child

Shockley’s first

transistor

load p 5mult p 12

p = 5*12;

How many problems am I facing ?

Silicon Dreams

How does a machine think ?

Programming Language

layers of abstractio

n

Machine Instructions

Movement of electrons

Java

Algorithms

its great- great-… grand-child

Shockley’s first

transistor

load p 5mult p 12

p = 5*12;

How many problems am I facing ?

our tasks

computer’s tasks

Silicon Dreams

How does a machine think ?

Programming Language

layers of abstractio

n

Machine Instructions

Movement of electrons

Java

Algorithms

its great- great-… grand-child

Shockley’s first

transistor

load p 5mult p 12

p = 5*12;

How many problems am I facing ?

our tasks

computer’s tasks

compile

run

program

Abstract Art

mygrid.drawRect(1,2,3,4,Color.magenta);

10 x 10 grid

Assignment 2, Problem 4

Create the following “work”:

g.addRect( … );g.addRect( … );g.addRect( … );g.addRect( … ); …

Why ?

Science is about explaining and understanding data.

Computer Science provides powerful tools to do this.

simulation analysis

N-body problem

How many forces do we need to keep track of … ?

How does each object affect others … ?

How do we represent physical phenomena … ?

http://www.kingsu.ab.ca/~brian/proj/nbod2.html

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { System.out.print("Hello World!"); System.out.println("How are you?"); }}

HMCSupport.out.println(“harvey”);

H.out.println(“dd”);

HMCSupport.out.print(“mu”);

H.out.print(“college”);

Java baggage #5 -- Printing

are all basically the same.

SystemHMCSupport

H

H.p(“leg”);H.pl(“e”);

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { System.out.print("Hello World!"); System.out.println("How are you?"); }}

HMCSupport.out.println(“harvey”);

H.out.println(“dd”);

HMCSupport.out.print(“mu”);

H.out.print(“college”);

Java baggage #5 -- Printing

SystemHMCSupport

H

H.p(“leg”);H.pl(“e”);

are all basically the same.

So, use H !

/* A Hello, World program */

class CS5App { public static void main(String[] args) // start here { H.p("Hello World!"); H.pl("How are you?"); }}

H.pl(“harvey”);

H.pl(“dd”);

H.p(“mu”);

H.p(“college”);

\n puts a new line anywhere

goes to next line at endstays on same line at end

Java baggage #5 -- Printing

goes to next line at endstays on same line at end