200 likes | 435 Views
Aesthetics. The philosophy of artImmanuel Kant (18th c) - the philosophy of perceptionThe criticism of tasteLiterary, Visual, Gastronomic, Musical
E N D
1. The Poetics of Code LCC 2700: Intro to Computational Media
Fall 2005
Ian Bogost
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 We’ve 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 < 12 and b < 60 and c < 60
return true
else
return false
if(hours<12&&minutes<60&&seconds<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 markup’s “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 ++++++++++
[
>+++++++>++++++++++>+++>+<<<<-
] The initial loop to set up useful values in the array
>++. print 'H’
>+. print 'e’
+++++++. 'l'
. 'l’
+++. 'o’
>++. space
<<+++++++++++++++. 'W’
>. 'o’
+++. 'r’
------. 'l’
--------. 'd’
>+. '!’
>. newline
15. Hello World in Brainfuck ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
16. Hello World in Malebolge (=<`:9876Z4321UT.Q+*)M'&%$H"!~}|Bzy?=|{z]KwZY44Eq0/{mlk** hKs_dG5[m_BA{?-Y;;Vb'rR5431M}/.zHGwEDCBA@98Ą6543W10/.R,+O<
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.
Combine sneeze particulates into the mixing bowl. Stack = 20 4
Stir the mixing bowl for 5 minutes. Stack = 4 20
Beat chives until pounded. Decrement chives, loop until 0 (Stack = 100 100)
Remove capers. Stack = 97 100
Liquify contents of the mixing bowl. Stack = a d
Pour contents of the mixing bowl into the baking dish. Stack = a d, Baking Dish = a d
Add capers. Stack = 100 100
Add rosemary sprig. Stack = 101 100
Stir for 2 minutes. Stack = 100 101
Liquify contents of the mixing bowl. Stack = d e
Pour contents of the mixing bowl into the baking dish. Baking Disk = d e a d
Serves 1. Writes dead to stdout