On the Design of A Generic Visual Programming Environment
Da–Qian Zhang Kang Zhang
Department of Computing, Macquarie University, Sydney, NSW 2109, Australia Email: kang@mpce.mq.edu.au
1. Introduction different modules of a VPE should be designed and
implemented separately, and Visual programming languages (VPLs) are usually improvement of one module should have little impact embedded and tightly integrated within visual on other modules. environments so that they are often characterised by the attributes of the environments [2]. The creation of a VPL is, To ease maintenance, modification, and reuse of a VPE, therefore, concerned with the creation of its visual interactions between different modules of the VPE should programming environment (VPE). be clearly specified. This also allows different formalisms to be developed into individual modules. The graphical requirements of a visual programming The Model–View–Controller (MVC) [3] concept has been environment include defining the visual elements of the successfully used to build user interfaces in Smalltalk–80. language and the graphical relationships that must be MVC consists of three types of objects: Model, View and maintained when these elements are connected together. Controller. Model is an application object, whose screen Algorithms must be provided for graphically editing these presentation is View, and Controller defines the way in elements while maintaining their graphical relationships. which a user–interface reacts to user inputs. Based on MVC, The underlying data structures are complex, containing the DV–Centro framework [1] aims at supporting visual information about visual representation, logical language development. It uses the Supervisor–Agent connectivity, domain knowledge, etc. It is difficult to parse pattern to specify the interaction between the modules of the an edited diagram with a general parsing algorithm. Any framework. Supervisor controls Agent’s behaviour, while solution to solving the data structure problem tends to be so Agent is independent of Supervisor, except that it may notify specialised that it applies only to a single visual language. Supervisor in a predefined protocol. The generation of every new visual language requires a re–development of the whole machinery. To avoid such As shown in Figure 1, DV–Centro replaces MVC Model re–development, we need to find a proper representation of controls ViewController ImageController the data structure and a generic model, which are able to notifies notifies notifies decouple the components of a visual programming controls controls environment. controls View Image Our approach is to view a target or domain–oriented VPE as notifies notifies a specific instance of a generic VPE such that the techniques controls applicable to the generic VPE can also apply to a target VPE Subject Figure 1 : The DV–Centro framework and functionalities common to VPEs need not be re–developed. This paper addresses the issues in a design model that supports the development of a VPE by dividing with the term Subject, that provides all the necessary the whole development process into several independent information about an application. A View is a manager and functional modules. logical representation of a diagram while an Image is a visual representation of a diagram. A ViewController interprets events occurred in a single view and uses 2. MVC and Supervisor–Agent Pattern ImageControllers to implement graphical and textual editing operations. An ImageController interprets specific A generic VPE can be viewed as a collection of visual and mouse and keyboard events and manipulates elements of textual specification tools, which are themselves visual Images. languages and/or textual languages. To design a visual programming environment, one needs to consider the language’s syntax and semantics, and the visual interface. 3. An Improved Model For supporting the generation of a wide range of VPLs, we The dependence of ViewController on ImageController and aim at maximising the reuseability of language components View implies that the high level control depends on its low with the following considerations: level implementation (e.g. ImageController). It is, however, desirable that any improvement on the low level facilities example, a user may move the mouse onto a visual object will have no impact on the high level specification. So a and click a button to trigger an action. When a visual object model that removes the dependency relationship between receives a user input, View sends the visual object to ViewController and ImageController is more flexible. Controller, which interprets the input and sends back a If the link between ViewController and ImageController has control command indicating what View should do next. For been removed, View becomes a key module because it example, Controller may instruct View to pop up a menu to relates to almost all the other modules. To allow allow the user to act further. indenpendent designs of ViewController, Subject, and Diagram Creation. A graph consisting of a set of visual ImageController/Image, we reverse the relationships objects can be created on a visual editor controlled by between View and Image and between View and Subject so Controller. Once the graph is constructed, its abstract that the other modules depend only on View. The resulting diagram with domain concepts is created. The mapping framework is shown in Figure 2, where View serves as an relationships between an abstract diagram and a graph interactive protocol between different modules. implies that the abstract diagram provides a logical interface understood by all the VPE modules, and any modification ViewController ImageController to the abstract diagram will be reflected on the graph on the notifies notifies screen. A visual editor itself can be a visual object in View. controls controls controls Parsing. Model receives parsing demands from Controller View Image notifies notifies and performs corresponding transformations and computations on abstract diagrams. controls Subject Figure 2: An improved framework Layout and Animation. If an abstract diagram is associated with visual concepts, the parsing algorithm can perform graph layout and animation by operating on the visual To represent the above framework in the MVL notations, we concepts. This is because that a visual object’s appearance redefine the model as shown in Figure 3, where View may change dynamically when any of its visual attributes is Controller modified through the corresponding concept space.
Model Abstract Diagram View
Based on the above design model, we have developed a & Concept Space generic VPE and a set of visual programming tools for generating domain–oriented VPEs [4]. The generic VPE Figure 3 : The VPE design model can be customised to any domain VPEs once the domain specifications are provided through these tool. Each module corresponds to ImageController and Image, Model in a domain VPE can be designed independently and used corresponds to Subject, and Controller corresponds to with other modules by sharing an abstract diagram and some ViewController. The protocol of interactions between the domain concepts. three functional modules is defined by Abstract Diagram and Concept Space, which replace the previous View. An abstract diagram describes the program structure of a VPE References and a concept space specifies the domain concepts for the [1] P. C. Brown, Satisfying the Graphical Requirements of interaction among the modules. If we view a concept space Visual Languages in the DV–Centro Framework, Proc. as a lexicon of a visual language, an abstract diagram 13th IEEE Symposium on Visual Languages, Capri, provides the sentence structure with which the words of Italy, Sep. 23–26, 1997, pp84–91. lexicon can be described as a visual sentence by associating each word with an entity or a relation of the abstract [2] A. Goldberg, M. Burnett, and T. Lewis, What Is Visual diagram. This sentence is constructed through direct Object–Oriented Programming? M. Burnett, A. manipulation by the user on the screen (View) and controlled Goldberg, and T. Lewis. (eds.), Manning Publications by Controller. By providing a high level description of Co., 1994 domain concepts in the form of a concept space, Model can [3] G. E. Krasner and S. T. Pope, A Cookbook for Using interpret the visual sentence. the Model–View–Controller User Interface Paradigm in Smalltalk–80, Journal of Object–Oriented 4. How It Works Programming, 1(3), Aug. 1988, pp.26–49. Below we describe how Model, View and Controller interact [4] D–Q. Zhang and K. Zhang, VisPro: A Visual Language in our model. Generation Toolset, Proc. 14th IEEE Symposium on User Interaction Control. View consists of visual objects Visual Languages, Halifax, Canada, 1–4 September, which can be manipulated directly on the screen. For 1998.