Home Segments Index Top Previous Next

219: Mainline

The convention in Smalltalk is to use setter and getter names based on instance variable names. Thus, fCalories: and fCalories are the setter and getter of the fCalories instance variable, with the colon of the setter distinguishing the setter from the colon-free getter. If you wish to express more clearly that a method is a setter or a getter, you can use names such as setFCalories: and getFCalories; if you do, however, many Smalltalk programmers will consider your code oafish.