Fellow Ranchers, I have a question about the relationship between the View and the Model. According to the MVC pattern the Model should notify the View of state changes. Some posters have proposed using the fireXXX... methods to take care of that, notifying JTables in the View from the TableModel in the Model. My concern is doesn't this create a strong coupling between the classes? Is it better to use the plain old Observer pattern and just shuttle text-based data from the Model to the View. Incidentally, some people (who have passed the assignment) did not have the Model notify the View, but used the Controller for that purpose. This sounds strange to me,
Cheers and TIA, Alex
posted 14 years ago
I don't think it creates a strong coupling. The model and table model don't need to know anything about the table model listeners. The JTable is a listener just because it was constructed using the table model.