I need to understand the proper name for an object that has cropped up in two projects now. Here is the conventional representation for the MVC pattern:

MVC pattern representation 1

However there is another "Model" that is normally present in MVC, which passes the data between the controller and the view (and back):

enter image description here

What is the second model object called? I have heard it referred to as a "Data Transfer Object," a "Value Object," and a "Model Object."

This object is typically necessary because the data being presented in a "View" is almost never in the same form as the data being stored in the data store. Four or five (or more) DAOs may be pulled together in the service or controller to populate this object, and it may be used to update more than one DAO on the way back to the data store.

So, what is the "proper" name for this second model object?

(Image from Creative Commons, Shane Brinkman Davis)

  • @gnat, I read the meta question and I think this falls well within the bounds of legitimate questions. It is a well known concept, a necessary object within that concept, and I need to know what this object is called in order to refer to it within our programming discussions. I'm sorry if you think this is somehow "off-topic" but I disagree. – user1071914 Jan 12 '16 at 15:15
  • I should also add that it only took you three minutes, tops, to find this question and downvote it. That seems REALLY fast. Did you even consider the question, or downvote just based on title? – user1071914 Jan 12 '16 at 15:18
  • 1
    @user1071914 - votes are anonymous by design, and don't be so certain that gnat placed a vote on this question. He frequently runs out and saves votes for the outrageously bad questions. Likewise, there is an error within your first chart. The user shouldn't talk directly to the controller, the user should only interact through the view. The application code backing the view is what would talk to the controller. – GlenH7 Jan 12 '16 at 15:22
  • @GlenH7, thanks for noting that (about the downvote). Sorry, Gnat, if I accused you unfairly. – user1071914 Jan 12 '16 at 15:49
up vote 2 down vote accepted

Meh.

Use whatever term you and your team are comfortable with, as long as you're consistent.

For what it's worth, when I was reading the question as soon as I saw

OTHER "MODEL" OBJECT

I thought "Data transfer object".

ViewModel

If its responsibility is to hold model data in a format convenient for the view, then I would call it a ViewModel.

I'm probably thinking about this differently than most, but to me the complex amalgum of all the different DAOs is the model. As in, that is your Business Model of the data. I'd then draw a separate little "DataStore" entity (with, perhaps, a "*" to indicate multiple) with the classic cylinder "disk" graphic, and hang it off Model.

Alternatively, I'd suggest you call it "Business Model". @MetaFight " View Model" is O.K. too.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.