imperative, OO / Java
Representation
Collected by Matthias Hauswirth — Own practice
Makes explicit the fact that comparisons are just expressions (they produce a boolean value), and that one can construct expressions with the ternary conditional operator (providing a boolean value as the first operand).
PL | NM |
---|---|
... | (all aspects from 4-Arrays) |
binary comparison operator (==, !=, <, <=, >=, >) | tree node with operator between two holes |
ternary conditional operator (?:) | tree node with a hole for the condition, '?', a hole for the then-value, ':', and a hole for the else-value |
The structure, typing, and evaluation of expressions involving comparisons and conditionals.
When explaining comparisons (e.g., when introducing conditional statements and loops) and conditional expressions.
Small, can be done on paper or with a tool like Expression Tutor.
The following videos and activities come from ExpressionTutor.org, where you can find a much more comprehensive set of resources and tools. Expression Tutor supports many different programming languages, but the material discussed here is specific to Java.
The Crash Course: Expressions in Java provides a learning experience that corresponds to this notional machine sequence.
The following video comes from section Comparisons & Conditionals of the Crash Course.
Here is an example “Expression Tutor” activity. Can you solve it?
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".