title: Design of inheritance for Validate interfaces
body: <p>I've never been so good at design because there are so many different possibilities and they all have pros and cons and I'm never sure which to go with. Anyway, here's my problem, I have a need for many different loosly related classes to have validation. However, some of these classes will need extra information to do the validation. I want to have a method <code>validate</code> that can be used to validate a Object and I want to determine if an Object is validatable with an interface, say <code>Validatable</code>. The following are the two basic solutions I can have.</p>
  
  <pre><code>interface Validatable {
    public void validate() throws ValidateException;
  }
  interface Object1Validatable {
    public void validate(Object1Converse converse) throws ValidateException;
  }
  class Object1 implements Object1Validatable {
    ...
    public void validate() throws ValidateException {
      throw new UnsupportedOperationException();
    }
  }
  class Object2 implements Validatable {
    ...
    public void validate() throws ValidateException {
      ...
    }
  }
  </code></pre>
  
  <p>This is the first solution whereby I have a general global interface that something that's validatable implements and I could use <code>validate()</code> to validate, but Object1 doesn't support this so it's kind of defunc, but Object2 does support it and so may many other classes.</p>
  
  <p>Alternatively I could have the following which would leave me without a top level interface.</p>
  
  <pre><code>interface Object1Validatable {
    public void validate(Object1Converse converse) throws ValidateException;
  }
  class Object1 implements Object1Validatable {
    ...
    public void validate(Object1Converse converse) throws ValidateException {
      ...
    }
  }
  interface Object2Validatable {
    public void validate() throws ValidateException;
  }
  class Object2 implements Object2Validatable {
    ...
    public void validate() throws ValidateException {
      ...
    }
  }
  </code></pre>
  
  <p>I think the main problem I have is that I'm kind of stuck on the idea of having a top level interface so that I can at least say X or Y Object is validatable.</p>