Comment 1.
�� You probably meant to write
�� �� tracks: aCollection
�� �� �� ^tracks := aCollection
Comment 2.
�� This is a poor design.�� As it is, any object can replace the tracks of an artist
�� with *anything*.�� And even without doing that, any object can add and remove
�� items to an artist's tracks, even if the added items are not Tracks.
�� There are a number of OO design principles, notably the Law of Demeter and
�� of course the GRASP patterns, which basically say "never mutate another
�� object's parts, ask IT to do the mutation."
�� I have come to regard the self-encapsulation "pattern" as an anti-pattern.
�� This is Smalltalk heresy, admittedly, but it doesn't so much break (real)
�� encapsulation as set it on fire, defenestrate it, and urinate on the
�� smouldering remains.
So this is the way I'd do it.
�� ��Object subclass: #Artist
�� �� ��instanceVariableNames: 'tracks'
�� �� ��methods for: 'initialising'
�� �� �� ��initialize
�� �� �� �� ��tracks := OrderedCollection new.
�� �� �� �� ��^self
�� �� ��methods for: 'checking'
�� �� �� ��invariant
�� �� �� �� ��^(tracks isMemberOf: OrderedCollection) and: [
�� �� �� �� �� ��tracks allSatisfy: [:each | each isKindOf: Track]]
�� �� ��methods for: 'accessing tracks'
�� �� �� ��addTrack: aTrack.
�� �� �� �� ��tracks add: aTrack.��
�� �� �� �� ��^track
�� �� �� ��tracksDo: doBlock
�� �� �� �� ��tracks do: doBlock
with no way for outside code to accesss 'tracks' directly.