<?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>ganshani.com &#187; OOPS</title>
	<atom:link href="http://www.ganshani.com/tag/oops/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ganshani.com</link>
	<description>Puneet Ghanshani - .NET, Silverlight, Sharepoint Articles, Blogs, Poems, Photograph</description>
	<lastBuildDate>Sat, 24 Apr 2010 10:17:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Interface vs Object vs Aspect Oriented Programming</title>
		<link>http://www.ganshani.com/2009/06/30/interface-vs-object-vs-aspect-oriented-programming/</link>
		<comments>http://www.ganshani.com/2009/06/30/interface-vs-object-vs-aspect-oriented-programming/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 12:14:44 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[OOPS]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=333</guid>
		<description><![CDATA[
			
				
			
		
Interface oriented is something like having contract-based approach, means whatsoever be there under the Contract you have to implement all of it. A good example of this is : WCF.
Object oriented is based on
1. abstraction &#8211; which means making things loosely coupled so that in future they can be easily handled without affecting the system.
2. [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2008/04/10/only-numbers-in-textbox/' rel='bookmark' title='Permanent Link: Only Numbers in TextBox'>Only Numbers in TextBox</a></li>
<li><a href='http://www.ganshani.com/2009/02/24/exception-message-box-in-c/' rel='bookmark' title='Permanent Link: Exception Message Box in C#'>Exception Message Box in C#</a></li>
<li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F06%2F30%2Finterface-vs-object-vs-aspect-oriented-programming%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F06%2F30%2Finterface-vs-object-vs-aspect-oriented-programming%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p><strong>Interface oriented</strong> is something like having contract-based approach, means whatsoever be there under the Contract you have to implement all of it. A good example of this is : WCF.</p>
<p><strong>Object oriented</strong> is based on</p>
<p>1. abstraction &#8211; which means making things loosely coupled so that in future they can be easily handled without affecting the system.</p>
<p>2. encapsulation(data hiding) &#8211; categorizing data as per their role i.e private, public, etc.</p>
<p>3. inheritance &#8211; provides the real world genetic mechanism as what&#8217;s there in the parent would be there in the child too(or not).</p>
<p>4. and polymorphism &#8211; means same look and feel but different functional abiltity.</p>
<p><strong>Aspect oriented </strong>programming can be done either on Interface oriented or an Object oriented code. It can not exist alone.  AOP is another method of reducing the redundant code and its impact.  Let&#8217;s see an example:</p>
<p>You have a class ResultGraph in a Stock Application, which has say 5 methods (like MethodA, MethodB, MethodC, MethodD, UpdateGraphics). </p>
<p>Assume that just after a method (say, MethodX) is executed, the stock price changes &#8211; hence the graph needs to be re-rendered. In such case, UpdateGraphics needs to be called.  Which means all 5 functions will call UpdateGraphics.</p>
<p>This appears to be simple since the number of functions is less. In a real time scenario, there are 100&#8217;s of methods and implementing this becomes tough.</p>
<p>AOP enables doing it in an easier manner.  We write something like:-</p>
<p>after() : set() {   <br />
        ResultGraph.UpdateGraphics();<br />
}</p>
<p>pointcut set() : execution(<span style="color: #008000;">*</span> <span style="color: #0000ff;">set*</span>(<span style="color: #ff0000;">*</span>) ) &amp;&amp; this(<span style="color: #ff00ff;">StockClass</span>) &amp;&amp; <span style="color: #ff6600;">within(com.company.*);</span></p>
<p>The first code means, whenever any <span style="text-decoration: underline;">set</span> is called, call ResultGraph.UpdateGraphics()</p>
<p>The second code interprets as,</p>
<p>if a method is named <span style="color: #0000ff;"><span style="text-decoration: underline;">set*:</span>(* means any name might follow after set)</span>, <span style="color: #008000;">regardless of what the method returns (first asterisk)</span> or <span style="color: #ff0000;">what parameters it takes (third asterisk)</span> and <span style="color: #ff00ff;">it is a method of StockClass </span>and <span style="color: #ff6600;">this class is part of the package &#8220;com.company.*&#8221;</span>, then this is a set() pointcut. And our first code says &#8220;after running any method that is a set pointcut, run the following code&#8221;.</p>
<p>I hope now the difference is clear&#8230;</p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2008/04/10/only-numbers-in-textbox/' rel='bookmark' title='Permanent Link: Only Numbers in TextBox'>Only Numbers in TextBox</a></li>
<li><a href='http://www.ganshani.com/2009/02/24/exception-message-box-in-c/' rel='bookmark' title='Permanent Link: Exception Message Box in C#'>Exception Message Box in C#</a></li>
<li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2009/06/30/interface-vs-object-vs-aspect-oriented-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
