"Norbert" == Norbert Hartl norbert@hartl.name writes:
Norbert> There is no strict rule to it but I think here the majority Norbert> follows some "hint what to expect" rule. That means you name Norbert> the argument after the class of the argument.
Norbert> expensive: anExpensive
If I recall, according to Smalltalk Best Practice Patterns (the seminal patterns book for Smalltalk), you want the attribute to be of the form "isProperty":
isExpensive := true.
which means that "expensive:" shouldn't be a setter. In fact, said book states that you should have "be" methods:
anObject beExpensive anObject beCheap
which would likely set isExpensive to true and false respectively, perhaps, or even 2 states out of a 3-state variable. Encapsulation! Because then you also have tests:
anObject isExpensive ifTrue: [ ... ]
or even (if you use it a lot):
anObject ifExpensive: [ ... ]
I've often argued that automatic creation of getters and setters is wrong. This is clearly an example of where automatic getters and setters lead you to bizarre code.