teaching machines

CS 1: Lecture 11 – Method Mechanics

September 29, 2017 by . Filed under cs1, cs145, cs148, fall 2017, lectures.

Dear students,

Sometimes Java is criticized for being verbose. But one of the great advantages of verbosity in a language is that a text reinforces itself. We may read a passage and not know every word, but there are often many clues lying in the context to help us determine their meaning. Java has these same advantages. We can look at a method and figure out a lot of things from how a values are operated upon.

To gain some sensitivity for reading this context, let’s complete several fill-in-the-blank exercises. Your task is to jot what goes in each blank of the following methods. One of the blanks is the method name. Pick something meaningful. The other blanks are not ambiguous. You should be able to deduce exactly what goes there.

Our next task is to develop our mental model of how methods actually behave inside the computer. To make this happen, we will pretend each of the following programs is a screenplay, and each method is acted out by a member of the class. This individual will take notes about the data for which it is responsible, hand off values to methods it calls, and send data back to the method that calls it.

Here’s your TODO list for next time:

See you next class!

Sincerely,

P.S. It’s time for a haiku!

f on his breakup
“I can’t function anymore…”
“I want my x back!”