title: Domain Modelling: Neither an Entity nor a Value Object
body: <p>In DDD, the domain model consists of entities and value objects, but what do we do when we need something in the model which is neither of these?</p>
  
  <p>For example, I have introduced the following <code>ScheduledItems&lt;T&gt;</code> implementation in order to encapsulate scheduling specifics:</p>
  
  <pre><code>public class ScheduledItems&lt;T&gt;
  {
      private SortedDictionary&lt;DateTime, T&gt; scheduledItems;
  
      public ScheduledItems()
      {
          scheduledItems = new SortedDictionary&lt;DateTime, T&gt;();
      }
  
      public void ScheduleItem(DateTime scheduledDate, T item)
      {
          scheduledItems.Add(scheduledDate, item);
      }
  
      public void RemoveItem(T item)
      {
          scheduledItems
              .Where(x =&gt; x.Value.Equals(item))
              .Select(x =&gt; x.Key)
              .ToList()
              .ForEach(k =&gt; scheduledItems.Remove(k));
      }
  }
  </code></pre>
  
  <p>This class will be used by a couple of entities for scheduling purposes.</p>
  
  <p>At this point, this is neither an Entity (it has no identity) nor a Value Object (it is not immutable).</p>
  
  <p>One solution is to turn it into a Value Object by making it immutable ('adding' or 'removing' items would return a new instance of ScheduledItems).  </p>
  
  <p>But is this really necessary for something which is not really associated to the domain?  This class could be just like any other .NET collection.</p>