Is this considered a model or a view object?
My 开发者_JAVA百科application downloads images from the web and encloses them in custom Image objects. Using my Image class I can extract particular data from the images. That data is eventually presented to the user.
With the model-view-controller paradigm in mind, can my Image class be considered a model class or a view class?
You answered it yourself when you said "the data is eventually presented to the user". The model is the programmatic representation that you can modify/manipulate/extract data from. The view is the "presentation". Your image class "eventually" gets presented. That presentation is the view. The image class is the model.
It would be considered a model - a view is usually a UI template that a model is mapped to.
In a web-based MVC implementation the view is the HTML template into which the data from the model is populated for display.
A ViewModel class should only contain properties and view spesific logic such as formatting, deciding which data should be visible and so on
精彩评论