Graphic formalisms should integrate communication, control, and data flow
暂无分享,去创建一个
A graphic fortnalism for software should represent three kinds of directed connection: communication, control, and data. These link ~aree kinds of nodes: units (subprograms, tasks, objects, and so on); statements (structured and simple); and variables (state and data). Effective graphic formalisms show all these flows and nodes and their interrelationships in a controlled and hierarchical fashion, allowing you to build or study software in a structured and progressive manner. The advantage of graphics over text is that you read relationships right off diagrams, reducing your cogni-tive burden. Text forces you to infer relationships and connections at sometimes great cognitive cost; but effective diagrams show these relationships and connections, no inference needed. Naturally, we will illustrate this textual argument with graphic evidence, using SCOOP-4's notation [2]. Case Study 1: A ]Keystroke Counter Our hierarchical structure is black box->clear box-> black boxes->clear boxes-> ... till all boxes are clear or off the shelf. You'll see this in the small (and therefore shallow) Keystroke Counter below: the Keystroke Counter's clear box (Figure 2) introduces three lower level black boxes, which are cleared up in Figures 3, 4, and 5. The fourth black box, Text IO, is off the shelf. Figure 1 is the Keystroke Counter's black box, which gives the program's syntactic and semantic interface. Our graphic notation, SCOOP-4 [1, 2], uses either Concurrent C++ or Ada semantics. In this note's examples we've used Ada. Keystroke Counter is a parameterless procedure. To learn what it does, read Figure l's "Expected External Behavior" box. How does Ke.ystroke Counter do what it does? Figure 2, its clear box, discloses "how" at an intermediate level, in terms of its declarations of three objects and their three lower-level black boxes and their connections. (Of course, our notation retains the discipline and automatic checking of declarations.) After it elaborates its declarations, the Keystroke Counter simply executes a null statement; it has delegated all the real work to its three subordinate objects. The Observer task reads each character from the keyboard; if a character is a '#', then it clears the Counter and terminates , else it increments the Counter. The Counter is an Ada 9X protected record, which will improve Ada's real-time performance. A protected record encapsulates data (in our case a variable "the counter") and ensures mutually exclusive operations on this data by its exported operators (in our case: "clear", "increment", "give me"). The Reporter task schedules …