Recommended Literature. There are no prescribed texts. “Visual Programming with Prograph CPX” by Scott B. Steinman and Kevin G. Carver, Manning Publications/Prentice Hall, ISBN 0134411633 Is recommended (the only available text on Prograph), but not strictly required.
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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Visual Programming is an active research area, but not a well-established subject.
This has the unfortunate consequence that there are no general textbooks
available that cover the contents of the lecture.
Useful resources are the following:
- “Visual Programming with Prograph CPX” by Scott B. Steinman and
Kevin G. Carver, Manning Publications/Prentice Hall, ISBN 0134411633
(useful, but not strictly required, because Prograph comes with extensive documentation)
- Ephraim P. Glinert, editor.
Visual Programming Environments: Paradigms and Systems (Vol 1) and
Visual Programming Environments: Applications and Issues(Vol 2),
IEEE Computer Society Press, 1990
- The proceedings of the conference series
“IEEE Symposium on Visual Languages”
- The journal “Journal of Visual Languages and Computing” by Academic Press
- The lecture material often gives web-links for specific program systems.
at these pages you do not only find the systems and their implementations,
but also research papers on the systems.
Clarity is a complete functional language in the style of ML
original motivation for Clarity was work on the functional database model
An important aspect is the incremental, interactive design of programs
The claim of the Clarity designers
is that visualization introduces an
additional conceptual level.
The given rules (right) count the number of trees in a “tangled forest” by reducing each tree to a single dot.
Another visual data flow language, in principle relatively similar to Prograph CPX
is Labview by National Instruments.
Labview is a commercial product which is (surprisingly enough) targeted for use
in the laboratory. It has a string emphasis on data acquisition and instrument
control and is therefore equipped with large interface libraries and
Labview can be regarded as the most successful example of the commercial
industrial application of universal visual programming languages.
We will not discuss this system in detail here and only give the flavor with
some brief example pictures.
More Information can be found at: http://www.ni.com/labview/ or in
“LabVIEW Graphical Programming: Practical Applications in Instrumentation
and Control” by Johnson Gary W., Gary W. Johnson. McGraw-Hill, 1997.
and many other books on LabView...
To give an idea of what programming in Labview is like, we run through a tiny
example of a trivial Labview program that repeatedly acquires a temperature
reading and plots the corresponding graph.
- Control in Prograph is explicit.
- Each method can have multiple cases.
- Each case is depicted in a separate window
with input bar (top) and output bar (bottom).
- To select the applicable method, no parameter matching is involved:
Control always starts in the first case and must explicitly be passed on.
- Control structures in Prograph come in two forms:
Case Control and Iteration Control (called “multiplexing”).
- Example: Determining the sign of a number sign(x)=abs(x)
- Case switching is achieved by attaching a “Control” to a “Test”.
(Generally, controls can be attached to any operation).
- The possible Controls are:
- “Next Case” switches to the next method case,
- “Continue” continues normal execution
upon failure of the test (negation)
- The other controls are for loop execution and “failed execution”
- Two types of tests are available:
built-in operations and constant comparison
- In Prograph every operation has three possible outcomes:
success, failure or it raises an error
- An operation is by default successful, except for built-in boolean operations
like arithmetic tests.
- Failure propagates to the calling function.
- Using an explicit fail control makes it possible to let an operation fail.
- Like with a built-in test, the calling method can use a control to make a control
flow decision based on the result.
- Example:Case Bignum 1:1 uses an explicit failure control if comparison fails.
- Loops are controlled by Annotations.
- Repeat annotates a method to simply execute repeatedly
until a Fail, Terminate or Finish Control is executed
- List is used for iterating over the elements of a list (much like “map”)
- Loop annotation an operation to execute repeatedly, while one of the output
“terminals” (values) is “looped back” to one of the input (roots)
- Example of a Repeat control (stacked box):
- List annotation can be used on input and output.
On the input it causes the method to be repeated for each list element
on the output it causes the successive outputs to be collected
into a list (an example appears later in Quicksort).
- Terminate, Finish and Fail can be used to control iterated (Multiplex) methods
- Terminate stops the multiplex immediately
-> The last input value is used as the output value
(i.e. the output of the last successful iteration)
- Finish stops the multiplex, but lets the the current iteration finish
- Fail passes failure to the calling method.
Example: “find a C?” shows (C S E) 2 for terminate and
(S E) 3 for finish
- All controls can be triggered “on success” (check mark) or “on failure” (cross)
of the triggering condition.
- With combinations of Controls and Annotations all possible control structures
can easily be implemented.
Injects allow to determine the Operation to be executed at run-time, ie
To write dynamic code.
This is in spirit similar to the “eval” and “apply” operations in eg. LISP.
Injects “inject” the name for an operation into a dummy node:
- As another means of control, recursion can, of course, be used in the usual way
by letting a method call itself.
- Example: Towers of Hanoi
One of the fastest sorting methods.
(see any textbook on data structures and algorithms for details).
A complex example of code that uses list annotations, controls annotations
We make use of a special annotation type that we have not yet seen: the
Partition annotation: It iterates over a list to check its elements for some
condition (here if they are larger than the pivot values) and splits the
input list into to disjoint output lists: one with the values satisfying the test
the other with those for which the test failed.
Finally, we need a method to join the partial results together. We use the built-in
“(join)” method, as well as the built-in “pack” which packs its input elements
into a list.
Prograph includes an object-oriented language extension.
(The examples up to here were so-called universal methods which do not make
use of these extensions).
Visual Object-oriented programming is fully supported with
visual definition of class hierarchies
template-based class schema and instance editors
Prograph supports static binding (the applicable method is determined at compile
time) as well as late binding (the applicable method is determined dynamically
at run time). The choice is explicitly made by the programmer for each call.
Like many other modern object-oriented languages, Prograph also supports
“Reflection” or “Introspection”, i.e. a program can analyze its classes and
instances, e.g. get a list of all class names, a list of attribute or method
definitions for a particular class etc.
We will treat object-orientation is a separate lecture.
Class Hierarchy Editor
Class Schema Editor
- As a system-level interface, a whole set of “external” operations is provided.
- These operations work in the same way as internal operations, but they call
external definitions (system libraries, toolboxes, DLLs, etc.)
External constants and matches:
External get Field, set field and address
- Prograph uses a two-part interactive environment with an interpreter
and an incremental compiler.
- This allows for complete stand-alone applications can be compiled.
- At the same time, fully interactive debugging and run-time inspection of all
objects / properties / values on the stack is made possible.
- In the interactive debugger it is possible to change object properties,
class definitions and method definitions even within an interrupted method
before resuming operation (with some limitations). This is very similar to the
programming environments of Lisp systems.
- Automatic program animation is available for debugging purposes
(this works by fluently executing single execution steps,
a snapshot of a Hanoi execution is displayed on the next page.
blue is used for “finished”, red for “executing” and green for “waiting”)
- like any proper contemporary programming environment, Prograph CPX
comprises an interactive interface builder in which GUIs can be constructed
without explicitly programming the layout. Like in most other programming
languages, the functionality / behavior is later defined by attaching
action methods to the interface elements .