<?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>My Mind Leaks &#187; Articles on Computer Science</title>
	<atom:link href="http://www.mymindleaks.com/blog/topic/articles/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mymindleaks.com/blog</link>
	<description>Software, Programming, Architecture &#38; More</description>
	<lastBuildDate>Sun, 11 Jul 2010 05:06:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Tamil dictionary for the Computer Words</title>
		<link>http://www.mymindleaks.com/blog/archives/tamil-dictionary-computer-words.html</link>
		<comments>http://www.mymindleaks.com/blog/archives/tamil-dictionary-computer-words.html#comments</comments>
		<pubDate>Sun, 11 Jul 2010 05:06:20 +0000</pubDate>
		<dc:creator>Maheshwaran Subramaniya</dc:creator>
				<category><![CDATA[Articles on Computer Science]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.mymindleaks.com/blog/?p=1091</guid>
		<description><![CDATA[I had a tamil dictionary for the Computer Words, just thought of sharing it. This one is prepared by Anna University ( Valarmathi mandram ) in 1998. http://www.mymindleaks.com/wp-content/uploads/2010/07/2421484-Tamil-Technical-Computer-Dictionary.pdf]]></description>
			<content:encoded><![CDATA[<p>I had a tamil dictionary for the Computer Words, just thought of sharing it. This one is prepared by Anna University ( Valarmathi mandram ) in 1998.</p>
<p>http://www.mymindleaks.com/wp-content/uploads/2010/07/2421484-Tamil-Technical-Computer-Dictionary.pdf</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mymindleaks.com/blog/archives/tamil-dictionary-computer-words.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Computing the Services &#8211; Part 2: Characteristics</title>
		<link>http://www.mymindleaks.com/blog/archives/computing-the-services-part-2.html</link>
		<comments>http://www.mymindleaks.com/blog/archives/computing-the-services-part-2.html#comments</comments>
		<pubDate>Wed, 21 Apr 2010 04:11:33 +0000</pubDate>
		<dc:creator>Maheshwaran Subramaniya</dc:creator>
				<category><![CDATA[Articles on Computer Science]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[Computer articles]]></category>
		<category><![CDATA[Service oriented computing]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://www.mymindleaks.com/blog/?p=960</guid>
		<description><![CDATA[Continuing with the Computing the Services Part &#8211; 1, We shall take a look at what each characteristics of services means in the computer world. Defining characteristics is very important aspect in any design. You have to define your design, to work in the way you describe and you expect to it. The characteristics can [...]]]></description>
			<content:encoded><![CDATA[<p style="clear: both;">Continuing with the <a href="http://www.mymindleaks.com/blog/archives/computing-the-services-part-1.html"title="Computing the Services - Part 1"  target="_self">Computing the Services Part &#8211; 1</a>, We shall take a look at what each characteristics of services means in the computer world. Defining characteristics is very important aspect in any design. You have to define your design, to work in the way you describe and you expect to it.</p>
<p style="clear: both;">The characteristics can be further grouped into</p>
<ul style="clear: both;">
<li><strong>Structural</strong> characteristics allow you to make sure that you create services which are well maintainable and re-usable</li>
<li><strong>Operational</strong> characteristics allow you to make sure that the services are quick, fail-proof and responsive.</li>
</ul>
<p style="clear: both;">Our HiTech bank needs a enterprise application to be designed, which obviously requires a lot of design. But our HiTech bank will provide basic services like withdrawal and deposits, via various interfaces like Online, ATM and Card Readers.</p>
<p style="clear: both;">
<p style="clear: both;">
<h3>Granular</h3>
<p style="clear: both;">
<p style="clear: both;">The services defined should be granular in nature. Granularity comes when comes the matter of re-usability and maintainability. More granular is the service, more the re-usability and maintainability.Consider the services which does the deposit &amp; withdraw transaction in our <strong>HiTech Bank</strong>.</p>
<pre style="clear: both;">Bank.deposit( username, password, PIN, deposit-amount, account# ):
   if PIN = BLANK  //Online mode
    Check if the username, password is valid
    Check if the username, password is valid for account#

  if PIN IS NOT BLANK
    Check if PIN is valid for the account
    Open #account
    Add deposit-amount to the existing amount in #account
    Close #account</pre>
<pre style="clear: both;">Bank.withdraw( username, password, PIN, withdraw-amount, account# ):
    if PIN = BLANK:  //Online mode
        Check if the username, password is valid
        Check if the username, password is valid for account#

    if PIN IS NOT BLANK:
        Check if PIN is valid for the account
        Open account#
        Reduce withdraw-amount to the existing amount in #account
        Close account#</pre>
<p style="clear: both;">The above code is not granular and not re-usable. The reason is, lets assume that in future the HiTech bank is adding more user interface devices and has different authentication system, say biometrics. Now, you are ought to change the authentication code in your module. Now, you can feel the pain of modifying it.Also, the transaction are tied with the authentication process, which logically shouldn&#8217;t be. Because, transaction is a separate Unit of Work. If you transaction fails, it&#8217;s not necessary that your authentication also fails.</p>
<p style="clear: both; text-align: center;"><img style="display: block; margin: 0px auto 10px; text-align: center;" src="http://www.mymindleaks.com/wp-content/uploads/2010/04/computing-the-services-class-restructure1-thumb21.png" alt="computing the services class restructure1 thumb21 Computing the Services   Part 2: Characteristics" width="600" height="162" title="Computing the Services   Part 2: Characteristics" />Fig 1. Decomposing the methods to create more granular methods.</p>
<pre style="clear: both;">Bank.authenticate( username, password, PIN, account#) :
    if PIN = BLANK :  //Online mode
        Check if the username, password is valid
        Check if the username, password is valid for account#
      if PIN IS NOT BLANK :
        Check if PIN is valid for the account

Bank.deposit( deposit-amount, account# ):
    Open account#
    Add deposit-amount to the existing amount in #account
    Close account#

Bank.withdraw(  withdraw-amount, account# ):
    Open account#
    Reduce withdraw-amount to the existing amount in #account
    Close account#

Bank.doTransaction( transaction, account, amount, username, password, PIN ):
    Bank.authenticate( username , password, PIN)
    if transaction = Deposit
        Bank.deposit( amount, account# )
    if transaction = Withdraw
        Bank.withdraw( amount, account# )</pre>
<p style="clear: both;">This is the how you make granular services. The advantages of this is you have good maintainability, easy code modification and more re-usability. In future, you change the authentication code to authenticate with another device / interface, no matter what you change , your change is evenly applied across the service.</p>
<p style="clear: both;">
<p style="clear: both;">
<h3>Interface</h3>
<p style="clear: both;">
<p style="clear: both;">An Interface will enable a device or program enabling a program to communicate with another program. In UNIX, one of the cool interface is the “|” pipe symbol. You can combine more than one UNIX command via the “|” ( pipe ). Pipe acts as an interface between two programs.</p>
<blockquote style="clear: both;"><p>cat *.java | grep “String.to”</p></blockquote>
<p style="clear: both;">It is one of the most important characteristics to define. When a service is defined, make sure that it has proper interface to communicate to the business services. In our bank ( HiTech Bank) banking situation, you need services to authenticate the user / customer before accessing the account. You should at least define these service, which in turn does the appropriate authentication.</p>
<table border="0" cellspacing="2" cellpadding="2" width="100%">
<tbody>
<tr>
<td align="center" valign="top"><strong>Human Interface </strong></td>
<td align="center" valign="top"><strong>Services </strong></td>
<td align="center" valign="top"><strong>Interfaces </strong></td>
<td align="center" valign="top"><strong>Contract between Service &amp; Interface Matches? </strong></td>
</tr>
<tr>
<td valign="top">ATM Machine / Card Reader</td>
<td valign="top">Bank.authenticate ( PIN , account# )</td>
<td valign="top">BankInterface.authenticate ( PIN, Name )</td>
<td valign="top">The contract doesn&#8217;t match</td>
</tr>
<tr>
<td valign="top">Online / Mobile app</td>
<td valign="top">Bank.authenticate ( username, password, account# )</td>
<td valign="top">BankInterface.authenticate( username,password, account#)</td>
<td valign="top">Contract matches</td>
</tr>
</tbody>
</table>
<p style="clear: both;">If the HiTech Bank haven&#8217;t defined a proper interface to read the card but just to type in the PIN, the customers will not be able to use the ATM machines / Card readers even if the service to authenticate is available.</p>
<p style="clear: both; text-align: center;"><img style="display: block; margin: 0px auto 10px; text-align: center;" src="http://www.mymindleaks.com/wp-content/uploads/2010/04/computing-the-services-class-bank-interaction1-thumb12.png" alt="computing the services class bank interaction1 thumb12 Computing the Services   Part 2: Characteristics" width="600" height="236" title="Computing the Services   Part 2: Characteristics" />Fig 2. Bank implementing Bank Interface and other User Interfaces using the bank interface</p>
<p style="text-align: left; webkit-background-clip: initial; webkit-background-origin: initial;">
<p style="text-align: left; webkit-background-clip: initial; webkit-background-origin: initial;">We shall continue with the remaining characteristics in the next post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mymindleaks.com/blog/archives/computing-the-services-part-2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Computing the Services &#8211; Part 1: Introduction</title>
		<link>http://www.mymindleaks.com/blog/archives/computing-the-services-part-1.html</link>
		<comments>http://www.mymindleaks.com/blog/archives/computing-the-services-part-1.html#comments</comments>
		<pubDate>Wed, 31 Mar 2010 06:28:15 +0000</pubDate>
		<dc:creator>Maheshwaran Subramaniya</dc:creator>
				<category><![CDATA[Articles on Computer Science]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[Computer articles]]></category>
		<category><![CDATA[Service oriented computing]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://www.mymindleaks.com/blog/archives/computing-the-services-part-1.html</guid>
		<description><![CDATA[In my team we were talking about services and then the web services, and when I was talking to a friend of mine about the services stuff, he posted a blank question. &#8220;What is a service? and how different is that from a method”. His question is correct, I feel that most of the people [...]]]></description>
			<content:encoded><![CDATA[<p style="clear: both;">In my team we were talking about services and then the web services, and when I was talking to a friend of mine about the services stuff, he posted a blank question. &#8220;What is a service? and how different is that from a method”. His question is correct, I feel that most of the people who design services in this complex computing world are not still clear what is a service and not sure of how different is a programming language methods from the service and what it is intent to do?</p>
<p style="clear: both;">
<h3>What is a service?</h3>
<p style="clear: both;">
<p style="clear: both;">
<div><img style="text-align: center; display: block; margin: 0 auto 10px;" src="http://www.mymindleaks.com/wp-content/uploads/2010/03/interaction-client-service.png" alt="interaction client service Computing the Services   Part 1: Introduction" width="451" height="295" title="Computing the Services   Part 1: Introduction" /> Lets start exploring the service. Let me take you to the understanding of what does a service means in the real world and how is that transformed into the computing world. Consider a simple banking situation, where the customer is willing to get some service to fulfil his / her needs. interaction between a customer and the service provider A person needs to deposit some money into the account of the person. Hence , deposit is a service provided by the bank to make customer safe guard the money into the bank’s vault. Similarly, withdrawal, money transfers etc., are some of the service provided by a service provider i.e bank.</div>
<p style="clear: both;">
<blockquote style="clear: both;"><p>In layman&#8217;s term , A service is &#8220;an act of assistance&#8221;.</p></blockquote>
<p style="clear: both;">
<p style="clear: both;">But some service oriented company, does exactly same job as this.</p>
<p style="clear: both;">
<p style="clear: both; text-align: center;"><img style="display: inline;" src="http://www.mymindleaks.com/wp-content/uploads/2010/03/dealer.jpg" border="1" alt="dealer Computing the Services   Part 1: Introduction" width="166" height="166" align="middle" title="Computing the Services   Part 1: Introduction" /><br style="clear: both;" /><br style="clear: both;" /><a href="http://www.dealerrefresh.com/5-steps-to-better-customer-service/" rel="nofollow" >source: dealer refresh</a></p>
<p style="clear: both;">
<p style="clear: both;">So, you place computers in the place of humans. But still, how do you make sure that the computers perform the same task as of humans ( of-course, not the one like above ) and deliver the expected service as good as a human ( is it?? ). Hence this will lead to define some of the characteristics of good service.</p>
<p style="clear: both;">
<p style="clear: both;">
<h3>Characteristics of a good service.</h3>
<p style="clear: both;">
<p style="clear: both;">This table give you an complete idea on how a delivered service should be. Just gathering together.</p>
<p style="clear: both;">
<table border="1" cellspacing="0" cellpadding="5" width="100%" bordercolor="#000000">
<tbody>
<tr>
<td width="62%" valign="top" bgcolor="#E6E9E9">
<p style="clear: both; text-align: center;"><strong>What do the customer expect</strong></p>
</td>
<td width="38%" valign="top" bgcolor="#E6E9E9">
<p style="clear: both; text-align: center;"><strong>What does it mean in the computer world</strong></p>
</td>
</tr>
<tr>
<td width="62%" valign="top">Provide a well defined mode / way to receive the data to start the service</td>
<td width="38%" valign="top">Interface</td>
</tr>
<tr>
<td width="62%" valign="top" bgcolor="#EBEBEB">Information collected to process the request should be minimal</td>
<td width="38%" valign="top" bgcolor="#EBEBEB">Granular</td>
</tr>
<tr>
<td width="62%" valign="top">Ability to process information without asking too much questions</td>
<td width="38%" valign="top">Mostly stateful &amp; sometimes stateless</td>
</tr>
<tr>
<td width="62%" valign="top" bgcolor="#EBEBEB">Ability to finish the process as quick as possible and respond back to customer</td>
<td width="38%" valign="top" bgcolor="#EBEBEB">Speed</td>
</tr>
<tr>
<td width="62%" valign="top">Should finish the requested transaction flawless</td>
<td width="38%" valign="top">Correct</td>
</tr>
<tr>
<td width="62%" valign="top" bgcolor="#EBEBEB">Should finish the requested transaction without any interruption</td>
<td width="38%" valign="top" bgcolor="#EBEBEB">Robust</td>
</tr>
<tr>
<td width="62%" valign="top">Should finish the transaction successfully and completely</td>
<td width="38%" valign="top">Complete</td>
</tr>
</tbody>
</table>
<p style="clear: both;">
<p style="clear: both;">I will detail out the each of the characteristics in the next article.</p>
<p style="clear: both;">[ Updated: Updated the description of the “State” of the service ]</p>
<p><br class="final-break" style="clear: both;" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mymindleaks.com/blog/archives/computing-the-services-part-1.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Does pretty links &amp; SEO URL really sensible for search engines?</title>
		<link>http://www.mymindleaks.com/blog/archives/does-pretty-links-seo-url-really-sensible-for-search-engines.html</link>
		<comments>http://www.mymindleaks.com/blog/archives/does-pretty-links-seo-url-really-sensible-for-search-engines.html#comments</comments>
		<pubDate>Fri, 08 Jan 2010 18:19:24 +0000</pubDate>
		<dc:creator>Maheshwaran Subramaniya</dc:creator>
				<category><![CDATA[Articles on Computer Science]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[page rank]]></category>
		<category><![CDATA[search engines]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[seo optimization]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://www.mymindleaks.com/blog/?p=897</guid>
		<description><![CDATA[Do a blog author should really worry about the pretty URLs and spent a lot of time in thinking about the URL, decorating them, and building SEO on them? So, how does a search engine takes it's chance on working with the URL while working out the page rank stuff? ]]></description>
			<content:encoded><![CDATA[<p>After done with the moving to a hosting provider, next I was trying to overhaul my blog with the link structure. Puzzled on where to start from. People enter into my blog via URL. Hence decided to tweak the URL.  So, it&#8217;s time to decide upon what link structure I should chose. And before that, is this link structure is really a necessary stuff to tweak up? If you ask with a SEO expert, he/she would pour a rain of tips, problems if you don&#8217;t make the links looks SEO optimized. And mostly Google oriented optimizations. But sometimes, I used to think, Is Google going to rely-upon this tiny URL part in the entire web indexing operation. If you look into any of the blog which has a content juice, you wont find a proper URL structure. I will give you a lots of example.</p>
<h3>Before that what is an URL, and why everyone in this world is so much bothered about it?</h3>
<p>People who use web knows very well about URL. And there are quite lots of topic around how to build a better URL. CMS software provides plug-ins, tools to build good URLs.  So, why is that these folks worried much about building a great looking pretty URL? I don&#8217;t want to talk much on what is <a href="http://en.wikipedia.org/wiki/Uniform_Resource_Locator" rel="nofollow" >URL</a>, Wikip can give you enough information about URL. I will just quickly discuss about the part of URL and which one I&#8217;m speaking about. Consider this URL,</p>
<blockquote><p><a href="http://www.mymindleaks.com/blog/archives/object-oriented-programming-">http://www.mymindleaks.com/blog/archives/object-oriented-programming-</a>–-encapsulation-is-not-just-hiding-data.html</p></blockquote>
<p>An URL has the following parts.</p>
<ol>
<li><em>http</em> -&gt; <a href="http://en.wikipedia.org/wiki/Protocol_%28computing%29" rel="nofollow" >protocol</a></li>
<li><em>www</em> -&gt; <a href="http://en.wikipedia.org/wiki/Subdomain" rel="nofollow" >subdomain</a></li>
<li><em>mymindleaks</em> -&gt; <a href="http://en.wikipedia.org/wiki/Domain_name" rel="nofollow" >domain name</a></li>
<li><em>com</em> -&gt;  <a href="http://en.wikipedia.org/wiki/Top-level_domain" rel="nofollow" >Top Level Domain ( TLD )</a></li>
<li><em>blog/archives/object&#8230;data.html</em> -&gt; page / filename</li>
<li><em>.html</em> -&gt; <a href="http://filext.com/" rel="nofollow" >file extension</a></li>
<li><em>And if you find anything after &#8220;?&#8221;</em> -&gt; CGI params</li>
</ol>
<p>Check out here to  what I&#8217;m talking about in a <a href="http://www.seomoz.org/blog/seo-cheat-sheet-anatomy-of-a-url" rel="nofollow" >visual stuff</a>.</p>
<p>Now, in this post, I&#8217;m talking about the 5th part, &#8220;<em>/blog/archives/object-oriented&#8230;data.html</em>&#8220;. which is the page / filename part of the URL.</p>
<h3>A quick research on URLs and Page rank.</h3>
<p>Can anyone fool Google by writing an url as &#8220;10-tips-to-make-you-rich&#8221; and the entire content of the URL teaches you &#8220;10-tips-to-spend-a-lot&#8221;??? Will the Google still fetch the URL &#8220;10-tips-to-make-you-rich&#8221; when someone tries to search for &#8220;how to become rich&#8221; ?</p>
<p>When I tried checking the PageRank of the few famous blog over internet, via <a href="http://www.prchecker.info/check_page_rank.php" rel="nofollow" >http://www.prchecker.info/check_page_rank.php</a> , I could infer the following.</p>
<table style="font-size: 13px;" border="1" cellspacing="2" cellpadding="2" width="100%">
<tbody>
<tr>
<td style="font-family: arial, sans-serif;" align="center" valign="top"><strong>Site<br />
</strong></td>
<td style="font-family: arial, sans-serif;" align="center" valign="top"><strong>Page Rank<br />
</strong></td>
</tr>
<tr>
<td style="font-family: arial, sans-serif;" valign="top"><a href="http://norvig.com" rel="nofollow" >Peter Norvig</a> - <a href="http://norvig.com" rel="nofollow" >http://norvig.com</a></td>
<td style="font-family: arial, sans-serif;" valign="top">6 / 10</td>
</tr>
<tr>
<td style="font-family: arial, sans-serif;" valign="top"><a href="http://xahlee.org" rel="nofollow" >Xahlee</a> - <a href="http://xahlee.org" rel="nofollow" >http://xahlee.org</a></td>
<td style="font-family: arial, sans-serif;" valign="top">5 / 10</td>
</tr>
<tr>
<td style="font-family: arial, sans-serif;" valign="top"><a href="http://johnchow.com" rel="nofollow" >John Chow</a> - <a href="http://johnchow.com" rel="nofollow" >http://johnchow.com</a></td>
<td style="font-family: arial, sans-serif;" valign="top">5 / 10</td>
</tr>
<tr>
<td style="font-family: arial, sans-serif;" valign="top"><a href="http://problogger.net" rel="nofollow" >Problogger</a> - <a href="http://problogger.net" rel="nofollow" >http://problogger.net</a></td>
<td style="font-family: arial, sans-serif;" valign="top">5 / 10</td>
</tr>
</tbody>
</table>
<p>This results makes you wonder? Even me. Professional bloggers like Darren Rowse&#8217;s Problogger, John Chow, who have million of hits, lots of articles on tweaks, blogging, money making have a less PR rating compared to the simple-plain-old but content ful Norvig or Xahlee&#8217;s blog. If you look at Norvig&#8217;s blog, you might find URL which aren&#8217;t descriptive like [ <a href="http://norvig.com/paip.html" rel="nofollow" >http://norvig.com/paip.html</a> -&gt; Paradigms of AI Programming]. The Xahlee&#8217;s blog have unicode chars in his blog and his blog topic is bit diversified ( computers, math, and little bit of decent porn, yeah ).  Google isn&#8217;t that dumb folks.</p>
<p>Even my blog has pretty URLs, and I&#8217;ve spent relatively quite amount of time in thinking about URL for my blog., but that&#8217;s all purely to give the reader a better idea of what a post is all about. To me, a URL is just a tiny part that makes the user understand what is all the content is about without reading through the content. Relying on this probably might give you a fraction of what SEO&#8217;s call, <em><strong>the page rank juice</strong></em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mymindleaks.com/blog/archives/does-pretty-links-seo-url-really-sensible-for-search-engines.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Object Oriented Programming – Encapsulation is not just hiding data!</title>
		<link>http://www.mymindleaks.com/blog/archives/object-oriented-programming-%e2%80%93-encapsulation-is-not-just-hiding-data.html</link>
		<comments>http://www.mymindleaks.com/blog/archives/object-oriented-programming-%e2%80%93-encapsulation-is-not-just-hiding-data.html#comments</comments>
		<pubDate>Mon, 09 Jun 2008 09:15:43 +0000</pubDate>
		<dc:creator>Maheshwaran Subramaniya</dc:creator>
				<category><![CDATA[Articles on Computer Science]]></category>
		<category><![CDATA[Encapsulation]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[object oriented programming]]></category>
		<category><![CDATA[Resources]]></category>

		<guid isPermaLink="false">http://mymindleaks.com/?p=655</guid>
		<description><![CDATA[Continuing the Object Oriented Programming series, after writing about Abstraction, it&#8217;s time to educate about Encapsulation. Let&#8217;s first look at what is generally believed as Encapsulation? Ask your teacher, &#8220;What is Encapsulation?&#8221; You teacher would promptly say &#8220;Hiding data&#8220;. Try googling, you find just 10% of the sites will be giving you right information about [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing the <a href="http://mymindleaks.com/tag/object-oriented-programming/" rel="nofollow" >Object Oriented Programming</a> series, after writing about <a href="http://mymindleaks.com/programming/object-oriented-programming-abstraction/" rel="nofollow" >Abstraction</a>, it&#8217;s time to educate about Encapsulation.</p>
<p>Let&#8217;s first look at what is generally believed as Encapsulation? Ask your teacher, &#8220;What is Encapsulation?&#8221; You teacher would promptly say &#8220;<strong>Hiding data</strong>&#8220;. Try googling, you find just 10% of the sites will be giving you right information about Encapsulation where most of them tends to miss out the important glitch. When one of my friends was speaking about Encapsulation, he was right in quoting the proper definition i.e. &#8220;Hiding Information&#8221;, but his understanding was not correct. If you are one of them who doesn&#8217;t understand about Encapsulation, then this article is for you.<span id="more-655"></span></p>
<p>So, what exactly the encapsulation means bro? Ok. Let we have some coffee, and we continue discuss about Encapsulation.</p>
<p style="text-align: center"><img src="http://mymindleaks.com/wp-content/uploads/2008/06/060908-0915-objectorien12.jpg" alt="060908 0915 objectorien12 Object Oriented Programming – Encapsulation is not just hiding data!"  title="Object Oriented Programming – Encapsulation is not just hiding data!" /></p>
<p>Cool, the coffee vending machine has given tasty brewed coffees. Nice coffee! Back to our discussion, here is a simple question I&#8217;d like to ask you. Why don&#8217;t you give a thought on how did this coffee vending machine worked?</p>
<p>You dropped in the coin, and the coffee came out of the machine in a beautiful coffee cup. So, why didn&#8217;t you see how the where the coffee beans, how it is prepared? You really don&#8217;t know (unless you are the one who designed the machine <img src='http://www.mymindleaks.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' title="Object Oriented Programming – Encapsulation is not just hiding data!" /> ) how things are made inside the machine, but finally you get a coffee!! Yeah don&#8217;t you see a sense of Encapsulation? So, here what is actually hidden? The Coffee beans? <strong><em>No, the way how the coffee prepared is hidden</em></strong>.</p>
<p><strong>So, Encapsulation is hiding of process; hence you hide the data. Not the vice versa.<br />
</strong></p>
<p>From the definition, <strong>Encapsulation is &#8220;Information Hiding&#8221;</strong>, the information is how <strong>something is happening</strong> inside an object? It&#8217;s just a mere <strong>data hiding concept </strong>(though it includes data hiding).</p>
<p>So, when you model this coffee vending machine, you don&#8217;t want to show out the way how a coffee is made. Isn&#8217;t it? So, you don&#8217;t want to show where the coffee beans, milk and the sugar are. Right?</p>
<p style="text-align: center"><img src="http://mymindleaks.com/wp-content/uploads/2008/06/060908-0915-objectorien22.png" alt="060908 0915 objectorien22 Object Oriented Programming – Encapsulation is not just hiding data!"  title="Object Oriented Programming – Encapsulation is not just hiding data!" /></p>
<p>So, in the CofeeVendingMachine class, prepareCoffee() is hidden and getCoffee() is made public, so that you will be able to send a request to the machine.</p>
<p>Since you have hidden the process, you don&#8217;t have any need to show how the coffee &amp; milk are mixed and how it&#8217;s been brewed. If you need a stylish design, even you can show that.</p>
<p style="text-align: center"><img src="http://mymindleaks.com/wp-content/uploads/2008/06/060908-0915-objectorien32.png" alt="060908 0915 objectorien32 Object Oriented Programming – Encapsulation is not just hiding data!"  title="Object Oriented Programming – Encapsulation is not just hiding data!" /></p>
<p>The Coffee Vending Machine encapsulates the internal process and the ingredients (data) used in the process.</p>
<p>Object Oriented Languages provides encapsulation via modifiers such as &#8220;private&#8221;, &#8220;protected&#8221;. Sometimes, volatile and transient also acts as encapsulating modifiers, but they are language specifics.</p>
<p>Encapsulation doesn&#8217;t stop just with OOP languages. The concept extends itself to the latest technology such as Webservices, Service Oriented Architecture. If you closely watch, any real world object has encapsulation in it, which the Object Oriented Programming tries to model.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mymindleaks.com/blog/archives/object-oriented-programming-%e2%80%93-encapsulation-is-not-just-hiding-data.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Object Oriented Programming &#8211; Abstraction</title>
		<link>http://www.mymindleaks.com/blog/archives/object-oriented-programming-abstraction.html</link>
		<comments>http://www.mymindleaks.com/blog/archives/object-oriented-programming-abstraction.html#comments</comments>
		<pubDate>Tue, 27 May 2008 01:15:03 +0000</pubDate>
		<dc:creator>Maheshwaran Subramaniya</dc:creator>
				<category><![CDATA[Articles on Computer Science]]></category>
		<category><![CDATA[Abstraction]]></category>
		<category><![CDATA[object oriented programming]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://mymindleaks.com/?p=651</guid>
		<description><![CDATA[Abstraction is a concept which facilitates to extract out the essential information of an object. In OOP ( Object Oriented Programming ) , Abstraction facilitates the easy conceptualization of real world objects into the software program. Abstraction lies everywhere! What ever you see, do and live are all full of abstraction. In mathematics, multiplication is [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-left: 1pt">Abstraction is a concept which facilitates to extract out the essential information of an object.</p>
<p style="margin-left: 1pt">In OOP ( Object Oriented Programming ) , Abstraction facilitates the easy conceptualization of real world objects into the software program.</p>
<p style="margin-left: 1pt">Abstraction lies everywhere! What ever you see, do and live are all full of abstraction.</p>
<p style="margin-left: 1pt">In mathematics, <strong>multiplication </strong>is a kind of abstraction. The symbol &#8220;<span style="font-size:16pt"><strong>x</strong></span>&#8221; is an abstract symbol that can do multiplication of any two elements.<span style="font-size:12pt"><br />
</span></p>
<blockquote><p>2 <strong>x</strong> 3 = 6</p></blockquote>
<blockquote><p>3.5 <span style="font-size:16pt"><strong>x</strong></span> 3.7 = 12.95</p></blockquote>
<blockquote><p>(a + b) <span style="font-size:16pt"><strong>x</strong></span> ( a &#8211; b) = a^2 &#8211; b^2</p></blockquote>
<p style="margin-left: 1pt"><span id="more-651"></span></p>
<p style="margin-left: 1pt">In Art, Abstract Art is a kind of art, which depicts the distilled form of the world.</p>
<p style="margin-left: 1pt"><img src="http://mymindleaks.com/wp-content/uploads/2008/05/051808-0406-abstraction1.png" alt="051808 0406 abstraction1 Object Oriented Programming   Abstraction"  title="Object Oriented Programming   Abstraction" /><span style="font-size: 12pt; font-family: Times New Roman;"><br />
</span>
</p>
<p style="margin-left: 1pt">
<p style="margin-left: 1pt"><em>Courtesy: <a href="http://www.flickr.com/photos/regiaart/" rel="nofollow" >RegiaArt</a></em></p>
<p><strong>So, what exactly an Abstraction is?</strong></p>
<p>Abstraction facilitates the easy conceptualization of real world objects, by eliminating the unnecessary details of the object. Unnecessary details? Yes, all the similar objects when you generalize, you will drop the uncommon details about the objects.</p>
<p>E.g., when you model a generic prototype for CRT Television &amp; a Plasma Television, you look for details like Type of screen, Height, Width, thickness etc.; these are necessary details for a Television. But a Television object doesn&#8217;t need to have details of what kind of Electron it will bean to power the CRT, what kind of liquid plasmas it will use to power the Plasma TVs. These kinds of details are unnecessary details.</p>
<p>Let&#8217;s take mobile phone as the real world example. Look at the below mobile phones.</p>
<p style="margin-left: 1pt">
<p style="text-align: center; margin-left: 1pt"><img src="http://mymindleaks.com/wp-content/uploads/2008/05/051808-0406-abstraction2.png" alt="051808 0406 abstraction2 Object Oriented Programming   Abstraction"  title="Object Oriented Programming   Abstraction" /><span style="font-size: 12pt; font-family: Times New Roman;"><br />
</span>
</p>
<p style="margin-left: 1pt">What do you feel about them?</p>
<ul style="margin-left: 37pt">
<li>Firstly, everything is Nokia Mobiles</li>
<li>You could see Slide, Flip and Bar models</li>
<li>You could see Music, Business &amp; 3G Mobiles</li>
<li>You could see QWERTY , Basic and No keypads</li>
<li>You could extra music player button on music edition.</li>
<li>The Color, Size, Weight, Look etc&#8230;</li>
<li>And even more…</li>
</ul>
<p style="margin-left: 1pt">So, for better understanding I organize the mobile phones in the below format.</p>
<p style="text-align: center; margin-left: 1pt"><img src="http://mymindleaks.com/wp-content/uploads/2008/05/051808-0406-abstraction3.png" alt="051808 0406 abstraction3 Object Oriented Programming   Abstraction"  title="Object Oriented Programming   Abstraction" /><span style="font-size: 12pt; font-family: Times New Roman;"><br />
</span>
</p>
<p style="margin-left: 1pt">Basically, all the mobiles belong to Nokia.</p>
<p style="margin-left: 1pt">Still need a better classification, I drill down to its features and conceptualize the mobiles in more general way. So, you could categorize the mobiles as</p>
<ul style="margin-left: 37pt">
<li>Music</li>
<li>Business</li>
<li>Gaming</li>
<li>Normal</li>
<li>3G</li>
</ul>
<p style="margin-left: 1pt">As a layman user, you will feel its weight, color, style. As a music lover, you will check for the memory, type of media files it supports, and type of communication between devices (Bluetooth, Wi-Fi etc). As a business person, you will check for the memory, type of business application etc.</p>
<p style="text-align: center; margin-left: 1pt"><img src="http://mymindleaks.com/wp-content/uploads/2008/05/051808-0406-abstraction4.png" alt="051808 0406 abstraction4 Object Oriented Programming   Abstraction"  title="Object Oriented Programming   Abstraction" /><span style="font-size: 12pt; font-family: Times New Roman;"><br />
</span>
</p>
<p style="margin-left: 1pt">Now, you have got the details of the each and every mobile. It&#8217;s time to extract the most essential details of these mobile categories. Here I use an Abstraction filter, which abstracts out the essential details. So, essential details, here I mean is the most common properties of the mobiles.</p>
<p style="margin-left: 1pt">So, now the conceptualization of mobile has still got finer. Now you can still go deep and get a finer concept to model a generic / abstract mobile, which can be turned into a beautiful mobile of your kind.</p>
<p style="margin-left: 1pt">
<p style="text-align: center; margin-left: 1pt"><img src="http://mymindleaks.com/wp-content/uploads/2008/05/051808-0406-abstraction5.png" alt="051808 0406 abstraction5 Object Oriented Programming   Abstraction"  title="Object Oriented Programming   Abstraction" /><span style="font-size: 12pt; font-family: Times New Roman;"><br />
</span>
</p>
<p style="margin-left: 1pt">Now, you have extracted out the necessary details for each category of mobile. You still fine grain it to get a mobile phone&#8217;s basic property with the Abstraction filter.</p>
<p style="text-align: center; margin-left: 1pt"><img src="http://mymindleaks.com/wp-content/uploads/2008/05/051808-0406-abstraction6.png" alt="051808 0406 abstraction6 Object Oriented Programming   Abstraction"  title="Object Oriented Programming   Abstraction" /><span style="font-size: 12pt; font-family: Times New Roman;"><br />
</span>
</p>
<p style="margin-left: 1pt">Now, here comes your basic design of the Nokia mobile phone. You have learnt how you will abstract properties from the real world objects. Now the question is how you do it in the programming language. In the Object oriented principles, abstraction is achieved via Inheritance (a widely used design pattern)</p>
<p style="margin-left: 1pt">The class diagram for the Nokia mobile using Inheritance look like below</p>
<p style="text-align: center; background: white; margin-left: 1pt"><img src="http://mymindleaks.com/wp-content/uploads/2008/05/051808-0406-abstraction7.png" alt="051808 0406 abstraction7 Object Oriented Programming   Abstraction"  title="Object Oriented Programming   Abstraction" /><span style="font-size: 12pt; font-family: Times New Roman;"><br />
</span>
</p>
<p style="margin-left: 1pt">You would have missed to understand the abstraction in the computer science. Here are few places where you could see how the abstraction works</p>
<ul style="margin-left: 37pt">
<li>Network Layers – OSI Model</li>
<li>Database Architecture – Data Abstraction ( Physical, Logical , View )</li>
<li>Polymorphism – Abstraction of Actions / Methods</li>
<li>Templates in C++ or Java – Abstraction of Common Objects</li>
<li>Data Structures – Abstract way to store &amp; retrieve the data</li>
<li>Many more…</li>
</ul>
<p>One important thing you need to remember is &#8216;Abstract objects&#8217; never exists in real world. It is just the concept that we build to understand the working of real world objects.</p>
<p>E.g., There is nothing is called a Television, you have CRT Television (this is known commonly as TV), Plasma TV or LCD TV.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mymindleaks.com/blog/archives/object-oriented-programming-abstraction.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Big Code, Good Code!</title>
		<link>http://www.mymindleaks.com/blog/archives/big-code-good-code.html</link>
		<comments>http://www.mymindleaks.com/blog/archives/big-code-good-code.html#comments</comments>
		<pubDate>Fri, 09 May 2008 01:32:57 +0000</pubDate>
		<dc:creator>Maheshwaran Subramaniya</dc:creator>
				<category><![CDATA[Articles on Computer Science]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[guide]]></category>

		<guid isPermaLink="false">http://mymindleaks.com/?p=622</guid>
		<description><![CDATA[Coding is an art! Anyone can draw, but only those who draw with the elegant have their paintings valued. Similarly any programmer can code, but a Good Program is an artistic job. I see lot of people do code, but only few actually write Good code. This means they have understood the elegance of the [...]]]></description>
			<content:encoded><![CDATA[<p><em>Coding is an art</em>! Anyone can draw, but only those who draw with the elegant have their paintings valued. Similarly any programmer can code, but a Good Program is an artistic job. I see lot of people do code, but only few actually write Good code. This means they have understood the elegance of the language and knows how to use it.</p>
<h3>Big Code &#8211; Good Code</h3>
<p>Big Code, a Good Code? Sounds awkward? A Good code I mean here is a code which runs quicker than other solutions for the same problem.</p>
<blockquote><p><strong>if T(Sol1) &lt; T(Sol2) Then, Solution 1 is a Good code</strong>., Where T is Time function , measures Time Taken</p></blockquote>
<p><em>( though there are various other constraints involved, for time being let not discuss them )</em></p>
<p>Hardcore programmers are always tries to write short programs. They couple few lines of code into one and show that they have done a great coding.  But, things are not always the way it looks. <strong><em>Short is sweet, but not always !</em></strong></p>
<p><span id="more-622"></span><br />
Look into this code, 3 solutions for one simple problem.</p>
<p><em><strong>Problem</strong>: Find the greatest of two numbers a, b</em></p>
<p style="text-align: center"><a href="http://mymindleaks.com/wp-content/uploads/2008/05/code-table1.png" rel="nofollow" ><img src="http://mymindleaks.com/wp-content/uploads/2008/05/code-table-thumb.png" border="0" alt="code table thumb Big Code, Good Code!" width="640" height="158" title="Big Code, Good Code!" /></a></p>
<h3>Million Dollar Question</h3>
<p>Which code runs faster? If you have chosen the A&#8217;s code as faster. You have correctly made a <strong>wrong decision</strong>.</p>
<p>The fastest program is the B&#8217;s program. So, 3 lines of code, still fastest code? Ok.</p>
<p>In the A&#8217;s code,  consider if a &lt; b, two operations should be performed.</p>
<ul>
<li>Compare &#8216;a&#8217; , &#8216;b&#8217;</li>
<li>Branch to Else if &#8216;a&#8217; &lt; &#8216;b&#8217;</li>
<li>Return the expression &#8216;b&#8217;</li>
</ul>
<p>But in B&#8217;s solution, we have already assigned a value to &#8216;x&#8217;. Only job is to compare and Assign. <strong>So the second operation is saved.</strong></p>
<p>In such a small code, you won&#8217;t find a big difference. But think of a macro system with MLOC ( Million Lines of Code ).</p>
<p>I will explain you by solving a bit complex problem, come on join me.</p>
<p><strong>Problem</strong>: <em>Given number &#8216;N&#8217; , split into &#8216;k&#8217; integers, such that N = k1 + k2 + k3 +&#8230;kn and k1 * k2 * k3 is maximum</em>.</p>
<p>You can try various solutions. One simple solution is</p>
<p style="text-align: center"><img src="http://mymindleaks.com/wp-content/uploads/2008/05/image-thumb.png" border="0" alt="image thumb Big Code, Good Code!" width="640" height="69" title="Big Code, Good Code!" /></p>
<p>Great code, you would be proud to write one line solution of such great problem. But wait, is your code is faster to run for N &gt; 10^10, K &gt; 10^5?</p>
<p>Consider the optimize solution</p>
<p style="text-align: center"><a href="http://mymindleaks.com/wp-content/uploads/2008/05/image1.png" rel="nofollow" ><img src="http://mymindleaks.com/wp-content/uploads/2008/05/image-thumb1.png" border="0" alt="image thumb1 Big Code, Good Code!" width="640" height="125" title="Big Code, Good Code!" /></a></p>
<p>More optimised</p>
<p style="text-align: center"><a href="http://mymindleaks.com/wp-content/uploads/2008/05/image5.png" rel="nofollow" ><img src="http://mymindleaks.com/wp-content/uploads/2008/05/image-thumb5.png" border="0" alt="image thumb5 Big Code, Good Code!" width="640" height="200" title="Big Code, Good Code!" /></a></p>
<p>The last code works much faster than any other. Try looping it for million times with various values of &#8216;N &amp; k &#8216;. and measure the time it takes to complete the million time execution.</p>
<h3>How to write a speedy code?</h3>
<p>So, this is yet another million dollar question. Take a look at the above three solutions. You will find a resemblance.</p>
<p><strong>Solution &#8211; 1 </strong>is a generalized form of other two. <strong>Solution &#8211; 3 </strong>is more detailed form of Solution &#8211; 1.</p>
<p>So, what is been detailed in the Solution 3. If you look at more closely, you will find that Solution-3 has checks for &#8216;Boundary Conditions&#8217;.</p>
<p>Boundary Conditions are very important scenarios in any Logical System. You prove that system works perfect for boundary conditions, you prove the system to work for any values between it. <strong>Similar to Mathematical Induction</strong>. So, this applies for programming too.</p>
<p>If you are able to identify the boundary conditions, and make the appropriate formula for those conditions, then you will skip unnecessary computations.</p>
<p>We will look what have save the computational cycles.</p>
<p>Lets assume, the Input are N=10, K = 2</p>
<p><strong>Using Solution-1:</strong></p>
<p>residue = 0, mid = 5</p>
<p>maxProduct = Math.pow(5+1,0) * Math.pow( 5 ,(2-0) ) = 25</p>
<p><strong>Operations performed:</strong></p>
<p><em>Note: costs are just for calculation, not exact one</em></p>
<p><a href="http://mymindleaks.com/wp-content/uploads/2008/05/image3.png" rel="nofollow" ><img src="http://mymindleaks.com/wp-content/uploads/2008/05/image-thumb3.png" border="0" alt="image thumb3 Big Code, Good Code!" width="270" height="322" title="Big Code, Good Code!" /></a></p>
<ul>
<li>Math.pow</li>
<li>Addition &#8211; (5+1)</li>
<li>Math.pow</li>
<li>Subtraction &#8211; ( 2-0 )</li>
<li>Multiplication</li>
</ul>
<p>lets assume the cost for each operation is</p>
<p><strong>Using Solution-3:</strong></p>
<p>The code will branch out to the 1st if condition ( residue == 0 )</p>
<p>maxProduct = Math.pow( 5, 2) = 25</p>
<p><strong>Operations performed</strong></p>
<p><a href="http://mymindleaks.com/wp-content/uploads/2008/05/image4.png" rel="nofollow" ><img src="http://mymindleaks.com/wp-content/uploads/2008/05/image-thumb4.png" border="0" alt="image thumb4 Big Code, Good Code!" width="270" height="166" title="Big Code, Good Code!" /></a></p>
<p>So, you have saved more than 55% of the computational cycles by covering up the boundary conditions.</p>
<p><strong>So, Why you need a Speedy code?</strong></p>
<p>Everyone in life loves speed. Speed bike, Speed cars ( that&#8217;s why you would love F1 ), A speedy 2 GB &#8211; Core 2 Duo Powered Machine.</p>
<p><strong>Because Speed makes you feel Good !! So does a Speedy Code will be a Good code.</strong></p>
<p>But, to achieve something you have to compromise with other factors, like I mentioned earlier.</p>
<p>If you need a 2 GB &#8211; Core 2 Duo Powered Machine, you should not consider the Money factor.</p>
<p>Similarly while you code, there are lot of other factors like</p>
<ul>
<li>Memory Management</li>
<li>Security</li>
<li>Transaction Isolations etc.,</li>
</ul>
<p>This is just a introduction, will start covering up other topics soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mymindleaks.com/blog/archives/big-code-good-code.html/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>
