Home Segments Index Top Previous Next

816: Mainline

Next, you create a Food instance:

Workspace
F := Food new. 

Then, you create an aspect adapter, which you specialize with several messages. The subject: message connects the aspect adapter to the Food instance. The forAspect: message, with the #fCalories argument, stipulates that the fCalories variable, accessed by fCalories and fCalories:, is the variable of interest. The subjectSendsUpdates: message, with the true argument, stipulates that the aspect adapter is to expect the fCalories: message to generate changed: messages, which lead to the sending of update: messages, which the aspect adapter must forward to all viewers.

Workspace
A := (AspectAdaptor new) subject: F; 
                         subjectSendsUpdates: true; 
                         forAspect: #fCalories