Talk:Regularity
From Maze
Generative
Casey can you develop this and put it back in where you think it fits?
[NOTE: The text that follows below is rough, but I'm posted it so you (Mark M. and Nick M.) know what I'm thinking about and what might (or might not) follow. Casey]
In addition to repetition, process is essential to 10 PRINT. A process-based work of art is the result of following the instructions and typically the art focuses on the process itself, rather than a result. It's about the aesthetics of the process rather than visual aesthetics. Like 10 PRINT, there are myriad example of artworks and music compositions that are based on a set of written instructions, either in English or in a specific notions for music or computer program. For example, Alan Kaprow's Work, a created in September 1969 instructs
Process and repetition are often intertwined.
Another frequently used term that applies to 10 PRINT is “generative”. [I've moved some to the conclusion -- we may need to relocate]
The Flow section
Okay, we need to start this chapter with a discussion of 10 PRINT and its structure. To this end, I moved this section to the top, but when I put it in the spotlight (as opposed to the end of the chapter), it was too disjoint from what the chapter is trying to do. Right now this section goes something like this:
Here's something about computers that's a little obvious. Here's something that's less obvious but not not true about 10 PRINT Here's something else that's not really true about 10 PRINT Here's something else we wanted to talk about. Here's looping.
I need you Nick or Mark S. to rewrite this to fit what we've got for the rest of the chapter. I moved it here because I'd like you to start fresh on the prose to write it in the same style as your other sections later on in the chapter.
namely: Establish 10 Print as: 1) a repeated process 2) of creating a regular repeated pattern 3) across time and space
So we can still talk about Flow and Goto but emphasizing not the lesson in computers but instead how the program takes advantage of repetition and regularity. So we can talk about flow but in that case only as we can tie it to explicitly to process. We can talk about Goto but only as that helps us open up the topic of repetition that we will discuss aesthetically. In other words, can you recast this not as a lesson in computing but possessing the basic elements that has been aestheticized (in the arts) and theorized (Truchet & Gombrich) and made possible by the history of computing (square CRT).
So I guess what we need here is to establish the structure of regularity and looping and then to argue that they have long relevant histories outside of CS. Don't get me wrong, we can mention specific concepts in computing -- but we need to only mention the ones that speak to how 10 PRINT is like the things that show up later in the chapter.
At the end of the section we can raise the question about its antecedents in the arts and that will lead into the chapter.
The Flow of Control
In any imperative programming language, commands are processed in a particular order that relates to the left-to-right, then top-to-bottom path that the Western reader's eyes stereotypically take along a page. If one types in two PRINT commands directly to the Commodore 64's BASIC interpreter, with a colon between them, like so:
PRINT "FIRST": PRINT "SECOND"
The result is
FIRST SECOND
The command on the left is executed first; then, probably not very surprisingly, the command on the right is carried out. In executing the following program, the topmost, leftmost command is run first, then the one to the right, and then the one on the next line, so that three lines that read FIRST, SECOND, and THIRD are printed:
10 PRINT "FIRST": PRINT "SECOND" 20 PRINT "THIRD"
The order in which these two lines are actually typed in by the programmer is completely irrelevant to how the program runs. The lines of a BASIC program are executed based on their line numbers, not based on when lines were entered.
There are some important ways to complicate this straightforward program flow. All of these ways involve branching, which causes program flow to continue at some other command rather than what would is, according to left-to-right, top-to-bottom program structure, the next one.
At the low level of machine code and its execution by the processor, the way program flow works is similar. Machine language is a sequence of numbers, and the next number is usually processed. However, an executing machine language program, like a high-level program in BASIC or another imperative language, can either continue to process the next instruction or can move out of sequence to process a different instruction. The standard case is when a processor continues to the next machine language instruction, just as the reader of a text moves to the next word or line. This involves incrementing the program counter so that it points to the place where the next instruction is located in memory. If the current instruction is one that can change the flow of control, however, the program may jump to a new memory location and a new piece of code.
Conditional and Unconditional Branching
There are two essential ways that the flow of control can change and a program can "branch," or continue at a new point. An unconditional branch always directs the program to jump to a new location, like the instruction "Go directly to Jail -- do not pass Go" in Monopoly. The assembly mnemonic for an unconditional branch is JMP; the corresponding BASIC keyword is GOTO.
When an unconditional branch is used to point back to an earlier instruction, it can accomplish repetition in process. In 10 PRINT, the GOTO command is used to cause the program to loop, so that the PRINT command is repeated again and again.
The other type of branch is a conditional branch, a type of instruction that is critical to general-purpose computing. There are many different types of conditional branches in assembly, since there are many different types of conditions. BEQ is "branch if equal," for instance; when used after a comparison (CMP), the branch will be taken only if the compared values are equal. BMI, "branch if minus," checks to see if the last computation resulted in a negative value. In BASIC, using the IF ... THEN statement is the most straightforward way to accomplish a conditional branch, as this program demonstrates:
10 INPUT A$ 20 IF A$ = "1" THEN PRINT "YOU TYPED ONE!" : END 30 PRINT "SOMETHING ELSE..."
If, after running this program, the user types just the digit "1" and then presses RETURN, all of the statements on line 20 will be executed. "YOU TYPED ONE!" will be printed and then the program will terminate as END instructs. This is another way to change the flow of the program, of course: use END or STOP to terminate the program. If STOP is used, the CONTINUE command can be issued to pick up where the program left off.
If the user types anything else before pressing RETURN, the flow of control moves to line 30; both the first PRINT statement and the END are skipped. "SOMETHING ELSE..." is printed instead.
This program, although written differently, does exactly the same thing:
10 INPUT A$ 20 IF A$ = "1" THEN GOTO 40 30 PRINT "SOMETHING ELSE..." : END 40 PRINT "YOU TYPED ONE!"
Instead of using the IF ... THEN to directly determine whether two statements (the PRINT and END statements) should be executed, this one changes the flow of control with GOTO. The GOTO statement is used to skip ahead past PRINT "SOMETHING ELSE..." and END to line 40. Although this isn't a very exciting program, it shows that unconditional branching can be used to move ahead in the sequence of lines; there is nothing about GOTO that means it must be used to repeat or loop.
Although there is no IF ... THEN statement in 10 PRINT, and the program does not by any interpretation contain a conditional branch, this short program does accomplish a very small-scale sort of variation. By computing 205.5+RND(1) and passing that value to the function CHR$, the program prints either PETSCII character 205 or PETSCII character 206. This variation between two characters is a one-bit variation, a selection from the smallest possible set of options. Yet, in combination with the regularity of a repeating processes and the regularity of the Commodore 64's screen grid, these selections take shape as something evocative and visually interesting.
The Harmfulness of GOTO
Those aware of the discourse in computer science might turn to 10 PRINT with some trepidation, thanks to a 1986 letter to the editor from famous computer scientist Edsgar W. Dijkstra, one which was headlined "Go To Statement Considered Harmful" (EWD215). Although the title was actually written by the editor -- Dijkstra called this article "A Case against the GO TO Statement" -- the letter and the sentiment behind it have gained lasting fame. One author called it "probably the most often cited document about any type of programming" (Tribble 2005). As this author explains, Dijkstra's exhortation
was written at a time when the accepted way of programming was to code iterative loops, if-thens, and other control structures by hand using goto statements. Most programming languages of the time did not support the basic control flow statements that we take for granted today, or only provided very limited forms of them. Dijkstra did not mean that all uses of goto were bad, but rather that superior control structures should exist that, when used properly, would eliminate most of the uses of goto popular at the time.
Indeed, there is an obvious control structure, unfortunately absent from BASIC, that would accomplish the purpose of 10 PRINT's GOTO without requiring the use of GOTO. This is the while or do ... while loop, which in this case could simply be used with a condition that is always true so that the loop would always repeat. For instance, if Commodore 64 BASIC had a DO ... WHILE statement and a keyword TRUE, one could write:
10 DO : PRINT CHR$(205.5+RND(1)); : WHILE TRUE
This would certainly be a clearer way to write the program, and it would be widely recognized today as clearer because Dijkstra's view of programming has prevailed. When the creators of BASIC introduced a new version, True BASIC, in 1988, they included the "DO" loop; its syntax was a bit different from the above, but the essential construct was the same.
Although this important construct is missing from early versions of BASIC, it's not obvious that the tiny program 10 PRINT would have particularly offended Dijkstra. In his letter, he objects to the "unbridled use of the go to statement" and does not state that every use of it is unambiguously bad. He describes the GOTO-related problems that arise when programmers are not able to track and understand the values of variables. But 10 PRINT has no variables, so this particular problem with GOTO is not an issue.
The equivalent of a GOTO statement is a staple of machine language programming; it is the unconditional branch, JMP. Dijkstra essentially exempted machine language from his critique of GOTO. He recognized that computer programs written in a high level language are more complicated and nuanced ways of expressing thought, not tied directly to machine function. By creating a new sort of language that does not directly mimic the operation of the processor, it is possible for programmers to think more flexibly and powerfully. Although Dijkstra objected to the way BASIC was designed, he, like the original designers of BASIC, worked strenuously to describe how high-level languages, useful for thinking about computation, could work in machine-independent ways.
BASIC Considered Harmful (Sidebar)
Edsgar W. Dijkstra, of "GOTO Statement Considered Harmful," was not at all a fan of the BASIC programming language in which 10 PRINT is written. He wrote in a 1975 letter, "How do we tell truths that might hurt?," which was published in 1982: "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration" (EWD 498).
The statement appears amid other one-sentence jabs at programming languages (FORTRAN, PL/I, COBOL, and APL), IBM, and projects to allow "natural language" programming. In a 1984 keynote address, "The Threats to Computing Science," he said, similarly, that "the teaching of BASIC should be rated as a criminal offence: it mutilates the mind beyond recovery" (EWD898). In both cases, his statements are not part of arguments, nor are they elaborated at all. They are simple denunciations of BASIC -- no doubt resonant with many computer scientists and no doubt of some tactical value at the time, when the structured programming that predominates today and that Dijkstra was advocating was still being questioned.
Dijkstra's papers contain a single reference to BASIC co-inventor John Kemeny. Dijkstra read Kemeny's 1983 article in Daedalus, an article that discussed the idea of computer literacy and declared that "the development of 'structured languages' in recent years has been a giant step forward." Dijkstra simply wrote a dismissive sentence about the article, saying it "gave a striking example of superficiality" by comparing computer languages to natural languages (EWD858).
Some of the context for these statements is the formation and fortification of a discipline, computer science, and the development and use of languages that might support first formal verification (the provability of programs) and later the weaker but still potentially very useful technique of program derivation (Tribble 2005). BASIC, created for quick interactive use and very amenable to creative production, was simply not a suitable language for Dijkstra's desiderata.
Another bit of context for these statements comes from Alan Kay, who remarked in his keynote speech to the 1997 Object-Oriented Programming, Systems, Languages & Applications conference: "I don't know how many of you have ever met Dijkstra, but you probably know that arrogance in computer science is measured in nano-Dijkstras."
Bounded and Unbounded Loops
10 PRINT works as it does because of its repetition of the PRINT statement, repetition that is unconditional: It will continue until something outside the program interrupts it, such as the user pressing the key labeled RUN STOP or unplugging the computer.
At a high level, programs can contain two types of loops: bounded (also called "finite") and unbounded (or "infinite"). 10 PRINT has the latter kind. If one is writing a program that is intended to produce some result and exit, it would be a mistake to include an unbounded loop. The unbounded loop does have legitimate uses, however. It can be used to keep an application, usually an interactive one, running and accepting input until the system is shut off or rebooted. This can be done, and is one, even on a Commodore 64.
Bounded loops are those that end under certain conditions. The exact conditions vary; some will continue until the program reaches a pre-defined exit state while others execute a specific number of times. If there are exit conditions for a loop at all, that implies the programmer was expecting some kind of change to be introduced as the program executes.
A common use of finite loops is to create an iterative process. Iteration is a special type of looping where the result of one pass through the loop influences the result of succeeding passes. The simplest example of an iterative process is nothing more than counting. Beginning with an initial value of 1. Adding 1 to this (that is, increment it) to produce 2. Performing the same incrementing operation again, to yield 3, and so on. If the program goes to some limit, say 10:
10 A=1 20 PRINT A 30 A=A+1 40 IF A<=10 GOTO 20
The loop is bounded. If line 40 is replaced with 40 GOTO 20, the loop is unbounded.
A conditional branch is what makes loop bounded -- it ends when the condition is met. An unconditoinal branch corresponds to an unbounded loop.
The bounded loop, and counting up or down to a particular value, is so important in programming that BASIC has its own special syntax for specifying that sort of loop, using the FOR ... TO and NEXT statements. The bounded program above could also be written:
10 FOR A=1 TO 10 20 PRINT A 30 NEXT
FOR ... TO ... STEP (Sidebar)
The FOR loop in BASIC is a bit more general than is shown in the example in the main text. It can be used not only to increment a variable, but also to change its value each time by any amount. A different increment is set using the STEP keyword. To show only the even numbers between 2 and 10:
10 FOR A=2 TO 10 STEP 2 20 PRINT A 30 NEXT
If STEP is omitted, it's the same as adding "STEP 1." The step value can be set to a negative number or even to zero. By setting the value to 0, an unbounded FOR loop can be created:
10 FOR A=1 TO 10 STEP 0 20 PRINT "FOREVER!" 30 NEXT
This allows for an alternate version of 10 PRINT that uses a FOR loop instead of GOTO:
10 FOR A=1 TO 2 STEP 0 : PRINT CHR$(205.5+RND(1)); : NEXT
This one is slightly longer and exceeds the 40 characters of a physical line but still a "one-liner" in the sense that it fits into the 80 character logical line.
In this version, the "10" at the beginning is optional. The three statements can be entered together in immediate mode, just as one can type PRINT "HELLO" and have the PRINT statement executed immediately:
FOR A=1 TO 2 STEP 0 : PRINT CHR$(205.5+RND(1)); : NEXT
The only reason the line number is needed in the original program is as a point to branch back to. As GOTO goes, so goes the line number.
Is 10 PRINT Iterating?
From the discussion so far, it should be clear that 10 PRINT has an unbounded loop thanks to the unconditional branch at the end. 10 PRINT clearly repeats. There is nothing in the code, however, to indicate that 10 PRINT is an example of iteration in the more mathematical or computational sense. There are no variables like A that change value from one pass to the next -- there are no variables at all, in fact -- and the code inside the loop, and the way that code works, never changes. In the most straightforward computing sense, the BASIC program 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 does not iterate.
Watching the program execute on screen shows hints that there is something changing as it runs, though: the position where a new character is displayed changes every time the loop executes, moving one location to the right until it reaches the 40th column; then, the display of characters continues on the next line in column 1. The entire contents of the screen also moves up by two lines, with the top two lines disappearing, once the display of characters reaches the bottom left position.
None of this is a direct result of any BASIC statements included in 10 PRINT. Displaying strings on the screen generally has this effect, since BASIC's PRINT command calls the Commodore 64 KERNAL's CHAROUT routine and produces output in this way. So, while 10 PRINT is not an iterative program, it invokes the iterative behavior of PRINT. In this case, the behvaior is a sort of horizontal incrementing, because ";" is used to display the next character immediate after the previous one and a string that is one character long is displayed in each pass. 10 PRINT exposes the power of using simple, iterative steps to create a complex construction.
Alternate Outline for debate
1. The Grid in Culture and Computation [important grid in the history of visual images and computation includes Jaquard, core memory ]
2. The Grid, Time, and Process in the Arts [flatten and fold together the two sections]
3. Doppelgangers [visually similar examples from the Arts, including Truchet]
4. From Circle to Square [history of the screen]
5. The Flow of Control
6. Branching and Loops
Outline for Repeating: Regularity in Time and Process
[Notes from Nick. A: Starting with Vito Acconchi step piece. How is repeating the same thing over and over not repetitive? When a human performs the same thing... Much of the piece is the documentation, images showing the process and each is a little different. He gets better at it, progress charts which shows the statistics and strengthening. Doing reps to improve and make stronger. And there's the observer, the documentation along with different attitudes and life experiences, you see something different in the documentation. Can you step in the same river twice. You look at something identical, the viewer has a different experience. In contrast, look at computational repetition. The computer doesn't "get better" (caching can make the computer better) and machine learning algorithms get better (improve) as they repeat things. This is not the case for 10 PRINT. B: The screenshot of 10 print is like the documentation of Step Piece. Our perception of what we see when we see 10 PRINT now is vastly different than the first time we saw it. ]
1. Motion + Generative are essential to 10 PRINT
- 10 PRINT is performed by C64
2. Repeating Motion in Modern Art (similarity across many art forms, especially in 60s/70s with repetition)(maybe group according to visual motion repetition and repetition in music)(Taylorism?)
- Naum Gabo and Pevsner Manifesto
- Hans Richter and Viking Eggeling in abstract animation
- Repetition in Video Art (Richard Serra “Hand Catching Lead”, Bruce Nauman "Square Dance")
- Repetition in Experimental Animation (Lillian Schwartz "ENIGMA", Norman McClaren "Synchromy", Tony Conrad "Flicker")
- Repetition in American Minimalist Music (Reich "Piano Phase" and "Clapping Music", Glass, more...)
- Repetition in Performance Art (Acconci "Step Piece" Alan Kaprow "Work, A Happening September 1969" )
- Dance (Lucinda Childs, Philip Glass and Sol LeWitt) brings it all together
3. Generative Aesthetics
- Max Bense as influence on Nees, Nake, Mohr. Cybernetic Serendipity
- Modern definition of Generative (from Gelertner)
- The Generative has less precedent, early computer images were generative in space, but not time
- Game of Life as rules followed on a grid in generative way
[Original List]
- The origin of the kinetic w/in 20th Century art, Naum Gabo (quote from Manifesto, 1920)
- Music (Reich "Piano Phase" and "Clapping Music", Glass, more...)
- Video Art (Richard Serra “Hand Catching Lead”, Bruce Nauman "Square Dance")
- Dance (Lucinda Childs, Philip Glass and Sol LeWitt http://blogs.walkerart.org/visualarts/2011/02/17/sol-lewitts-expanding-grid/ )
- Performance Art (Acconci, Step Piece http://www.medienkunstnetz.de/works/step-piece/ http://www.rovetv.net/va-step-piece.html, Alan Kaprow "Work, A Happening September 1969" )
- Generative Aesthetics of Max Bense
- Game of Life is a process on a grid, fascination since invented, holds on
Outline possibilities for GRID
(Note: this 4-part GRID outline was developed through a quick conversation between Nick and myself. It's not meant to be comprehensive and the section names are certainly not right. Casey, 16 July 2011)
- Jacquard Loom and Knitting (exchange patterns through cards) . a textile is a grid from crossing warp and weft. the punched card grid follows from the textile grid: http://en.wikipedia.org/wiki/File:Kette_und_Schu%C3%9F.jpg . exchanging codes that produce patterns . see Fabric Workshop and Museum, show at craft museum in SF
- Medieval Patterns, religious order (http://en.wikipedia.org/wiki/Sebastien_Truchet) - (I added this section, but changed the title, because Truchet wasn't medieval. His work dates to 1704, meaning he predates the Jacquard Loom by a century, so I've also moved this section to the top of the chapter. - Mark, 20 July 2011)
- Screen grid (move from oscilliscope to grid, Radial coordinates to Cartesian, circle to rectangle TV) . progression from circle to square . started circle, then distorted into a rectangular shape (tv tube is on it's way to becoming square) . transition to LCD panel from CRT to LCD
- C64 the Grid of 40 x 25 characters
- Constructivism, Mondrian, Minimalism and Grid in visual art (related to 10 PRINT)
Notes for Grid (Casey) 16 July
- Birth of Cartesian space and objective rational view - Early computer core memory in a grid: http://en.wikipedia.org/wiki/File:Ferrite_core_memory.jpg - Paul Klee in Pedagogical Sketchbook into MoMA work - Rhythm!
Text Remaining from "Iteration"
Perhaps the single most important programming idea is that of a loop. - BASIC: A Manual for BASIC, the elementary algebraic language designed for use with the Dartmouth Time Sharing System, 1 October 1964
Transistors and processors
If you zoom in far enough all a computer ever does is run one iterative loop after another, up to five hundred thousand times per second in the Commodore 64's MOS Technologies 6510 processor and billions of times per second in a modern chip. The iterations are not just restricted to processors though: almost every component in the computer, including memory, input/output controllers, and video adapters are all constantly iterating, no matter what code the programmer writes or the user runs. Digital logic is based on the idea that general-purpose instructions can be modeled using nothing more than ones and zeros, but the ones and zeros must themselves be modeled somehow before they can turn into digits, logic, or characters on a screen.
Computers do one thing well...
At a literally nanoscopic level, a computer is little more than a collection of switches. Lots of switches, really: a few hundred per square millimeter in the Commodore 64's day, and millions per square millimeter using today's most advanced lithographic techniques. (tk footnote Moore's Law?) But unlike a light switch, the transistors used as switches in digital devices are not operated by physically flipping a conductor to complete a circuit. Transistors are solid-state electronics made of semiconducting materials that, depending on an input signal, either allow or prevent the flow of current through a junction. The difference between no current and full current is thought of as the difference between a zero and a one, a false and a true, or an off and an on.
As they are built largely from transistors, computers are devices that do one thing very, very well: they can detect the difference between no current and some current. Despite the power represented by making millions of simple decisions per second, this principle of operation also presents a problem. With no physical components to move and create or break a circuit, a single transistor will not "remember" whether it should be allowing current to flow or not without a constant input signal. Without that bit of memory, a transistor can only ever allow a signal to pass through it; if it is to be useful in logic, it must somehow be made to capture the output of that signal and combine it with the signals coming from other transistors on the chip to perform complex operations.
Memory and CPUs
Depending on which is best for the application at hand, there are several ways to construct a circuit around a transistor that will allow it to behave as a useful logical switch. The most basic is to simply offload that responsibility to another part of the integrated circuit. This approach is often taken in parts of a microprocessor that are intended to carry out the actual work of computing, such as the arithmetic logic unit (ALU). An ALU is a series of transistors organized into logic gates – simple circuits that compare two input voltages and produce an output based on comparing them to see if they are the same or different. (tk footnote Boolean logic) The simple logic gates are ganged together to allow multiple inputs to undergo relatively complex operations and produce multiple outputs. Within the gates, though, the data is simply used and then lost, transformed into an output.
In practice, an ALU is rarely complex enough to accomplish large tasks in a single pass. Since the logic gates must be reused to calculate the results of subsequent passes, storing the results of the first pass is relegated to an accumulator. The accumulator in the Commodore 64's 6510 chip is a memory register that holds the results of a previous calculation until they are fed back into the ALU as one of its inputs for a future calculation. This process, which takes place entirely at the level of transistors, is an iterative function: a process that repeats continuously, using the output of previous passes as an input for the next one.
Pushing storage off into a register does not truly solve the problem of how to make transistors remember states though; it only moves it to another part of the chip. Inside the registers is where the problem must be truly solved, and again the answer uses an iterative loop. The same logic gates that perform calculations in the ALU can be reconfigured into a circuit called a flip-flop. There are many different types of flip-flops, but what they have in common is that they use several transistors to create a positive feedback loop where the state of each transistor switch is reset every clock cycle to be equal to what it was in the previous cycle. An external voltage drives the entire loop and the state of the output is only changed when the state of an input changes. Though it appears from the outside that the state of the flip-flop is constant, the iterative cycle of setting a high or low output voltage based on whether the voltage was high or low in the previous cycle is what gets around the lack of a physical switch. (tk need to specify latches?)
Further away from the heart of the processor, another type of memory also uses iterative cycles to simulate a constant state. Dynamic Random Access Memory (DRAM) is a simpler but slower solution that uses far fewer transistors than the flip-flops in the processors. Instead, DRAM fills a capacitor with electrons to represent a high state. The capacitor quickly discharges though, returning it to a low state. Before it can discharge completely, control circuitry checks to see if it was full on the previous clock cycle and immediately refills the capacitor, effectively creating a loop that holds a state until the memory loses power.
"Go To Statement Considered Harmful"
In the case of 10 Print the GOTO statement avoids most of Dijkstra's complaints. Putting a GOTO statement at the end of a one-line program that simply references itself does not leave much room for unexpected entrances and exits. However, expanding the program to take more than one line demonstrates the potential problems that GOTO introduces:
5 CHARCODE%=205.5+RND(1) 10 PRINT CHR$(CHARCODE%); 20 GOTO 5
This code is functionally identical to the one-line version of 10 Print, but is a bit more representative of how developers create more complex programs. Line 5 creates a variable called CHARCODE% that stores a character code determined by the same formula used in the original 10 Print, but the character code is not used until line 10 when it is printed to the screen. Line 20 has the GOTO statement that makes the program iterate, but it now points to the new beginning of the program at line 5.
Already there is one potential problem: what if the programmer had forgotten to change GOTO's target from line 10 to line 5? The program would still function, but since the loop only returns to line 10 CHARCODE% never changes and the program only prints the same character over and over again with no randomization. Nowhere in this code does it say that the computer must select a random character code every time it prints a character, it is only implied by the fact that line 10 comes after line 5. GOTO allows the programmer to reference any line of code, however; it is just as valid to say GOTO 10 as it is GOTO 5, regardless of the intention that line 10 always executes right after line 5. GOTO's ability to target arbitrary line numbers means that sections of code that are intended to be monolithic can be entered at any point instead of just the beginning of the block.
GOTO's potential problems only get worse when it is combined with other flow control statements. Consider this variant of 10 Print:
1 FOR I = 0 TO 999 5 CHARCODE%=205.5+RND(1) 10 POKE 1024+I,CHARCODE% 15 NEXT I 20 GOTO 1
This version uses a FOR loop to fill the entire screen with the two 10 Print characters, beginning at the top-left corner. Immediately after finishing the FOR loop the program hits line 20 and GOTO sends execution back to line 1, restarting the loop from the beginning. If the forgetful programmer again fails to update line 20 though, leaving it as:
20 GOTO 5
The program will now not only fail to work as intended, it will fail to work at all and throw an error:
? NEXT WITHOUT FOR ERROR IN 15
Unlike the previous version where lines 5 and 10 were only implied to be a block, lines 1-15 are now explicitly a block of code defined as a FOR loop. NEXT relies on FOR, but since the block was re-entered on line 5 FOR never executes and NEXT is no longer valid. Using GOTO has short-circuited the other flow control structures that are critical to the language.
(tk may be clearer with diagram?)
Structured programming
Dijkstra's comments about GOTO were part of a movement toward programming languages that are designed for structured programming. Dijkstra himself would later take the idea further in his Notes on Structured Programming. Instead of viewing a program as line after line of text, structured programming practices involve seeing a program as an abstract set of tasks to be completed. Each of these tasks can be completed independent of one another; one section of the program can be written without worrying about how it is going to reference other sections because they share a common method of moving data between them. At a high level, programmers do not need to worry about how each function will work, they just know that it will and this knowledge allows them to plan their code strategically. Dijkstra compared this model to a string of pearls:
One of the metaphors in which I find myself thinking about the program structure envisaged regards the programs as a necklace, strung from individual pearls. We have described the program in terms of levels and each level contained "refinements" of entities that were assumed available in higher levels. […] I use the term "pearl" for [individual functions].
OOP
Recursion
Design and feedback
Iterative design
Testing as development
Agility and reuse
= Iteration – software and business=
Mechanical reproduction
Version 1.0
Break
Iteration as a Generalized Process
Bread and Beer
Fractals and Chaos
Life
Notes for Grid (Casey)
- As a visual work, 10 PRINT follows from Constructivism. . Started by Rodchenko . Unlike pre-ware utopian constructivism, post-war was about pure logic and systems for their own sake . Post-ware mostly European (focused in Paris, London, Zurich) . GRAV (including Morellet, Molnar) . Ad Reinhardt is a bridge in the US
- Working within a grid . Paul Klee with striking similarity . Francois Molar almost identical to 10 PRINT, including random selection (p. 212 in DATA) . Sol LeWitt worked with random elements in a grid
