imperative / Java
Representation
Collected by Matthias Hauswirth — Compilers (control-flow graphs) and flow charts
See a method as a sequence of statements to execute, and make clear that that sequence starts when the method is called and ends when the method returns.
PL | NM |
---|---|
statement | rectangular node |
control-flow between statements | arrow from node to node |
method entry | round 'e' node at top |
method exit | round 'x' node at bottom |
The idea of a 'sequence' in structured programming, where a sequence consists of statements to execute.
When introducing how to implement a method's body
Introduction of a potentially new abstract representation (graph with edges and nodes). Entry and exit nodes, which do not correspond to statements in the source code (note: exit comes AFTER a possible return statement).
This is the first in a sequence of "Control Flow as Graph" notional machines:
The following video Matthias Hauswirth uses the "Control Flow as Graph"
notional machine in his "Programming Fundamentals 2" Bachelor course
to explain sequences of statements as well as the entry and exit node in Java.
It also discusses if
-statements
(covered in the Selection variant of this notional machine).
This notional machine is implemented by the Informa Clicker tool. This tool allows students in a classroom to construct control flow graphs in in-class clicker exercises.
Do you have feedback on this notional machine? Did you find a mistake, or do you have a request for improvement? You can create an Issue on GitHub, where the description is hosted. This way we can see your feedback and address it.
For this, you need a GitHub account. Then follow this link to see the source file of this page. In there, click the ... left of the highlighted line, then pick "Reference in a new issue".