title: understanding UML associations in code
body: <p>This is the understanding I have about Association, Aggregation and composition as of now. </p>
  
  <p>Association</p>
  
  <pre><code>public class Foo { 
      void Baz(Bar bar) {
      } 
  };
  </code></pre>
  
  <p>Aggregation</p>
  
  <pre><code>public class Foo { 
      private Bar bar; 
      Foo(Bar bar) { 
         this.bar = bar; 
      }
  }
  </code></pre>
  
  <p>Composition</p>
  
  <pre><code>public class Foo {
      private Bar bar = new Bar(); 
  }
  </code></pre>
  
  <p>I think there is no point in understanding what the words mean, unless I can't represent it in actual code. The above code was taken from a SO answer (tell me if the above code is wrong). </p>
  
  <p>My questions are the fllowing.</p>
  
  <p>1) Is aggregation and composition important to be shown in a class diagram </p>
  
  <p>2) I used a tool which can convert the java .class files into a class diagram. <a href="http://www.class-visualizer.net/" rel="nofollow">Class Visualizer</a> but i was unable to make this tool show aggregation or composition relationships in the class diagram. Is that a problem with the tool or I have not understood how to use composition and aggregation in code? When I used the above code for association the tool gave me a representation of "dependency" relationship. (a dashed line)</p>