imperative / Java / C# / any
Analogy
Collected by Johan Jeuring — Interview, Jeroen Fokker
To illustrate method calls, the teacher dances to another location, performs some actions there (changing the memory), and then returns to the previous location through the return address, where he continues with performing actions
PL | NM |
---|---|
method call | dance to another location |
return address | dance back to the previous location |
It illustrates that you `go elsewhere in the memory' when you call a method, and that you need to remember where you came from (return address) when you go elsewhere. A dancing teacher helps students to remember the concept.
When introducing method-calls
Hardly any cost involved
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".