title: class hierarchy design
body: <p>I want to define a class hierarchy for my Java Project. My intention is basically to get emails from email account and store them to database either with <code>IMAP</code> or with <code>POP3</code> depending on the website(for e.g gmx supports <code>IMAP</code> and yahoo supports <code>POP3</code>). I am  using javamail API for this. Suppose I have 2 sub classes named <code>IMAP</code> and <code>POP3</code>. Their corresponding methods are as below:</p>
  
  <p><strong>POP3</strong></p>
  
  <ol>
  <li>Execute_Parser </li>
  <li>Fetchemails </li>
  <li>CreateMSGDigest </li>
  <li>Get_Foldername </li>
  <li>Scan_Table </li>
  <li>Store_Emailinfo</li>
  </ol>
  
  <p><strong>IMAP</strong></p>
  
  <ol>
  <li>FetchEmails </li>
  <li>CreateMSGDigest </li>
  <li>Scan_Table </li>
  <li>Store_Emailinfo</li>
  </ol>
  
  <p>As you can see <code>POP3</code> needs to implement 2 extra methods which are not needed by <code>IMAP</code>. Implementation of common methods will be same for both the classes. Can anyone please suggest here which methods should I put in base class? I guess all methods of <code>IMAP</code> which are common for both the classes. but then what about other two methods of <code>POP3</code>(Execute_Parser and Get_Foldername )?</p>