Prograph CPX Tutorial
Volume Number: 10
Issue Number: 11
Column Tag: Visual Programming
Prograph CPX - A Tutorial 
OOPS! Where’d they put all the semicolons?
Prograph CPX - A Tutorial
Note: Source code files accompanying article are located on MacTech CD-ROM orsource code disks.
This article is an abridged version of a chapter in the forthcoming book
“Application Frameworks,” edited by Ted Lewis and to be published later this year by
Manning Publications/Prentice-Hall. Reprinted with permission.
Prograph CPX is a commercially-supported, self-contained, object-oriented
programming language and development environment running on the Macintosh. It can
produce small footprint, stand-alone applications, and is packaged with an application
framework - called the Prograph ABCs (Application Builder Classes). The ABCs are
roughly comparable in the breadth and depth of their functionality to other Macintosh
frameworks like MacApp [Schmucker, 1988] and TCL [Parker, 1993]. While we’ll
touch on all three aspects of Prograph - the language, the environment, and the
application framework - the major emphasis will be on the framework, its structure,
and its use.
“Prograph integrates four key trends emerging in computer science:
• Prograph is a visual programming language
• Prograph is object-oriented
• Prograph supports dataflow specification of program execution
• Prograph provides an object-oriented application building toolkit.”
- from the Prograph 2.5 manual, page 1
Prograph offers these unique features:
• its language: an object-oriented, visual, dataflow language,
• tight integration of the language with the editor, interpreter, and debugger into a
single unified development tool
• several aspects of the ABCs, including the ability to package classes with custom
graphical editors for their instances.
Prograph CPX is the principal product of Prograph International, and has been
shipping on the Macintosh since 1988. It is positioned as a development tool that has
the interactive ‘feel’ of the Macintosh Finder, yet with all the power to access any
Macintosh internal that can be accessed from any C, C++, or Pascal programming tool.
In fact, it would be reasonable to state that Prograph is the first industrial-strength
visual programming system.
Prograph users run the full gamut of Macintosh application developers: from
former HyperCard scripters or 4D developers, to those who are quite comfortable
using MacApp or TCL in C++, and from developers who are primarily concerned with
the functionality of their product (application developers) to those who are more
concerned with the data content of their work (title developers). They have used
Prograph to implement shrink-wrapped products, in-house applications, prototypes,
and database front-ends, among other uses.
As of this writing (September 1994), the current version of Prograph is
limited to producing applications - non-stand-alone code fragments like XCMDs,
WDEFs, PhotoShop plug-ins, etc. can’t be implemented with Prograph, although
Prograph International plans to remove this restriction. In addition, Prograph only
builds 68K-based Macintosh applications, although here too, they have plans to
produce PowerPC, Windows, and Unix applications.
This article will describe the Prograph language and environment, and then
discuss the Prograph application framework, the ABCs, in some detail. Where
appropriate, comparisons will be made with other Macintosh application frameworks,
most notably MacApp.
Prograph - The Language
The Prograph language is an iconic language. The programmer codes by
constructing drawings and the Prograph interpreter and compiler execute those
drawings. Figure 1 shows a simple piece of Prograph code which sorts, possibly in
parallel, three database indices and updates the database. To many programmers,
drawing a program seems very strange at first, but the power and clarity of code
expressed in Prograph is undeniable. The power of the language has to do with its
primitives and the ways in which they can be used to express a computation, and
explaining the language’s syntax and semantics is the purpose of this section. The
clarity of code expressed in Prograph is due, in part, to the fact that algorithms, by
their very nature, have an inherent internal structure. Often, implementing an
algorithm in a textual, and thus necessarily linear fashion, hides this structure. In
contrast, the Prograph language brings this structure to the surface and enables the
Prograph-literate programmer to grasp this structure in a single gestalt.
Figure 1. A simple piece of Prograph code which sorts -possibly in parallel - three
indices and updates the database. Data flows from top to bottom, and operations -
represented by icons - can execute whenever all their inputs are satisfied.
Figure 2. Some of the basic elements of the graphical design ‘language’. Classes are
represented by hexagons, data elements by triangles, pieces of code by rectangles with
data flow code inside, and inheritance by lines or downward pointing arrows.
The Prograph language has a graphical design and consistency which can be
expressed in a small number of basic representations. Among these representations
are: classes are represented by hexagons, data elements by triangles, pieces of code by
rectangles with a small picture of data flow code inside, and inheritance by lines or
downward pointing arrows. We see in Figure 2 some of these representations used in
their simplest forms. The representations can then be combined and used in a variety
of language elements. For example, initialization methods - which are associated with
an individual class - are depicted as hexagonally shaped icons with a small picture of
data flow code inside. Triangles represent instance variables in a class’ Data Window
to show that they’re data. Hexagons drawn with edges and interiors similar to the
instance variable triangles represent class variables. This associates them with the
class as a whole while also associating them with data. Figure 3 shows some of these
more complex representations.
Figure 3. The elements of the graphical design ‘language’ representations of Prograph
can be combined in ways that are surprisingly self-consistent and easy to learn. In
this figure we see three examples of this: initialization methods , instance variables,