<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Java Blog &#187; oops</title>
	<atom:link href="http://javapapers.com/category/oops/feed/" rel="self" type="application/rss+xml" />
	<link>http://javapapers.com</link>
	<description>Blog on core java, servlets, jsp and design patterns.</description>
	<lastBuildDate>Sun, 03 Jun 2012 11:34:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Association, Aggregation, Composition, Abstraction, Generalization, Realization, Dependency</title>
		<link>http://javapapers.com/oops/association-aggregation-composition-abstraction-generalization-realization-dependency/</link>
		<comments>http://javapapers.com/oops/association-aggregation-composition-abstraction-generalization-realization-dependency/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 10:30:16 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[oops]]></category>

		<guid isPermaLink="false">http://javapapers.com/?p=341</guid>
		<description><![CDATA[These terms signify the relationships between classes. These are the building blocks of object oriented programming and very basic stuff. But still for some, these terms look like Latin and Greek. Just wanted to refresh these terms and explain in simpler terms. Association Association is a relationship between two objects. In other words, association defines [...]]]></description>
			<content:encoded><![CDATA[<p>These terms signify the relationships between classes. These are the building blocks of object oriented programming and very basic stuff. But still for some, these terms look like Latin and Greek. Just wanted to refresh these terms and explain in simpler terms.</p>
<h2>Association</h2>
<p>Association is a relationship between two objects. In other words, association defines the multiplicity between objects. You may be aware of one-to-one, one-to-many, many-to-one, many-to-many all these words define an association between objects. Aggregation is a special form of association. Composition is a special form of aggregation.</p>
<p><img class="alignright size-full wp-image-342" title="Association" src="http://javapapers.com/wp-content/uploads/2010/06/association.jpg" alt="" width="174" height="37" /></p>
<p><strong><em>Example:</em> </strong>A Student and a Faculty are having an association.</p>
<h2>
Aggregation</h2>
<p>Aggregation is a special case of association. A directional association between objects. When an object &#8216;has-a&#8217; another object, then you have got an aggregation between them. Direction between them specified which object contains the other object. Aggregation is also called a &#8220;Has-a&#8221; relationship.</p>
<p><img class="size-full wp-image-343   alignleft" title="Aggregation" src="http://javapapers.com/wp-content/uploads/2010/06/aggregation.jpg" alt="" width="176" height="36" /></p>
<h2>
Composition</h2>
<p>Composition is a special case of aggregation. In a more specific manner, a restricted aggregation is called composition. When an object contains the other object, if the contained object cannot exist without the existence of container object, then it is called composition.</p>
<p><img class="alignright size-full wp-image-344" title="Composition" src="http://javapapers.com/wp-content/uploads/2010/06/composition.jpg" alt="" width="178" height="37" /></p>
<p><strong><em>Example:</em> </strong>A class contains students. A student cannot exist without a class. There exists composition between class and students.</p>
<h3>Difference between aggregation and composition</h3>
<p>Composition is more restrictive. When there is a composition between two objects, the composed object cannot exist without the other object. This restriction is not there in aggregation. Though one object can contain the other object, there is no condition that the composed object must exist. The existence of the composed object is entirely optional. In both aggregation and composition, direction is must. The direction specifies, which object contains the other object.</p>
<p><em><strong>Example:</strong> </em>A Library contains students and books. Relationship between library and student is aggregation. Relationship between library and book is composition. A student can exist without a library and therefore it is aggregation. A book cannot exist without a library and therefore its a composition. For easy understanding I am picking this example. Don&#8217;t go deeper into example and justify relationships!</p>
<h2>
Abstraction</h2>
<p>Abstraction is specifying the framework and hiding the implementation level information. Concreteness will be built on top of the abstraction. It gives you a blueprint to follow to while implementing the details. Abstraction reduces the complexity by hiding low level details.</p>
<p><em><strong>Example: </strong></em>A wire frame model of a car.</p>
<h2>
Generalization</h2>
<p>Generalization uses a &#8220;is-a&#8221; relationship from a specialization to the generalization class. Common structure and behaviour are used from the specializtion to the generalized class. At a very broader level you can understand this as inheritance. Why I take the term inheritance is, you can relate this term very well. Generalization is also called a &#8220;Is-a&#8221; relationship.</p>
<p><img class="alignright size-full wp-image-345" title="Generalization" src="http://javapapers.com/wp-content/uploads/2010/06/generalization.jpg" alt="" width="181" height="41" /></p>
<p><em><strong>Example:</strong></em> Consider there exists a class named Person. A student is a person. A faculty is a person. Therefore here the relationship between student and person, similarly faculty and person is generalization.</p>
<h2>
Realization</h2>
<p>Realization is a relationship between the blueprint class and the object containing its respective implementation level details. This object is said to realize the blueprint class. In other words, you can understand this as the relationship between the interface and the implementing class.</p>
<p><img class="alignright size-full wp-image-346" title="Realization" src="http://javapapers.com/wp-content/uploads/2010/06/realization.jpg" alt="" width="178" height="38" /></p>
<p><em><strong>Example:</strong></em> A particular model of a car &#8216;GTB Fiorano&#8217; that implements the blueprint of a car realizes the abstraction.</p>
<h2>
Dependency</h2>
<p>Change in structure or behaviour of a class affects the other related class, then there is a dependency between those two classes. It need not be the same vice-versa. When one class contains the other class it this happens.</p>
<p><img class="alignright size-full wp-image-347" title="Dependency" src="http://javapapers.com/wp-content/uploads/2010/06/dependency.jpg" alt="" width="176" height="37" /></p>
<p><em><strong>Example: </strong></em>Relationship between shape and circle is dependency.</p>
]]></content:encoded>
			<wfw:commentRss>http://javapapers.com/oops/association-aggregation-composition-abstraction-generalization-realization-dependency/feed/</wfw:commentRss>
		<slash:comments>311</slash:comments>
		</item>
	</channel>
</rss>

