|Column Tag:||Kelly's Corner
By Dave Kelly, MacTutor Editorial Board
Prograph 1.2, An OOP Primer
Prograph is a new pictorial programming language and software development environment. offered by TGS Systems of Halifax, Nova Scotia. Prograph started out as a research project by Drs. T. Pietrzykowski and P. Cox, professors of Computer Science at the Technical University of Nova Scotia. They then implemented Prograph on the Macintosh at TGS Systems, turning it into a next generation development environment and Computer-Aided Software Engineering (CASE) tool.
At the heart of Prograph is a completely pictorial, object-oriented, dataflow style language with a built in source code debugger. The combination of a pictorial, OOP language and integrated development environment makes Prograph a great way to learn about Object Oriented Programming. The pictorial environment of Prograph is a platform which is perfectly suited for the Macintosh. The complete Prograph language development system is made up of three major parts the language, the Application Builder, and the Environment.
Class hierarchy is pictorially represented in the Classes window. A class is an abstract description of a collection of similar objects. Objects have two components, their attributes and their methods. For example, if we were to define a class for humans, we might call the class Person since a group of people is made up of persons. Each person has similar attributes such as arms, legs, hands, feet, etc. The individual people are referred to as instances of class Person. The features that the people have are called their attributes and the things they to are called methods.
Clicking on the left side of the class icon opens up an Attributes window which contains the sequence of attributes of a class. Clicking on the right side of the class icon (in the class window) opens up the Methods window.
There are two ways to retain values. Either they may be stored in class attributes or in persistents. Persistents are universally accessible and are saved with the program between executions.
Clicking on a method icon opens up the cases window which displays the cases which define the method. Another type of methods window called the Universal Methods contains methods which are not specific to any class. A method consists of a sequence of cases. The execution of a method proceeds by dataflow; that is, the operations in the cases window are executed as soon as all their input data is available. The operations which may be used may be 1) Primitives, which represent calls to predefined system methods, 2) calls to Universal Methods, 3) calls to methods in classes, 4) calls to Macintosh Toolbox routines, 5) constants, 6) Matching, which compares inputs and channels the dataflow depending if the match succeeds or fails, 7) Get Persistent, which accesses the value of a persistent, 8) Set Persistent, modifies the value of a persistent, 9) Multiplexes, which are used to repeat an operation, 10) Instance generators, 11) Get Attribute, which is used to access the value of an instance or class attribute, and 12) Set Attribute, which modifies the value of an instance or class attribute. Cases of a method are executed in order and according to the dataflow structure. Operations may be synchronized and controls may be used in various ways to control the flow of execution from one case to the next.
There are several datatypes supported by Prograph in addition to user defined classes:
Numbers (integers or strings as appropriate)
Lists, represented in Lisp notation.
Special types, NULL and NONE
Mac types, used in toolbox calls
Prographs Application Builder has two major components:
A set of about 20 System Classes which provide the framework for building a complete Macintosh application.
A set of interactive, WYSIWYG editors for creating graphic components such as menus, windows and window items. The editors support the basic Macintosh environment with no frills. Hierarchical menus are not supported with the editor, however, toolbox calls are available to achieve nearly every Mac toolbox effect. I counted about 573 calls in the Macintosh Toolbox list in the reference manual. Primitives may also be defined in Lightspeed C using a utility that is provided with Prograph. MacTutor will try to cover this in a future issue.
Prograph has a unique environment which enables you to run an application or method and observe each step as the program executes. Persistents and classes may be examined at each step by clicking on input or output terminals and roots (the circles which connect all of the case sequences together). If a method has not been defined, Prograph asks if you would like to define it. If not you may even artificially create inputs to help the program proceed. This allows you to get specific functions of a method working properly before moving on.
Icons in the editor are created by merely clicking in the window (class, method, attribute). This can be annoying if you click anywhere in the window where there is no icon (creating icons by mistake). Clicking on an icon selects it and double clicking opens a window to its structure,if it is a user-created object or onto a help window if it is a system provided object. Icons may be cut, copy and pasted or selected and dragged.
Prograph is indeed a great way to program the Macintosh. If you arent familiar with object-oriented programming, the tutorial that comes with Prograph is great. It is a bit hard to follow at times, but does a great job of actually teaching you what to do. It takes time though. The tutorial introduces several programming challenges which you should work to get the full benefit and to understand the programming concepts better.
Documentation comes as two manuals (approx 7" X 11"). The odd size makes it difficult to set on my desk without it flopping closed all the time (in my opinion). The reference manual thoroughly covers the primitives, Macintosh Toolbox support, Prographs menus/windows etc., but the index isnt as extensive as it could be. The tutorial manual takes some time to get through, and starts off having you do things that you dont know about until later (or until you figure it out) but I feel the material would be a great text/workbook for a course on OOP. Maybe thats what Prographs authors are doing with it?
There is one major element missing from Prograph 1.2 a compiler. Sure, you can exercise your object-oriented abilities to your hearts content, but serious developers wont be able to create real applications until a Prograph compiler is made available during the second quarter of 1990. Dont let that stop you if you want to learn OOP. There is a good chance that the compiler will be out before this article appears here. Theres more to come Im sure youll be seeing more of this product in the future, especially when the compiler becomes available.
1127 Barrington Street, Suite 19
Halifax, Nova Scotia
Canada B3H 2P8
(902) 429-5642 FAX: 425-0561
Order toll free from the US:
Price: $195 US + $5 shipping (for interpreter)
Prograph Compiler available 2nd quarter 1990