The Poetics of Code - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

The Poetics of Code

Description:

... as cooking: Chef. Hello World ... Write a program in Chef. It must compile and ... My Sample Chef Program. Danger Flu. Creates a very dangerous danger flu. ... – PowerPoint PPT presentation

Number of Views:61
Avg rating:3.0/5.0
Slides: 21
Provided by: JanetM91
Category:

less

Transcript and Presenter's Notes

Title: The Poetics of Code


1
The Poetics of Code
  • LCC 2700 Intro to Computational Media
  • Fall 2005
  • Ian Bogost

2
Aesthetics
  • The philosophy of art
  • Immanuel Kant (18th c) - the philosophy of
    perception
  • The criticism of taste
  • Literary, Visual, Gastronomic, Musical

3
Poetics
  • Aristotle, a subset of aesthetics (with rhetoric)
  • The first literary theory
  • On poetry a form that carries out imitation
  • Principally advice on writing tragedy
  • Completeness beginning, middle, end
  • Unity of action plot
  • Struggle agôn
  • Comedy imitation of low behaviors (presumably
    to encourage avoiding them)

4
Programming
  • Weve been talking about procedurality as it
    produces expression
  • But is programming itself art?

5
Programming Style
  • Standards for composing code
  • Readability
  • Variable names
  • Consistency
  • Comments
  • Typography
  • Indentations
  • Line breaks
  • Searchability
  • Naming
  • Evocative variable names

6
Hungarian Notation
  • A naming convention in which the name of a
    variable indicates its type
  • Prefixes for variable names
  • strName, sName
  • intAge, iAge
  • lngUserId, lUid
  • datHireDate, datHire

7
Programming Efficiency
  • Class structure
  • Careful use of inheritence
  • Final and other special directives
  • Methods should do one thing
  • When to class based on the environment (J2SE v.
    J2ME)
  • Use error control for exceptions, not for flow
    control
  • Python forces indentation for control flow

8
Coding Standards or Conventions
  • get a b c
  • if a lt 12 and b lt 60 and c lt 60
  • return true
  • else
  • return false
  • if(hourslt12minuteslt60secondslt60)return
    trueelsereturn false

get hours minutes seconds if hours lt 12 and
minutes lt 60 and seconds lt 60 return true else
return false if (hours lt 12 minutes lt 60
seconds lt 60) return true else
return false
9
Programming Style
  • Focused on productivity
  • Collaboration and complexity
  • Taken for granted (consider auto-formatting IDEs)
  • Code as seen only by technical workers, and only
    used to produce programmatic output

10
Programming Languages
  • Themselves designed for maximum productivity
  • Object-oriented programming as a kind of Fordist
    manufacturing process
  • Automatic Factory?
  • Produce poetic output
  • Facilitate poetic productivity

11
Code and the Program
  • HTML as a possible example
  • The markup and the layout are both viewable to
    the end user
  • The markups quality is part of the experience
  • How did they do that (e.g., the single pixel)

12
Upsetting the constraints of languages
  • International Obfuscated C Code Contest
  • Hello World
  • Palindrome
  • She Loves Me
  • Poot

13
New Languages
  • Entire programming languages devoted to
    constrained code-level and execution-level
    expression!
  • Alternate flow control Whenever
  • Compresion Brainfuck
  • Programming from Hell Malebolge
  • Statement redundancy Ook
  • Code as visual aesthetics Piet
  • Code as literature Shakespeare
  • Code as cooking Chef

14
Hello World in Brainfuck
  • gtgtgtgtltltltlt-
  • The initial loop to set up useful values in the
    array
  • gt. print 'H
  • gt. print 'e
  • . 'l'
  • . 'l
  • . 'o
  • gt. space
  • ltlt. 'W
  • gt. 'o
  • . 'r
  • ------. 'l
  • --------. 'd
  • gt. '!
  • gt. newline

15
Hello World in Brainfuck
  • gtgtgtgtltltltlt-gt.gt.
    ...gt.ltlt.gt..------.---
    -----.gt.gt.

16
Hello World in Malebolge
  • (lt9876Z4321UT.Q)M'H"!Bzy?zKwZY44Eq
    0/mlk hKs_dG5m_BA?-YVb'rR5431M/.zHGwEDCBA_at_
    986543W10/.R,Olt

17
Project 7 - Write a program in Chef
  • It must compile and run. It need not be the most
    meaningful program, but it must execute and do
    something coherent
  • It must read like a coherent recipe. That is, the
    source code should be as readable as the
    executable code, and it should make sense as a
    recipe.
  • If you want an 'A', your recipe must also be
    coherent enough to be prepared in the real world.
    This is harder than it sounds.
  • Extra credit (5 points) for anyone who brings in
    a version of their Chef code for us to eat in
    class.

18
Hello World in Chef
  • Hello World Souffle.
  • This recipe prints the immortal words "Hello
    world!", in a basically brute force way. It also
    makes a lot of food for one person.
  • Ingredients.
  • 72 g haricot beans
  • 101 eggs
  • 108 g lard
  • 111 cups oil
  • 32 zucchinis
  • 119 ml water
  • 114 g red salmon
  • 100 g dijon mustard
  • 33 potatoes
  • Method.
  • Put potatoes into the mixing bowl. Put dijon
    mustard into the mixing bowl. Put lard into the
    mixing bowl. Put red salmon into the mixing bowl.
    Put oil into the mixing bowl. Put water into the
    mixing bowl. Put zucchinis into the mixing bowl.
    Put oil into the mixing bowl. Put lard into the
    mixing bowl. Put lard into the mixing bowl. Put
    eggs into the mixing bowl. Put haricot beans into
    the mixing bowl. Liquefy contents of the mixing
    bowl. Pour contents of the mixing bowl into the
    baking dish.
  • Serves 1.

19
My Sample Chef Program
  • Danger Flu.
  • Creates a very dangerous danger flu. Beware!
  • Ingredients.
  • 1 cup yogurt
  • 5 g sneeze particulates
  • 3 capers
  • 4 chives
  • 1 level teaspoon chopped parsley
  • 1 rosemary sprig
  • Method.
  • Put yogurt into the mixing bowl. Combine chives.
    Put capers into the mixing bowl. Add chopped
    parsley into the mixing bowl. Pound the chives.
    Combine sneeze particulates into the mixing bowl.
    Stir the mixing bowl for 5 minutes. Beat chives
    until pounded. Remove capers. Liquify contents of
    the mixing bowl. Pour contents of the mixing bowl
    into the baking dish. Add capers. Add rosemary
    sprig. Stir for 2 minutes. Liquify contents of
    the mixing bowl. Pour contents of the mixing bowl
    into the baking dish.
  • Serves 1.

20
  • Danger Flu.
  • Creates a very dangerous danger flu. Beware!
  • Ingredients.
  • 1 cup yogurt
  • 5 g sneeze particulates
  • 3 capers
  • 4 chives
  • 1 level teaspoon chopped parsley
  • 1 rosemary sprig
  • Method.
  • Put yogurt into the mixing bowl. Stack 1
  • Combine chives. Stack 4
  • Put capers into the mixing bowl. Stack 3 4
  • Add chopped parsley into the mixing bowl. Stack
    4 4
  • Pound the chives.
Write a Comment
User Comments (0)
About PowerShow.com