Welcome to CS 5 - PowerPoint PPT Presentation

About This Presentation
Title:

Welcome to CS 5

Description:

Midterm #1 Friday, October 8. Midterm #2 Friday, November 12. Final To be announced ... double quotes create a literal string. the 'dot' indicates containment ... – PowerPoint PPT presentation

Number of Views:65
Avg rating:3.0/5.0
Slides: 96
Provided by: zachd
Category:

less

Transcript and Presenter's Notes

Title: Welcome to CS 5


1
Welcome to CS 5 !
Introduction to CS
Of all the classes I took, this was one of them.
When CS 5 was over, I knew it was a good thing.
an advocate of concrete computing
- Ebert and Roepers course reviews
2
Meeting Times and Places
M and W 4-5 pm in the Academic Computing (AC)
Labs
Lab
T and Th 230-330 pm AC Labs are in Parsons
146
Required !
Chance to work on HW problems ask questions
Alternate using the Macs and the PCs .
Mac A-J
PC M-Z
by last name
alternating each week...
3
Meeting Times and Places
M and W 4-5 pm in the Academic Computing (AC)
Labs
Lab
T and Th 230-330 pm AC Labs are in Parsons
146
Required !
Chance to work on HW problems ask questions
Alternate using the Macs and the PCs .
Mac A-J
PC M-Z
by last name
alternating each week...
M and W 245-400 pm (or so) here in Galileo
Pryne
Lecture
T and Th 115-230 pm (or so) here in Galileo
Pryne
Strongly encouraged
Insight into the HW problems (what, why, how)
4
Meeting Times and Places
M and W 4-5 pm in the Academic Computing (AC)
Labs
Lab
T and Th 230-330 pm AC Labs are in Parsons
146
Required !
Chance to work on HW problems ask questions
Alternate using the Macs and the PCs .
Mac A-J
PC M-Z
by last name
alternating each week...
M and W 245-400 pm (or so) here in Galileo
Pryne
Lecture
T and Th 115-230 pm (or so) here in Galileo
Pryne
Strongly encouraged
Insight into the HW problems (what, why, how)
Recitation
800 - 900 am Fridays in Galileo Edwards
NO recitation this week -- its for Mondays
section only!
All are welcome
More insight into the HW problems (how)
5
Resources
Course Web Page
http//www.cs.hmc.edu/courses/2004/fall/cs5
all assignments, online text, necessary files,
lecture slides are here
First weeks assignment Reading Wk 1 and
starting on Hw 2.
6
Resources
Course Web Page
http//www.cs.hmc.edu/courses/2004/fall/cs5
all assignments, online text, necessary files,
lecture slides are here
First weeks assignment Reading Wk 1 and
starting on Hw 2.
Course Mailing List
reminders and hints
CS 5 vs. spam!
7
Resources
Course Web Page
http//www.cs.hmc.edu/courses/2004/fall/cs5
all assignments, online text, necessary files,
lecture slides are here
First weeks assignment Reading Wk 1 and
starting on Hw 2.
Course Mailing List
reminders and hints
CS 5 vs. spam!
Old Compiler CodeWarrior
Learning Edition 3.0 35
8
that smile... ?!
9
Resources
Course Web Page
http//www.cs.hmc.edu/courses/2004/fall/cs5/
all assignments, online text, necessary files,
lecture slides are linked
First weeks assignment Reading Wk 1 and
starting on HW 2.
Course Mailing List
XCode - Mac
reminders and hints
Compiler JCreator or XCode/Proj. Builder
Price 0 !
JCreator - PC
With many other advantages, as well...
available from www.cs.hmc.edu/dodds/cs5
10
Homework
Assignments
4-5 problems (50 points) per week, 20 extra
credit
Mondays section
due Sunday 1159 pm
Tuesdays section
Wednesdays section
due Monday 1159 pm
Thursdays section
Working on programs save in your CHARLIE home
directory (H)
saving on the C drive is OK on your machine, of
course!
Submitting Programs on line from the course
website
Working on different machines submit and
download
Youll need the supporting files for each machine
youll be using
These are all available from the CS 5 website
(Hw2Pr1.zip, etc.)
11
Grading
Grades
if (score gt 95) grade A if (score gt
95) grade HP if (score gt 60) grade
P see course syllabus for the full grade
list...
Based on points percentage
50 Assignments
30 Exams
20 Participation
12
Grading
Grades
if (score gt 95) grade A if (score gt
95) grade HP if (score gt 60) grade
P see course syllabus for the full grade
list...
Based on points percentage
50 Assignments
30 Exams
20 Participation
Exams
Midterm 1 Friday, October 8 Midterm 2
Friday, November 12 Final To
be announced
50 points each
300 points
if (currentgrade A) takeexam false
13
Grading
Grades
if (score gt 95) grade A if (score gt
95) grade HP if (score gt 60) grade
P see course syllabus for the full grade
list...
Based on points percentage
50 Assignments
30 Exams
20 Participation
Exams
Midterm 1 Friday, October 8 Midterm 2
Friday, November 12 Final To
be announced
50 points each
300 points
if (currentgrade A) takeexam false
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...
14
Resources
Instructors
Zach Dodds
Belinda Thom
Office Olin 1265
Olin 1241
Phone x78990 (909-607-8990)
x79662
Email dodds_at_cs.hmc.edu
bthom_at_cs.hmc.edu
Official Office Hrs F 9-12
TTh 430-6
Real Office Hrs come by
anytime
Graders / Tutors
  • 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

