title: Naming Conventions Regarding View Models to Avoid Long Names
body: <p>I am creating <strong>view models</strong> for each screen in my ASP.NET MVC application. I put all of the logic for creating a view model in a <strong>builder</strong> class. Usually, there is special logic for converting the data objects into view models, including aggregating, filtering, and sorting. Each builder is passed a <strong>dependency set</strong>, which is an object containing properties for each dependency (repositories, other builders, etc.).</p>
  
  <p>The problem is that my names are getting <em>really</em> long. A dependency set will usually have a name composed this way:</p>
  
  <blockquote>
    <p>view-model-name+Builder+DependencySet</p>
  </blockquote>
  
  <p>View models usually have names composed of where you are currently and the children. For instance, my system has categorized provider definitions. So, in order to show the provider definitions under a category, I have a view model called: </p>
  
  <blockquote>
    <p>CategoryProviderDefinitionListViewModel</p>
  </blockquote>
  
  <p>It will look something like this:</p>
  
  <pre><code>public sealed class CategoryProviderDefinitionListViewModel
  {
      public long CategoryId { get; set; }
      public string CategoryName { get; set; }
      public ProviderDefinitionViewModel[] ProviderDefinitions { get; set; }
  }
  </code></pre>
  
  <p>So, my builder is called</p>
  
  <blockquote>
    <p>CategoryProviderDefinitionListViewModelBuilder</p>
  </blockquote>
  
  <p>So, my dependency set is called</p>
  
  <blockquote>
    <p>CategoryProviderDefinitionListViewModelBuilderDependencySet</p>
  </blockquote>
  
  <p>That barely fits across the screen. My poor fingers are tired. Furthermore, some screens almost show the same data, so their view model names are almost the same. When I am looking through my folder, it becomes really hard to find the specific view model classes I am looking for.</p>
  
  <p>Ideally, I could group my view model classes together, associating them with the view(s) where they are used. It would be nice to avoid collisions and to make names as short as possible, while keeping them meaningful. Has anyone found a naming convention/folder organization that works well in this scenario?</p>