Initialization preferences
When you initialize your Smalltalk instance variables, you have the option of choosing the technique described above, signalling the length: attribute, or you can choose to initialize the instance variable directly. Each technique has its pros and cons. Connection initialization should prevent problems that could occur in an attribute-to-attribute connection, should you choose to initialize the instance variable directly. And initializing the instance variable directly will cut down on the number of signals, which will help with over-signalling.
There is no right or wrong way to initialize an instance variable. Mostly, the choice is left to you to decide which technique you prefer.
To access variables directly, use the following method:
length
"Return the value of length."
length isNil ifTrue: length := 0]
^length
Last modified date: 01/29/2015