开发者

Name for a "model and view" object?

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 y开发者_运维技巧ou name a class, that combines a view (template) name and model objects, that should be displayed?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