What seems required then is that the Model would iterate through the ResultSet, packaging the data probably into some Collection which will be passed to the View. The View then would have to iterate through this Collection in order to generate the needed HTML. As such we iterate through the list twice, once in the Model and once in the View.
...
Am I learning a simple truth, that the benefit of separating responsibilities into tiers can be gained only by paying the cost of duplicate handling of data? Or is there something I'm missing?
As some of the other posters mentioned, by separating out the two (even if from a high level view it looks like duplication) you have a much more flexible system. You can do things like add caching as Philip mentioned.
Of course, the other advantage you get is to be able to test everything without having to test the UI. For example, if you wanted to test-drive the development of the system (using jUnit) it is *much* easier if you are dealing with two separate components - one that retrieves the results from the database and stores it in a collection, and one that retrieves it. I don't know how the TDD UI tools are for Java, but I doubt they're going to be easier than testing those two components separately.
Cory
_______________________________________________ Juglist mailing list [email protected] http://trijug.org/mailman/listinfo/juglist_trijug.org
