Work in teams of three or four people based on the number assigned in class. Together, study the code in the handout. and do the following tasks.
Feel free to use the MVC paper you read last week as a source of ideas.
Your group submits a page showing your answer from the main program, with any drawings or scratch work that support your answer; your list of questions; and your proposed MVC design.
We will discuss your questions and try to provide answers.
Here are some of the questions I answered as I moved around the groups:
What is this? It is a Java and C++ "pseudo-variable" that refers to the object that is responding to the message. In this example, a reactor passes this to its dependents with an update message, so that the dependent knows who is sending the update message.
What do the first three lines of the reactor constructor do? They initialize the instance variable my_name, a string, to the value of the constructor's argument, name.
What if the object needs to update itself differently depending on who send the update message? This is precisely why the sender of update passes itself as an argument with the message -- so that the receiver can use that information, if it wants, when updating. In this example, a reactor displays the name of whoever asked it to update.
How do we avoid an infinite loop of dependents? In MVC, this tends not to be a major problem, since most dependencies run from views to models. In general, though, this is a thorny problem. A number of algorithms address this problem in specific circumstances. You will learn about such algorithms in 810:153 and 810:161.
Isn't there a better way to handle subscription overflow? Sure. This is just a demo program. (The Ada'95 demo program throws an exception; the Java, C++, and CLOS demos could do the same.)
Work in the same groups as you did for Exercise 16. Together, study the code in the handout and do the following tasks.
Feel free to use the MVC paper you read last week as a source of ideas.
Your group submits a page showing your answer from the main program, with any drawings or scratch work that support your answer; your list of questions; and your list of proposed improvements. You also submit your commented version of the code.
We will discuss your questions and try to provide answers.