1 muhammed al-mulhemvisual languages - 2 visual programming languages ics 539 diagrams ics...
TRANSCRIPT
1Muhammed Al-Mulhem Visual Languages - 2
Visual Programming Languages
ICS 539Diagrams
ICS Department
KFUPM
Sept. 1, 2007
2Muhammed Al-Mulhem Visual Languages - 2
Diagrams
• There are many forms of diagrams to represent programs.
• Flowcharts are the first and best known diagrams of software.
• In 1969, researchers at Rand created a language based on Flowcharts [Ellis, 1996]
• In the early 1970s, researchers at Xerox Parc created the first visual programming environment; namely the Smalltalk environment [Goldberg, 1983]
3Muhammed Al-Mulhem Visual Languages - 2
Flowchart
• Flowcharts are topological, graph-based constructions that often are filled in with program text.
• The control logic of the program is shown through simple branches and loops.
• Consider the following example:
4Muhammed Al-Mulhem Visual Languages - 2
StartStart
X > 0X > 0
Print “yes”Print “yes” Print “no”Print “no”
StopStop
NNYY
5Muhammed Al-Mulhem Visual Languages - 2
• In some software methodologies, flowcharts are generated by analysts as specification to programmers, who then converts charts into source code.
• In other cases, flowcharts are generated after the fact, either by hand or automatically.
• The usefulness of flowcharts has been debated.
6Muhammed Al-Mulhem Visual Languages - 2
• Flowcharts for large systems tend to get large and messy.
• In order to work around this problem, extensions to flow charts allow charts to be terminated and resumed on different pages.
• Still a program with many loops requires return arrows that may span many pages.
7Muhammed Al-Mulhem Visual Languages - 2
8Muhammed Al-Mulhem Visual Languages - 2
Structure Diagrams
• A structure diagram is a hierarchical, modular breakdown of a program.
• Between levels on the tree there are links, with symbols to indicate the sort of information that is being passed back and forth.
• These structures are represented either as trees or as directed acyclic graphs (DAGs).
• For example look at the next figure.
9Muhammed Al-Mulhem Visual Languages - 2
Calculate PayrollCalculate Payroll
Get Employee RecordGet Employee Record Calculate Net PayCalculate Net Pay Print Pay CheckPrint Pay Check
Calculate DeductionCalculate Deduction Calculate Gross PayCalculate Gross Pay
Employee RecordEmployee Record Pay and DatePay and Date
Employee RecordEmployee RecordNet PayNet Pay
10Muhammed Al-Mulhem Visual Languages - 2
• The structure chart is usually the end result of the activity known as structured analysis, in which the functions of a system are partitioned in a top-down manner.
• Note the diagrams are purely topological, with labeled edges and nodes.
• Note also the difficulty apparent in labeling the edges of such a DAG, even on a small example such as the one shown.
11Muhammed Al-Mulhem Visual Languages - 2
Nassi-Shneiderman Diagrams
• In this sort of diagram, hierarchy is shown using the conventions of enclosure and adjacency.
• Like the others, there is a limit on what they can represent.
• The figure below shows an example.
12Muhammed Al-Mulhem Visual Languages - 2
TRUE FALSE
WHILE L1
WHILE L2
IF L1
IF L2TRUE FALSE
S1
S2
S3
S7
S8
S4 S5
S6
13Muhammed Al-Mulhem Visual Languages - 2
14Muhammed Al-Mulhem Visual Languages - 2
Recursion Portrayal
• Recursion is not an easy concept to teach or understand.
• Recursion is represented graphically using containment.
• Look at the next figure.
15Muhammed Al-Mulhem Visual Languages - 2
FAC(5)
1
5*FAC(4)
4*FAC(3)
3*FAC(2)
2*FAC(1)
1*FAC(0)
16Muhammed Al-Mulhem Visual Languages - 2
Data Flow Graphs
• A data flow graph is a directed graph consisting of edges, which represent data flow, and nodes, which represent operations.
• Tokens flow through the graph- when a node has tokens ready on all its incoming edges it will execute.
• When the node has executed, it puts tokens on its output edges.
17Muhammed Al-Mulhem Visual Languages - 2
• There is no predetermined sequence to the execution of data flow graph - the data derives the order of execution.
• Dataflow graphs are often used in conjunction with dataflow machines, computers built to process tokens in parallel.
• An example is shown next.
18Muhammed Al-Mulhem Visual Languages - 2
19Muhammed Al-Mulhem Visual Languages - 2
Software Level Charts
• At a higher level, the functions of a system can be represented in layer diagram.
• For example the next diagram represents a system where an application can access Motif, X-Lib, a DB API, and a Unix API.
• Like the others, this only work for simple systems.
20Muhammed Al-Mulhem Visual Languages - 2
21Muhammed Al-Mulhem Visual Languages - 2
State Transition Diagrams
• Originated from the study of finite automata.
• They are used for modeling a variety of event-based computer science domains, including:
– Parsing
– User Interface
– Circuit Design
• Edges represent transitions from state to state that occur as a result of an input symbol being read.
• Start and terminating nodes look different.
22Muhammed Al-Mulhem Visual Languages - 2
A A
A
A
A
B
A
B
B
B
B
B
23Muhammed Al-Mulhem Visual Languages - 2
Cell and Arrow Diagrams
• Cell and arrow diagrams are used to represent data structures.
• Most often these diagrams are used for teaching programming or for program documentation.
• The diagrams themselves do not contain enough information to execute from.
• An example is shown next.
24Muhammed Al-Mulhem Visual Languages - 2
((1 2) 3 4)
1 2
3 4