Other Students
The Honor Code and Computer Science...
15
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 weeks
problems. (The same guidelines apply for each
pair.)
16
Questions ?
17
Welcome to CS 5 !
Introduction to CS
Of all the classes I took, CS 5 was one of them.
When CS 5 was over, I knew it was a good thing.
Not as poignant as Jason vs. Freddy, but at least
as gory!
an advocate of concrete computing
- Ebert and Roepers course reviews
18
Welcome to CS 5 !
Computer Psychology
Of all the classes I took, CS 5 was one of them.
When CS 5 was over, I knew it was a good thing.
Not as poignant as Jason vs. Freddy, but at least
as gory!
an advocate of concrete computing
- Ebert and Roepers course reviews
19
Goals
class Spublic static void main(Stringa)String
s "class Spublic static void main(Stringa)Str
ing s char c34System.out.println(s.substring(0
,52)cs cs.substring(52)) char
c34System.out.println(s.substring(0,52)cs
cs.substring(52))
ouch!
20
Goals
class Spublic static void main(Stringa)String
s "class Spublic static void main(Stringa)Str
ing s char c34System.out.println(s.substring(0
,52)cs cs.substring(52)) char
c34System.out.println(s.substring(0,52)cs
cs.substring(52))
ENIAC, 1945
ouch!
thinking like a machine
21
Not why...
Java is the programming language of the future
Programming will solve problems for you
Programming will save time effort
22
Not why...
Java is the programming language of the future
Programming will solve problems for you
Programming will save time effort
2 ampersands in Java () means and
23
(No Transcript)
24
Why ?
Science is about explaining and understanding
data.
Computer Science provides powerful tools to do
this.
simulation
analysis
How do we represent physical phenomena ?
How does each object affect others ?
How many forces do we need to keep track of ?
http//heat.usc.edu/test/new/HSgas.html
N-body problem
25
Why Java ?
Java is a general-purpose computer language
laser-testing code in LabView
Engineering Matlab, Electric, E4
Physics LabView
Chemistry Rasmol, Kaleidograph
Math Maple, ODE Architect
Biology Populus, Lasergene
lots more special-purpose packages
sequence-matching in Lasergene
26
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
27
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
or
28
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
Yes, if youre 60
Maybe, if youre 20
But ... intuition about the machines youll be
using will make you more effective at all of the
above.
29
What is programming ?
Programming recipe-writing
30
What is programming ?
Programming recipe-writing
is
31
What is programming ?
Programming recipe-writing Programming
learning a foreign language
32
What is programming ?
Programming recipe-writing Programming
learning a foreign language
Baggage !
33
What is programming ?
Programming recipe-writing Programming
learning a foreign language
Baggage !
class CS5App public static void
main(String args) System.out.println("H
ello World!")
34
What is programming ?
Programming recipe-writing Programming
learning a foreign language
Baggage !
class CS5App public static void
main(String args) System.out.println("H
ello World!")
Syntax
35
What is programming ?
Programming recipe-writing Programming
learning a foreign language
Baggage !
class CS5App public static void
main(String args) System.out.println("H
ello World!")
week 10
week 13
week 5
week 2
week 2
week 7
What is all of this stuff ?

Why is it here ?
go/went
36
Java baggage 1 -- Punctuation
/ A Hello, World program / class CS5App
public static void main(String args) //
start here System.out.println("Hello
World!")
37
Java baggage 1 -- Punctuation
/ A Hello, World program / class CS5App
public static void main(String args) //
start here System.out.println("Hello
World!")
Punctuation

curly braces create code blocks
matched

double quotes create a literal string
38
Java baggage 1 -- Punctuation
/ A Hello, World program / class CS5App
public static void main(String args) //
start here System.out.println("Hello
World!")
Punctuation

curly braces create code blocks
matched

double quotes create a literal string
.
the dot indicates containment
unmatched

a semicolon ends a statement
39
Java baggage 2 -- Comments
/ A Hello, World program / class CS5App
public static void main(String args) //
start here System.out.println("Hello
World!")
Two types of comments
//
rest-of-line comment
/ /
one-or-more-line comment
40
Java baggage 3 -- Spacing
/ 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...
/ A Hello, World program
/ class CS5App public
static void main(String
args)//starthere System.out.println( "Hello
World!")
41
Java baggage 3 -- Spacing
/ A Hello, World program / class CS5App
public static void main(String args) //
start here System.out.println("Hello
World!")
3. Spacing
almost completely ignored by silicon
almost completely essential for carbon
1. aligning punctuation
these are the
essential style guidelines
2. commenting
3. adequate spacing
42
If you dont space...
riverrunpastEveandAdamfromswerveofshoretobendofbay
bringsusbyacommodiusvicusofrecirculationbacktoHowt
hCastleandEnvirons.
43
If you dont space...
riverrunpastEveandAdamfromswerveofshoretobendofbay
bringsusbyacommodiusvicusofrecirculationbacktoHowt
hCastleandEnvirons.
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
44
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...
45
Java baggage 5 -- Printing
/ 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)
text output
H.out.print(col)
H.p(leg)
H.pl(e)
46
Java baggage 5 -- Printing
/ 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)
System.out H.out H
H.out.print(col)
H.p(leg)
are all basically the same.
H.pl(e)
47
Java baggage 5 -- Printing
/ 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)
System.out H.out H
H.out.print(col)
H.p(leg)
are all basically the same.
H.pl(e)
So, use H !
48
Java baggage 5 -- Printing
/ A Hello, World program / class CS5App
public static void main(String args) //
start here System.out.println("Harvey")
System.out.print(Mu")
goes to next line at end
H.out.println(dd)
stays on same line at end
H.out.print(col)
stays on same line at end
H.p(leg)
goes to next line at end
H.pl(e)
\n
puts a new line anywhere
49
If Joyce wrote in code...
For example,
H.out.print(hvm\naeu\nryd)
H.out.println(whteu\naerae)
H.out.print(vyrao\noeg)
H.out.println(dn\nbooe.)
50
If Joyce wrote in code...
For example,
H.p(hvm\naeu\nryd)
H.pl(whteu\naerae)
H.p(vyrao\noeg)
H.pl(dn\nbooe.)
51
Language is language
Befunge
v gtv"Hello world!"0lt , _25,_at_
PLEASE DO ,1 lt- 13 DO ,1 SUB 1 lt- 238 DO ,1
SUB 2 lt- 112 DO ,1 SUB 3 lt- 112 DO ,1 SUB 4
lt- 0 DO ,1 SUB 5 lt- 64 DO ,1 SUB 6 lt- 238 DO
,1 SUB 7 lt- 26 DO ,1 SUB 8 lt- 248 DO ,1 SUB
9 lt- 168 DO ,1 SUB 10 lt- 24 DO ,1 SUB 11 lt-
16 DO ,1 SUB 12 lt- 158 DO ,1 SUB 13 lt-
52 PLEASE READ OUT ,1 PLEASE GIVE UP
LISP/Scheme
(DEFUN HELLO-WORLD () (PRINT (LIST 'HELLO
'WORLD)))
include ltiostreamgt int main() stdcout ltlt
"Hello, world!"
C
print "Hello, World!"
Intercal
Perl
52
Language is language ?
Perls of wisdom ?
eval evalq.qgttrd!UjLlt061Cltcsnvofltfsddo0cltc
mtdxltxdmmnvIlt011ult251bsltbsdudSdbuofmdw
ltlnwdUlt2tltLhoVhoenv,? odv),idhfiult?314-,vheui
lt?254(bltt,?Bowrb,?bnoghftsd),vheuilt?u-,idh
fiult?311(b,?qbj)(s)3-3-u-001-c(s)3-081-u-3
11 -f(s)3-001-u-031-f(s)3-1-u-34-f(gns)lt
1ult71(zs)-01-51-54-f-f(s)3-1-u-
04-cmbj(b,?bs)3-1-u-311 (Glt,041v)1-L-31-C
-x(v)G-L-,021-C-x(Blt,91v),31-041-,4-B-c(
v),91-041-,74-B-c(Elt,Iv)1-021-31-E-x(v),I-
021-, 91-E-x(Klt,231v),71-81-,31-_at_-C(v),301-
81-,L-_at_-C(v),u-81-,211-_at_-C(Mlt,uv),51-61-1
-F-C(v),L-61-,021-F-C(v),u -61-,211-F-C(J
ltuv)751-41-791--C(v)401-41-441--C(v)u-41-
291--C(b,?bsdudNwm)063-080-091-088-,ufrlt?G-
,ghmmlt?f sddo5(S)1(b,?sdqdu)I-'t(t,?choe)
Envo?lt?rtczS),0('Vb,?w)G-1-31(hg)x081((
t,?choe)Tq?lt?rtczS)0(b,?w)G -1-,31((t,?
choe)Mdgu?lt?rtcz'Vb,?w)G-,31-1(hg)y?31((
t,?choe)Shfiu?lt?rtcz'Vb,?w)G-31-1(hg)Yu,
31((Lh oMnnq)(dyhurtc!vzb,?bs)Z1\-Z0\-
Z3\-Z0\8-,ufrlt?Z2\-,ghmmlt?Z5\(rtc!tzhg
)G?u(zGltLdlt,GGlt,Ldmrdz Glt01dlt01
b,?w)C-d-1(hg)B?u(zBltIdlt,BBlt,Idmr
dzBlt01dlt01b,?w)B-d-1(hg)E?u(zElt031
dlt,EElt,03 1dmrdzElt01dlt01b,?w)E-d-1(
hg)K?u(zKlt229dlt,KKlt,251dmrdzKlt7dlt7
b,?w)_at_-d-1(hg)M?u(zMlt271dlt, MMlt,271
dmrdzMlt9dlt9b,?w)F-d-1(hg)J,u(zJ,ltu
dlt,JJltudmrdzJ,lt7dlt,7b,?w)-d-1('V
hg)x081(zhg ))x?031()x001((zAnltb,?ghoe)nw
dsmqqhof-y-x-Y-X(hg)x?031(zhg)"n(z'Rdmr
dzhg)x?58(zhg)"n?0(znlt7nlt3hg)x81 (nlt,7hg
)x61(b,?w)G-n-1(dmrdz'Rdmrdzhg)"n?0(z'
RdmrdzS)00(UO'Rv)y-x-Y-Q-f(b,?ed
mdud)Q(hg))O 4((rmddq)4(''Ujdyhu)1(hg)
U0(rtc!RzU,,qshoub,?w)G-063,y-081,x
(rtc!SzP)cmbj(RltZ1\P)sde(
rtc!P zb,?bsdudUdyu)L-9,udyult?R/1-,ghmmlt?Z1
\(rtc!szb,?bs)Z1\-Z0\-Z3\-Z2\-,ghmmlt?
Z5\-,ntumhodlt?Z4\(rtc!Vz)y -x-Y-X(ltb,?bn
nser)G(gtchr(/)x2016.
_/'0(.,a()(\_c2sdlhdu,(1ri)b2(
n/1)1tfz),0(o4s)1rs(2u2(u",bw2bhc7s"tlio,tx
ls9r11e(1(9q(,2))_54s9,lh2,_.(ia711f
2308t)4,d/83f,)s,65o_at_ui),rtbn5(_stf0l
t(o.orsrt.c!(i(an2ql/d(l)t2,.i)_.zm
n6t(e126)61_l,),(41/_at_20)/z1_0)(2,,4c
2)\5,h491r_,pa,)4r)_6itc!,nht0rd)_
'open(eval/)_lt0gtfor(x2xlt666a.x)s
..push_at__at_,x5?zafor(/..subs
tr(a,1885))p7._at_psubstr(a,!,3)11e
val
back to Java
53
The Plan
Representation
Naming things
Weeks 2-6
int double
functions, methods, variables
String
boolean true false
float short long char byte void
Information Flow
Making decisions
Weeks 3-4
if else switch case
conditionals, loops
for while do
return break
Abstraction !
Using/Building Structures
Weeks 1-14
new
arrays, classes, design
class private public
static super
54
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
55
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 ??
56
Abstract Art
10 x 10 grid
art.add(GrRectangle(1,3,6,2,Color.red))
57
Abstract Art
10 x 10 grid
art.add(GrRectangle(1,3,6,2,Color.red))
58
Abstract Art
10 x 10 grid
art.add(GrRectangle(1,3,6,2,Color.red))
art.add(GrRectangle( ))
art.add(GrRectangle( ))
59
Assignment 2, Problem 2
Create the following work
art.add(new GrRectangle()) art.add(new
GrRectangle()) art.add(new GrRectangle()) art.
add(new GrRectangle())
60
Computer Science
Representing it -- whats convenient and
available ? Applying it -- graphics,
robotics, vision, AI Measuring it -- whats
possible and whats not
Information
How many drawing commands are really necessary ?
61
Computer Science
Representing it -- whats convenient and
available ? Applying it -- graphics,
robotics, vision, AI Measuring it -- whats
possible and whats not
Information
How many drawing commands are really necessary ?
31 kb file
23 kb file
62
In a nutshell...
The purpose of computing is insight, not numbers.
Richard Hamming
Programming is deceptively easy.
thanks to Steven Pinker
63
Lab Today
Mac A-J
PC M-Z
Work on the problems of Homework 2
Hw2Pr1) The Hello, World! program
(Today)
Hw2Pr2) Abstract(ion) Art
Hw2Pr3) A printing puzzle...
(Next week)
Hw2Pr4) Artificial Intelligence
(or submit hw5...)
Please complete your CS 5 quiz take a photo
  • Not an HMC student ? See me for an HMC account
    building access

