While starting work on a brand new ASP.net MVC application we've learned that we should have all of our available data pushed to make it easy to create a full view. While learning this we've started using a concept of a ViewModel, or a complex object full of properties from other basic data transfer objects.

Now our problem has been in naming these ViewModels. We've run across the idea of using a name created from the DTO object names like MemberContactViewModel. while this is okay, I feel that names should be more unique or more related to what the complex object will be doing rather than what it's made up of.

What are your thoughts. How should a complex ViewModel be named, based on the data it holds, or the view where it will interact with.

Thanks for the input.


Definitely the View it will interact with.


If you're finding they all related to domain objects, why bother having view models? Why not just let the action interact with the domain layer?

| improve this answer | |
  • So far we've found that we're needing bits and pieces from a couple different domain objects. For example we have a profile showing personal information, and then we have collections for phone, email and mailing addresses. All of these are combined into one view model. But for editing, we actually access each chunk via its own domain model. Hence needing some way of naming these complex objects without repeating domain objects names. – Chris Apr 7 '11 at 20:52
  • @Chris - Have you looked at CQRS? blog.fossmo.net/post/… – pdr Apr 7 '11 at 21:12
  • @pdr: I find it quite odd that a person who knows of and would even suggest CQRS would also recommend letting the view depend directly on domain objects. – quentin-starin Apr 7 '11 at 21:40
  • @qes - Match the tool to the problem. I think all of these approaches are valid in the right context – pdr Apr 7 '11 at 22:00
  • @pdr: true, of course. Difference in semantics I suppose, if I had "domain objects" exposing a bunch of data publicly and referenced them in the views I wouldn't really consider the application to be following DDD much at all and consequently wouldn't call them "domain" objects. – quentin-starin Apr 7 '11 at 22:18

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