330 likes | 347 Views
This lecture provides an overview of computational media programming concepts, algorithms, and programming constructs.
E N D
Prof. Marc Davis & Prof. Peter Lyman UC Berkeley SIMS Tuesday and Thursday 2:00 pm – 3:30 pm Spring 2005 http://www.sims.berkeley.edu/academics/courses/is146/s05/ Computation: Programmability IS146: Foundations of New Media
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
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
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
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
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
LOGO Square Example • to square • forward 50 • right 90 • forward 50 • right 90 • forward 50 • right 90 • forward 50 • end
LOGO Square Example • to square • params [size] • forward :size • right 90 • forward :size • right 90 • forward :size • right 90 • forward :size • end
LOGO Window Example • to window • params [size] • square :size • square :size • square :size • square :size • end
LOGO Window Example • to window • params [size] • repeat 4 [square :size] • end
LOGO Window Example • to window • params [size] • make squaresize (:size/2) • repeat 4 [square :squaresize] • end
LOGO Square Example • to square • params [size] • forward :size • right 90 • forward :size • right 90 • forward :size • right 90 • forward :size • end
LOGO Square Example • to square • params [size] • forward :size • right 90 • forward :size • right 90 • forward :size • right 90 • forward :size • end
LOGO Square Example • to square • params [size] • forward :size • right 90 • forward :size • right 90 • forward :size • right 90 • forward :size • end
LOGO Square Example • to square • params [size] • forward :size • right 90 • forward :size • right 90 • forward :size • right 90 • forward :size • end
LOGO Polygon Example • to poly • params [sideslength] • repeat :sides [forward :length right (360/:sides)] • end
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
Programming Concepts • Basic programming constructs • Parameters • Loops • Procedural abstraction • Subroutines • Conditionals
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
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
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
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
Making a “space” • to space • params [length] • penup • forward :length • pendown • end
Making “MARC” • to marc • params [height kerning] • m :height • space :kerning • a :height • space :kerning • r :height • space :kerning • c :height • end
Making “hopback” • to hopback • params [length] • penup • back :length • pendown • end
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
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
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
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
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?
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?
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
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