title: Domain driven design: How to deal with complex models with a lot of data fields?
body: <p>Well I am trying to apply domain driven design principles for my application, with a rich domain model that contains both data fields and business logic. I've read many DDD books, but it seems that their domain models(called entities) are very simple. It becomes a problem when I have a domain model with 10-15 data fields, such as the one below: </p>
  
  <pre><code>class Job extends DomainModel{
  
      protected int id;
      protected User employer;
      protected string position;
      protected string industry;
      protected string requirements;    
      protected string responsibilities;    
      protected string benefits;
      protected int vacancy;
      protected Money salary;
      protected DateTime datePosted;
      protected DateTime dateStarting;
      protected Interval duration;   
      protected String status;
      protected float rating;  
  
      //business logic below 
  }
  </code></pre>
  
  <p>As you see, this domain model contains a lot of data fields, and all of them are important and cannot be stripped away. I know that a good rich domain model should not contain setter methods, but rather pass its data to constructor, and mutate states using business logic. However, for the above domain model, I cannot pass everything to the constructor, as it will lead to 15+ parameters in constructor method. A method should not contain more than 6-7 parameters, dont you think?</p>
  
  <p>So what can I do to deal with a domain model with a lot of data fields? Should I try to decompose it? If so, how? Or maybe, I should just use a Builder class or reflection to initialize its properties upon instantiation so I wont pollute the constructor with so many arguments? Can anyone give some advice? Thanks. </p>