64
Quiz
Be sure to have a photo taken !
  • Name
  • Birthdate
  • A place you consider home
  • Your favorite _________ is _________.
  • Your least favorite ________ is _________.
  • Email and School (if not an HMC student)

65
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
dodds_at_cs.hmc.edu
66
Questions ?
67
Questions ?
  • How do I submit things ?
  • Does CodeWarrior run from student rooms ?
  • Can I work on Assignment 5 now ?
  • Whats the best thing to work on in lab ?

68
Resources
Instructors
Office Olin 1265
Zach Dodds
Phone x78990 (909-607-8990)
Email dodds_at_cs.hmc.edu
Official Office Hours F 9-12
Real Office Hours Any time or by email...
Graders / Tutors
  • 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

Other Students
The Honor Code and Computer Science...
69
CS 5 developments
  • The submission system wont be up until
    September 10th...
  • CodeWarrior doesnt 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!

70
Class Meetings
Lab
215 - 315 in the Academic Computing (AC) Labs
Required !
Chance to work on HW problems ask questions
Alternate Mac/PCs . This week Mac A-M PC
N-Z
Kato password w/ more than 8 letters?? -- Change
it on the PC!
Lecture
115 - 215 (or so) here in Galileo Pryne
Strongly encouraged
Insight into the HW problems (what, why, how)
Recitation
800 - 900 Fridays in Galileo Macalister
do NOT come this week -- its for Mondays
section only!
All are welcome
More insight into the HW problems (how)
71
Homework
Assignments
4-5 problems (50 points) per week, 20 extra
credit
Mondays section
due Sunday 1159 pm
Tuesdays section
Wednesdays section
due Monday 1159 pm
Thursdays section
Grading
8 points if it completely works 6 points if it
almost completely works 3 points if it mostly
works 0 points if it doesnt mostly work
8 points for correctness 2 points for commenting
and formatting 0 points if the code does not
compile!
72
Homework
Assignments
4-5 problems (50 points) per week, 20 extra
credit
Mondays section
due Sunday 1159 pm
Tuesdays section
Wednesdays section
due Monday 1159 pm
Thursdays section
73
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 youve
forgotten everything you've learned
74
Language is language
familiar and sometimes not so familiar
deceptively easy
Theres baggage to get used to.
Java
programming -- writing a recipe programming --
learning a foreign language
scare you w/Hello, world in other
languages really no scarier than being raised
to learn Finnish or whatever
syntax
hello, world static, public
75
Javas baggage
/ 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()
6. Input
H.in.nextLine()
worthwhile?
76
CGU slides
77
Why ?
IS is about explaining and understanding
data
leveraging technologies economically
promoting relationships with people
Computer Science provides a set of tools to help.
simulation
analysis
filtering
communication
N-body problem
How difficult is this?
78
Name calling
Weeks 2-3
Java
Naming things
gender -- example from book
flavor (up,down,charm,strange,top,bottom)
Type integer value (int), sequence of
characters (String), double-precision value
(double), ...
Representation
Information Flow
Naming actions
mood -- Go! But if she were to go There he
goes.
transitive/intransitive
H.out.println()
H.in.nextLine()
79
Decisions, decisions
Weeks 3-5
Java
Big Idea information flow
Name things
Name actions
ifthen puzzle
Make decisions
room draw!
And more of the same
loop pattern
complexity reducing
enough to build an intelligent agent?!
intelligent?! no
80
The Key
building structures out of raw actions
Week 5
any skilled trade
building structures out of raw data
Weeks 6-9
any skilled trade
Weeks 10-14
building structures out of both actions and data
it can take care of itself!
key building things abstraction why?
81
Computer Science
The science of information representing
it -- whats convenient for the electrons?
changing its form -- whats convenient for
us? applying it -- AI, graphics,
robotics, ... measuring it -- complexity
-- whats possible? -- minimal number of
drawing commands
transistors electrons, quantum gates and
particle superpositions, recombinant molecules,
analog computing
programming
algorithms, complexity
computability
algorithms
82
Abstract(ion) Art
computer science is fundamentally a referential
subject...
recognition that you dont really need to know
all the details, you just need to know where to
get them and how to use them from there
83
Expert Advice
Get into a rut early -- do the same process the
same way. Accumulate idioms and standardize! It
is Shakepeares idiom list, not his vocabulary,
that distinguishes him.
Alan Perlis
84
If you dont space...
riverrunpastEveandAdamfromswerveofshoretobendofbay
bringsusbyacommodiusvicusofrecirculationbacktoHowt
hCastleandEnvirons.
85
If you dont space...
riverrunpastEveandAdamfromswerveofshoretobendofbay
bringsusbyacommodiusvicusofrecirculationbacktoHowt
hCastleandEnvirons.
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
86
Silicon Dreams
How does a machine think ?
87
Silicon Dreams
How does a machine think ?
Algorithms
How many problems am I facing ?
Programming Language
p 512
Machine Instructions
load p 5 mult p 12
Movement of electrons
its great- great- grand-child
Shockleys first transistor
layers of abstraction
88
Silicon Dreams
How does a machine think ?
Algorithms
How many problems am I facing ?
our tasks
Programming Language
Java
p 512
Machine Instructions
load p 5 mult p 12
computers tasks
Movement of electrons
its great- great- grand-child
Shockleys first transistor
layers of abstraction
89
Silicon Dreams
How does a machine think ?
Algorithms
How many problems am I facing ?
our tasks
program
Programming Language
Java
p 512
compile
Machine Instructions
load p 5 mult p 12
run
computers tasks
Movement of electrons
its great- great- grand-child
Shockleys first transistor
layers of abstraction
90
Abstract Art
mygrid.drawRect(1,2,3,4,Color.magenta)
10 x 10 grid
91
Assignment 2, Problem 4
Create the following work
g.addRect( ) g.addRect( ) g.addRect(
) g.addRect( )
92
Why ?
Science is about explaining and understanding
data.
Computer Science provides powerful tools to do
this.
simulation
analysis
http//www.kingsu.ab.ca/brian/proj/nbod2.html
How do we represent physical phenomena ?
How does each object affect others ?
How many forces do we need to keep track of ?
N-body problem
93
Java baggage 5 -- Printing
/ 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)
HMCSupport.out.print(mu)
System HMCSupport H
H.out.println(dd)
H.out.print(college)
are all basically the same.
H.p(leg)
H.pl(e)
94
Java baggage 5 -- Printing
/ 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)
HMCSupport.out.print(mu)
System HMCSupport H
H.out.println(dd)
H.out.print(college)
are all basically the same. So, use H !
H.p(leg)
H.pl(e)
95
Java baggage 5 -- Printing
/ A Hello, World program / class CS5App
public static void main(String args) //
start here H.p("Hello World!")
H.pl("How are you?")
goes to next line at end
H.pl(harvey)
stays on same line at end
H.p(mu)
goes to next line at end
H.pl(dd)
stays on same line at end
H.p(college)
\n
puts a new line anywhere
Write a Comment
User Comments (0)
About PowerShow.com