Method-Call Dance

Programming Language

imperative / Java / C# / any

Form

Analogy

Attribution — Origin / Source

Collected by Johan Jeuring — Interview, Jeroen Fokker

Conceptual Advantage

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

Mapping

PLNM
method call dance to another location
return address dance back to the previous location

Draws Attention To

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.

Use When

When introducing method-calls

Cost

Hardly any cost involved

Comments or Feedback?

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".

Create an Issue on GitHub