title: Classes to avoid (code complete)
body: <p>I am somewhat confused about a paragraph in the code complete book.</p>
  
  <p>In the section "Classes to avoid" it reads:</p>
  
  <p>"Avoid classes named after verbs  A class that has only behavior but no data is generally not really a class. Consider turning a class like DatabaseInitialization() or StringBuilder() into a routine on some other class"</p>
  
  <p>My code mainly consists of verb classes without data. There are invoicereaders, pricecalculators, messagebuilders etc. I do this to concentrate the classes to one task each. Then I add dependencies to other classes for other functionality.</p>
  
  <p>If I understand the paragraph correctly I should use code like</p>
  
  <pre><code>class Webservice : IInvoiceReader, IArticleReader {
      public IList&lt;Invoice&gt; GetInvoices();
      public IList&lt;Article&gt; GetArticles();
  }
  </code></pre>
  
  <p>rather than</p>
  
  <pre><code>class InvoiceReader : IInvoiceReader {
      public InvoiceReader(IDataProvider dataProvider);
      public IList&lt;Invoice&gt; GetInvoices();
  }
  
  class ArticleReader : IArticleReader {
      public ArticleReader(IDataProvider dataProvider);
      public IList&lt;Article&gt; GetArticles();
  }
  </code></pre>
  
  <p><b>Edit</b>
  Thanks for all the replies.</p>
  
  <p>My conclusion is that my current code is more SRP than OO but that it also suffers from the "anemic domain model".</p>
  
  <p>I'm sure theses insights will help me in future.</p>