1 / 33

Computation: Programmability

This lecture provides an overview of computational media programming concepts, algorithms, and programming constructs.

hjanice
Download Presentation

Computation: Programmability

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

  2. 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

  3. 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

  4. 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

  5. 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

  6. 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

  7. LOGO Square Example • to square • forward 50 • right 90 • forward 50 • right 90 • forward 50 • right 90 • forward 50 • end

  8. LOGO Square Example • to square • params [size] • forward :size • right 90 • forward :size • right 90 • forward :size • right 90 • forward :size • end

  9. LOGO Window Example • to window • params [size] • square :size • square :size • square :size • square :size • end

  10. LOGO Window Example • to window • params [size] • repeat 4 [square :size] • end

  11. LOGO Window Example • to window • params [size] • make squaresize (:size/2) • repeat 4 [square :squaresize] • end

  12. LOGO Square Example • to square • params [size] • forward :size • right 90 • forward :size • right 90 • forward :size • right 90 • forward :size • end

  13. LOGO Square Example • to square • params [size] • forward :size • right 90 • forward :size • right 90 • forward :size • right 90 • forward :size • end

  14. LOGO Square Example • to square • params [size] • forward :size • right 90 • forward :size • right 90 • forward :size • right 90 • forward :size • end

  15. LOGO Square Example • to square • params [size] • forward :size • right 90 • forward :size • right 90 • forward :size • right 90 • forward :size • end

  16. LOGO Polygon Example • to poly • params [sideslength] • repeat :sides [forward :length right (360/:sides)] • end

  17. 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

  18. Programming Concepts • Basic programming constructs • Parameters • Loops • Procedural abstraction • Subroutines • Conditionals

  19. 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

  20. 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

  21. 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

  22. 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

  23. Making a “space” • to space • params [length] • penup • forward :length • pendown • end

  24. Making “MARC” • to marc • params [height kerning] • m :height • space :kerning • a :height • space :kerning • r :height • space :kerning • c :height • end

  25. Making “hopback” • to hopback • params [length] • penup • back :length • pendown • end

  26. 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

  27. 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

  28. 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

  29. 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

  30. 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?

  31. 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?

  32. 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

  33. 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

More Related