To ground my thesis and explain its domain to a non-programming audience, I began by creating an explanatory prototype. It provides an example of a non-graphical visualization of program behavior, using code (the medium of programming) as an interface to explore computation.
This prototype uses Scheme, a programming language known for its simple syntax and flexibility. The prototype provides a way to navigate through the code executed in the course of a computation - providing programmers a means of understanding the way in which the resulting value was derived. To use the prototype, the programmer simply clicks on a value to view the code which generated it. The value of variables are shown to show the programmer the actual data being processed by the code at any point. To see the name of the variable, the programmers hovers the mouse pointer over the value.
Below is a demonstration of the prototype on two functions: one computes the factorial of a number, the other flattens a list. Play with the prototype to get a better understanding of how these functions work.
> (define (fact x) (if (< x 1) 1 (* x (fact (- x 1))))) > (fact 3)6? (fact 3) |(if (< 3 1) | 1 | (* 3 (fact(- 3 1))2)) |(if (< 2 1) | 1 | (* 2 (fact(- 2 1))1)) |(if (< 1 1) | 1 | (* 1 (fact(- 1 1))1)) |(if (< 0 1) | 1 | (fact 0))
> (define (flatten x acc) (cond ((null? x) acc) ((not (list? x)) (cons x acc)) (else (flatten (car x) (flatten (cdr x) acc))))) > (flatten '(a (b c) d e) '())(a b c d e)? (flatten (a (b c) d e) ()) |(cond ((null? (a (b c) d e)) ()) | ((not (list? (a (b c) d e))) (cons (a (b c) d e) ())) | (else (flatten (car (a (b c) d e)) |(cond ((null? a) (b c d e)) | ((not (list? a)) (cons a (b c d e))) | (else (flatten (car a) (flatten (cdr a) (b c d e))))) | (flatten (cdr (a (b c) d e)) ())(b c d e)))) |(cond ((null? ((b c) d e)) ()) | ((not (list? ((b c) d e))) (cons ((b c) d e) ())) | (else (flatten (car ((b c) d e)) (flatten (cdr ((b c) d e)) ()))))