views:

29

answers:

1

Spring MVC names objects that contain a logical view name and the payload to render ModelAndView, the JAX-RS implementation Jersey names them Viewable. I like Viewable a bit better, but maybe you have a better suggestion.

Example:

return new Viewable("index", payload);

How would you name a class, that combines a view (template) name and model objects, that should be displayed?

+2  A: 

The ModelAndView from Spring just holds a representation of the view (simple case: view name) along with the data to render (which isn't the model itself but the model's data), so I understand why you would prefer the name Viewable.

But Model and View are components from the MVC; they are a concept. So ModelAndView is a good name to represent a concept: view to resolve with the data for it. A good name as well is Viewable to represent the view (which off course will receive data to render).

So IMO, it does not matter how you call them as long as you provide a proper name to represent the concept, and it is clear what it stands for.

dpb