Use examples of actions, like accelerating a car, to introduce functions.

  • Tell students to think about functions the same way, something an object does over and over again.
    • Ask students to think of a car and things that cars do over and over again.
    • Cars accelerate, back up, brake, have people press buttons, have pedals pushed.
    • You are not responsible for all the stuff that happens after you push down the break, you are simply responsible for pushing the break, for calling the function.
    • This is a helpful way to introduce the abstraction involved in teaching functions.
  • Tell Students to think of how an object responds when performing that function
    • Ask a student what happens when a can begins to accelerate, what else is involved (such as wheels moving, steering wheel turning). This helps with rounding out the concept of a function when it’s reintroduced with return values, etc.

More about this tip

External Source

Interview with Leo Newball