During this week of Thanksgiving in America, I'd like to express how thankful I am for those of you who read this site . . . especially those who have translated cases or written to me with words of encouragement. My best wishes to you all.
tcc-case-title
moderately geeky  moderately geeky

Case 3

Encapsulation

A young monk, new to the temple, not only declared all his methods public but all his instance variables as well. The head abbot grew weary of rebuking the monk and asked the Java master for advice.

The next day, the master summoned the monk to take lunch with him in his private office.

The monk entered to find a sumptuous meal laid out upon the conference table. The master then bade the monk to lie upon the floor.

The monk did as commanded, whereupon the master opened the monk’s robes and drew a large knife. He pressed the naked point firmly into the monk’s chest until a ruby droplet welled up around the blade. The monk cried out in terror and asked the master what his intention was.

“To slit open your belly,” explained the master, “so that I may spoon the rice and pour the tea inside. My schedule is quite full, and I find this method of feeding guests to be extremely efficient.”

Afterward the monk required no more correction.

Topics...  encapsulation