title: Interfaces, inheritance and Genrics in UML Class Diagram
body: <p>I'm modeling a persistence layer based on DAO pattern and I have some doubts related to the use of Genrics and interfaces inheritance.</p>
  
  <p>I'd start saying that basic CRUD operations are the same for all the persistable entities so I've decided to provide a basic DAO interface using Generics. Then there would be other interfaces that inherit the basic contract plus some other specific methods related to the entity that will be managed by the concrete implementation.</p>
  
  <p>It may sound complicated but it's actually very simple. In Java it would be something like this:</p>
  
  <pre><code>public interface BasicDao&lt;T&gt; {
  
      public T insert(T dataObject);
  
      public T update(T dataObject);
  
      public Boolean delete(T dataObject);
  
      public T getUnique(BigInteger dataObjectId);
  
      public List&lt;T&gt; getAll();
  }
  
  public interface IModulesDao extends IBasicDao&lt;IModule&gt; {
  
      public IModule getModuleByCode(String code);
  }
  </code></pre>
  
  <p>As you can see <code>IModulesDao</code> adds a single method to the basic contract but concrete implementations still have to meet the whole contract, which is the idea of doing all this.</p>
  
  <p>Now I've read <a href="https://stackoverflow.com/q/4786771/1795530">UML Class Diagram and Generics</a> about how to model Generics in UML and also <a href="http://etutorials.org/Programming/UML/Chapter+6.+Class+Diagrams+Advanced+Concepts/Parameterized+Class/" rel="nofollow noreferrer">this example</a>. It is stated that using a buond element is not the same than subtyping and we are not allowed to add anything to the contract. So as far as I understand it, I would have to create intermediate types to finally get my <code>IModulesDao</code> interface. </p>
  
  <p>This sounds conceptually right but I'm not sure if fits in my case since <code>IModulesDao</code> is just an extension or sub-interface of <code>IBasicDao</code> and makes no sense to have an intermediate subtype to inherit from. IMHO it will add just noise to the diagram for no benefit.</p>
  
  <p>This is what I have right now but don't think is entirely correct:</p>
  
  <p><img src="https://i.stack.imgur.com/vWG4K.png" alt="Class diagram"></p>
  
  <p>Could you please lead me in the right direction about how to model this case?</p>