posted 22 years ago
Debra,
Thanks for all of the help; I have learned a lot about MVC by reading the discussion.
First, I would like to ask you if, as one reader remarked, MVC should really be called MMMVMC, instead of MVC. Now, it seems to me that there would only be one model, though there could be an arbitrary amount of controllers and views. In fact, the MVC diagram you show has only "state change" and "state query" arrows pointed at the model: there is no "change model" command; furthermore, it makes sense to me that all application data (the model), would only exist in one place, and that different views would represent this data in different ways, which might include leaving out or including certain aspects of (the same) model. What do you think?
Secondly, I would like to point out that you repeatedly refer to the object that contains the Views (that have registered with the model), or the Controllers (that have registered with the View), as being of type ArrayList (java.util package). Although this is probably a good implementation of the necessary functionality, the object that stores the Views or Controllers does not have to be implemented this way, in fact, it is generally better to leave the actual class as an implementation detail, and refer to the actual class used through an interface, such as List, or Collection. This way (if you used the List interface), you could later change the implementation to a LinkedList, etc. very easily. Using an interface to reference the implementing class also allows you to use the java.util.Iterator interface to generically iterate over the implementing class.
[ July 17, 2002: Message edited by: John Rushington ]