2005.02.10 - slide 1is146 - spring 2005 computation: programmability prof. marc davis & prof....
Post on 21-Dec-2015
215 views
TRANSCRIPT
2005.02.10 - SLIDE 1IS146 - Spring 2005
Computation: Programmability
Prof. Marc Davis & Prof. Peter Lyman
UC Berkeley SIMS
Tuesday and Thursday 2:00 pm – 3:30 pm
Spring 2005http://www.sims.berkeley.edu/academics/courses/is146/s05/
IS146:
Foundations of New Media
2005.02.10 - SLIDE 2IS146 - Spring 2005
Lecture Overview
• Assignment Check In– Assignment 3: Documenting Artifact Usage
• Review of Last Time– Computation: Programming Concepts
• Today– Computation: Programmability
• Preview of Next Time– Computational Media
2005.02.10 - SLIDE 3IS146 - Spring 2005
Lecture Overview
• Assignment Check In– Assignment 3: Documenting Artifact Usage
• Review of Last Time– Computation: Programming Concepts
• Today– Computation: Programmability
• Preview of Next Time– Computational Media
2005.02.10 - SLIDE 4IS146 - Spring 2005
Lecture Overview
• Assignment Check In– Assignment 3: Documenting Artifact Usage
• Review of Last Time– Computation: Programming Concepts
• Today– Computation: Programmability
• Preview of Next Time– Computational Media
2005.02.10 - SLIDE 5IS146 - Spring 2005
Algorithms and Programming
• Algorithm– A step-by-step description of a procedure to
achieve a desired result
• Programming– Primitives– Means of combination– Means of abstraction
2005.02.10 - SLIDE 6IS146 - Spring 2005
From Algorithms to Programs
• Algorithm– A step-by-step description of a procedure to
achieve a desired result– How can we walk a square?
• Walk forward• Turn• Walk forward• Turn• Walk forward• Turn• Walk forward
2005.02.10 - SLIDE 7IS146 - Spring 2005
LOGO Square Example
• to square– forward 50– right 90– forward 50– right 90– forward 50– right 90– forward 50– end
2005.02.10 - SLIDE 8IS146 - Spring 2005
LOGO Square Example
• to square– params [size]– forward :size– right 90– forward :size– right 90– forward :size– right 90– forward :size– end
2005.02.10 - SLIDE 9IS146 - Spring 2005
LOGO Window Example
• to window– params [size]– square :size– square :size– square :size– square :size– end
2005.02.10 - SLIDE 10IS146 - Spring 2005
LOGO Window Example
• to window– params [size]– repeat 4 [square :size]– end
2005.02.10 - SLIDE 11IS146 - Spring 2005
LOGO Window Example
• to window– params [size]– make squaresize (:size/2)– repeat 4 [square :squaresize]– end
2005.02.10 - SLIDE 12IS146 - Spring 2005
LOGO Square Example
• to square– params [size]– forward :size– right 90– forward :size– right 90– forward :size– right 90– forward :size– end
2005.02.10 - SLIDE 13IS146 - Spring 2005
LOGO Square Example
• to square– params [size]– forward :size– right 90– forward :size– right 90– forward :size– right 90– forward :size– end
2005.02.10 - SLIDE 14IS146 - Spring 2005
LOGO Square Example
• to square– params [size]– forward :size– right 90– forward :size– right 90– forward :size– right 90– forward :size– end
2005.02.10 - SLIDE 15IS146 - Spring 2005
LOGO Square Example
• to square– params [size]– forward :size– right 90– forward :size– right 90– forward :size– right 90– forward :size– end
2005.02.10 - SLIDE 16IS146 - Spring 2005
LOGO Polygon Example
• to poly – params [sides length]
– repeat :sides [forward :length right (360/:sides)]
– end
2005.02.10 - SLIDE 17IS146 - Spring 2005
Lecture Overview
• Assignment Check In– Assignment 3: Documenting Artifact Usage
• Review of Last Time– Computation: Programming Concepts
• Today– Computation: Programmability
• Preview of Next Time– Computational Media
2005.02.10 - SLIDE 18IS146 - Spring 2005
Programming Concepts
• Basic programming constructs– Parameters– Loops– Procedural abstraction– Subroutines– Conditionals
2005.02.10 - SLIDE 19IS146 - Spring 2005
Making a “C”
• to c– params [height]– make halfheight :height/2– left 90– forward :height– right 90– forward :halfheight – right 180– forward :halfheight– left 90– forward :height – left 90– forward :halfheight– end
2005.02.10 - SLIDE 20IS146 - Spring 2005
Making an “A”
• to a– params [height]– make halfheight :height/2– left 90– forward :height– right 90– forward :halfheight – right 90– forward :halfheight – right 90– forward :halfheight– right 180– forward :halfheight– right 90– forward :halfheight– left 90– end
2005.02.10 - SLIDE 21IS146 - Spring 2005
Making an “M”
• to m– params [height]– make diagonal (:height/2)*7/5– left 90– forward :height– right 135– forward :diagonal – left 90– forward :diagonal – right 135– forward :height– left 90– end
2005.02.10 - SLIDE 22IS146 - Spring 2005
Making an “R”
• to r– params [height]– make halfheight :height/2– make diagonal :halfheight*7/5– left 90– forward :height– right 90– forward :halfheight – right 90– forward :halfheight – right 90– forward :halfheight – left 135– forward :diagonal– left 45– end
2005.02.10 - SLIDE 23IS146 - Spring 2005
Making a “space”
• to space– params [length]– penup– forward :length– pendown– end
2005.02.10 - SLIDE 24IS146 - Spring 2005
Making “MARC”
• to marc– params [height kerning]– m :height– space :kerning– a :height– space :kerning– r :height– space :kerning– c :height– end
2005.02.10 - SLIDE 25IS146 - Spring 2005
Making “hopback”
• to hopback– params [length]– penup – back :length– pendown– end
2005.02.10 - SLIDE 26IS146 - Spring 2005
Making a Circle of “MARC”
• to marccircle– params [letterheight letterkerning]– make marcnamewidth
((:letterheight*5/2)+(3*:letterkerning))– repeat 360/:letterheight – [marc :letterheight :letterkerning– hopback :marcnamewidth – right :letterheight– ]– end
2005.02.10 - SLIDE 27IS146 - Spring 2005
Conditionally Making “MARC” Circles• to marccirclecond
– params [letterheight letterkerning circletightness]– make marcnamewidth
((:letterheight*5/2)+(3*:letterkerning))– ifelse (:circletightness=0)– [make rotation :letterheight] – [make rotation :letterkerning]– repeat 360/:rotation [marc :letterheight :letterkerning– hopback :marcnamewidth – right :rotation– ]– end
2005.02.10 - SLIDE 28IS146 - Spring 2005
Making a Square of “MARC”
• to marcsquare– params [letterheight letterkerning]– make marcnamewidth ((:letterheight*5/2)+(3*:letterkerning))– repeat :marcnamewidth/:letterheight– [marc :letterheight :letterkerning– hopback :marcnamewidth– left 90– penup– forward :letterheight– right 90– pendown– ]– end
2005.02.10 - SLIDE 29IS146 - Spring 2005
Lecture Overview
• Assignment Check In– Assignment 3: Documenting Artifact Usage
• Review of Last Time– Computation: Programming Concepts
• Today– Computation: Programmability
• Preview of Next Time– Computational Media
2005.02.10 - SLIDE 30IS146 - Spring 2005
Andrea Brown on Hillis
• Hillis says that “Learning a programming language is not nearly as difficult as learning a natural human language.” Do you think that if humans had difficulty comprehending natural language that their ability to learn programming language would be affected?
2005.02.10 - SLIDE 31IS146 - Spring 2005
Andrea Brown on Hillis
• Hillis mentions that the “most successful computers … are generally regarded by computer designers as having poorly designed instruction sets.” Why is that? If computers are meant to mimic the complexity of humans why don’t “successful computers” have elaborate instruction sets?
2005.02.10 - SLIDE 32IS146 - Spring 2005
Lecture Overview
• Assignment Check In– Assignment 3: Documenting Artifact Usage
• Review of Last Time– Computation: Programming Concepts
• Today– Computation: Programmability
• Preview of Next Time– Computational Media
2005.02.10 - SLIDE 33IS146 - Spring 2005
Readings for Next Time
• Walter Benjamin. The Work of Art in the Age of Mechanical Reproduction. In: Illuminations, edited by Walter Benjamin, New York: Schocken Books, 1985, p. 217-251. – Discussion Questions
• Steven Lybeck
• Lev Manovich. The Language of New Media, Cambridge, Massachusetts: The MIT Press, 2001, p.18-61. – Discussion Questions
• Mark Martell