title: Domen driven architecture and user typos/errors
body: <p>DDD teaches us to build our classes like their real-world prototypes.</p>
  
  <p>So instead of using setters</p>
  
  <pre><code>job = new Job
  job.person = person
  job.since = time.Now()
  job.title = title
  </code></pre>
  
  <p>we define well-named methods in our aggregation root</p>
  
  <pre><code>job = person.promote(title, /** since=time.Now() **/)
  </code></pre>
  
  <p>Now the tricky part</p>
  
  <p>Assume we have an UI for an HR where he/she enters a new <code>title</code> via the HTML form and makes a typo like "prgrammer" (Of course in real application there'd be a select list, but here we have a text input), or selects a wrong date (like default today)</p>
  
  <p>Now we have a problem. There are no typos in real world. Our John Doe is definitely a "programmer" and never a "prgrammer"</p>
  
  <p>How do we fix this typo in our domain model?</p>
  
  <p>Our <code>Person</code> has just <code>promote</code>, <code>demote</code>, <code>fire</code>, etc. methods, which reflect the HR domain model.</p>
  
  <p>We could cheat a little bit and change the <code>Job</code> record directly, but now we have a <code>Job.setTitle</code> method, that doesn't reflect our domain model and also, <em>setters are evil</em>, you know.</p>
  
  <p>That may look a little "academic", but that really bugs me when I try to build a good domain model for a complex application</p>