title: When should I declare abstract methods?
body: <p>I'm currently working on an application that communicates with other applications in the system over different networks. At present, it communicates through <a href="http://open-dis.sourceforge.net/DIS.html" rel="nofollow" title="Distributed Interactive Simulation Information">DIS</a> as well as <a href="https://www.rabbitmq.com/" rel="nofollow" title="Details on RabbitMQ">RabbitMQ</a>. Internally, however, the application doesn't care who sent the message or in what format.</p>
  
  <p>With this in mind, I've made an abstract class which contains information called InternalMessage, and an Abstract class for sending and receiving these messages, OrchestrationMessenger. The application polls Messengers for incoming messages and sends responses back. However, the process of sending out messages to the network happens internally to the class and is dependent on the Concrete class that extends InternalMessage.</p>
  
  <p>Should the functions that I know each Concrete class will need, but that will only be used internally, be declared in the Abstract class? I understand <i>how</i> to declare the methods, I just don't know if I <i>should</i>.</p>
  
  <p>For example: functions that converts incoming messages to my internal format and visa-versa, read incoming messages from the networks, and send the outgoing messages.</p>
  
  <p>The abstract Messenger:</p>
  
  <pre><code>//Package omitted
  import java.util.Queue;
  
  //Comments omitted
  public abstract class OrchestrationMessenger &lt;M extends InternalMessage&gt; implements Runnable
  {
      protected Queue&lt;M&gt; incoming, outgoing;
  
      //Send out a Message, such as responses or commands
      public void publish(M message)
      {
          outgoing.add(message);
      }
  
      //Receive next incoming Message Object
      public M process()
      {
          return incoming.poll();
      }
  
      //Check if there are any Messages to process
      public boolean hasNext()
      {
          return !incoming.isEmpty();
      }
  }
  </code></pre>
  
  <p>Thanks!</p>