Model subclass: \$#\$Ctr\fboxModel
... initialize value := 0. TV open: self. ... add: anInt value := value + anInt. self changed: #value.
View subclass: \$#\$TV\fboxView
instanceVariableNames: '' TV methodsFor: 'updating' update: aValue Transcript show: 'ok'; cr . TV class instanceVariableNames: '' TV class methodsFor: 'instance creation' open: aCtr self new model: aCtr
The view class TV defines a class method open to create a new view object for an instance of the Ctr class. It must further define a method update (that will automatically be invoked when the Ctr instance signals a change) to display some message, for example the value of the Ctr object monitored.
The Smalltalk programming environment forms an integral part of the Smalltalk system. The code depicted above (which clearly reflects the object nature of classes) is usually not the result of text editing, but is generated by the system. The Smalltalk programming system, in particular the standard library, however, will take some time to get familiar with.