<?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>Mahesh Subramaniya</title>
	<atom:link href="http://www.mymindleaks.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mymindleaks.com/blog</link>
	<description>Software, Programming, Architecture &#38; More</description>
	<lastBuildDate>Fri, 03 Feb 2012 02:58:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>Hello World in Objective C and Compiling with GCC</title>
		<link>http://www.mymindleaks.com/blog/article/hello-world-in-objective-c-and-compiling-with-gcc.html</link>
		<comments>http://www.mymindleaks.com/blog/article/hello-world-in-objective-c-and-compiling-with-gcc.html#comments</comments>
		<pubDate>Wed, 30 Nov 2011 14:41:40 +0000</pubDate>
		<dc:creator>Maheshwaran Subramaniya</dc:creator>
				<category><![CDATA[Objective-C / iOS Programming]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objective-c]]></category>

		<guid isPermaLink="false">http://www.mymindleaks.com/blog/?p=1636</guid>
		<description><![CDATA[Contents Overview Hello World &#8211; Using Object Hello World &#8211; Using Interface Hello World &#8211; Modularized Understanding the program Write the inteface Write the implementation Overview There are a lot of articles in Introduction of Objective-C and explaining basic concepts. But this article attempts to explain the basics of Objective-C without the influence of any [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<h2 id="contents">Contents</h2>
<ul>
<li><a href="#overview">Overview</a>
<ul>
<li><a href="#hello-world-object-version">Hello World &#8211; Using Object</a></li>
<li><a href="#helloworld-with-interfaces">Hello World &#8211; Using Interface</a></li>
<li><a href="#hello-world-modularized">Hello World &#8211; Modularized</a></li>
<li><a href="#understanding-the-program">Understanding the program</a>
<ul>
<li><a href="#write-your-interfaces">Write the inteface</a></li>
<li><a href="#write-your-implementation">Write the implementation</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="overview">Overview</h3>
<p>There are a lot of articles in Introduction of Objective-C and explaining basic concepts. But this article attempts to explain the basics of Objective-C without the influence of any framework  i.e without the influence of the <strong>GNUStep</strong> or <strong>NextStep</strong> or<strong> Cocoa framekwork</strong>. So, I  have used the primitive types and the basic object from Objective-C base framework and complied with <code>GCC</code> compiler. Also I did not want to use <strong>Apple&#8217;s XCode</strong> editor to write an objective-c program, instead I used <strong>Emacs</strong> and  <strong>Terminal</strong> to write, build and run the code. After all it s again a C-programming language. This makes the language learning more fun. So this article goes little in-depth to explain the semantics of each element in the Objective-C. If you need a jump start in learning the language you can refer to the <a href="http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml">Google&#8217;s style guide</a> to get an overview about the language. Also try reading the <a href="http://www.faqs.org/faqs/computer-lang/Objective-C/faq/">FAQs</a> about the language and you will get more insights.</p>
<p>So, before start learning this here are my two cents:</p>
<ol>
<li>Think Objects &amp; Intefaces. Though you write the program in a C like language, do not think procedurally.</li>
<li>You might want to write comparitively more number of lines than you think.</li>
<li>Have patience in using brackets.</li>
<li>You might have to learn few other object-oriented mechanism and implementation other than Inheritance, Polymorphism etc.,</li>
</ol>
<h3 id="hello-world-object-version">Hello World &#8211; Object Version</h3>
<p>Here is the hello world progarm.</p>
<pre>
#import &lt;objc/Object.h&gt;

#import &lt;stdio.h&gt;
/** Write your Interface extending Object **/

@implementation HelloWorld:Object
-(void) hello
{
    printf("Hello World");
}
@end

/** Main program for the program execution entry **/
int main(int argv, char* argc[])
{

/* Create an object */
    id o = [HelloWorld new];

/* Pass the message 'hello' to object in the reference variable 'o' */
    [o hello];
}</pre>
<p>You should notice the below things in the above program</p>
<ol>
<li><code>HelloWorld</code> is extending <code>Object</code> class, which provides the basic features for objects like <code>new, free, alloc</code> etc.,</li>
<li>Used <code>#import</code> instead of the regular <code>#include</code>. The advantage in using <code>#import</code> is, the compiler will make sure that it includes the header file <strong>only once</strong> during compilation irrespective of how many modules is importing ( i.e including ) the same header file repeatedly. So you can avoid boiler-plate code like this.</li>
</ol>
<pre>#ifndef _INC_HEADER1

#define _INC_HEADER1
#include "header1.h"

#endif</pre>
<p>3.The method definition of <code>hello</code> is quite understandable. I&#8217;m not going to explain much of it now here. The object created from this class is capable of receiving the message named <code>hello</code> and invoke the method <code>hello</code> defined in the class <code>HelloWorld</code>.</p>
<p><strong>Compile</strong></p>
<p>To compile this program in your terminal either in Linux / Mac use this command.</p>
<blockquote><p><code>% gcc -arch i386 -o hello -l objc helloworld.m</code></p></blockquote>
<p><strong><code>gcc</code></strong> is the <a href="http://gcc.gnu.org/">GNU compiler suite</a>, which you will get by default in your mac / linux machines or you can download it.</p>
<p><strong><code>-o</code></strong> is to mention that you create an executable with name <code>hello</code></p>
<p><strong><code>-lobjc</code></strong> is to make the compiler aware that you are trying to <a href="http://gcc.gnu.org/onlinedocs/gcc-4.6.2/gcc/Link-Options.html#Link-Options">compile &amp; link</a> <strong>Object-C</strong> language.</p>
<p><strong><code>helloworld.m</code></strong> is the file which contains the objective-c program.</p>
<p><strong>Output</strong></p>
<blockquote><p><code>Hello World</code></p></blockquote>
<h3 id="helloworld-with-interfaces">HelloWorld &#8211; with Interfaces</h3>
<p>Lets add some some salt to it. An another version of the same program can be written like this.</p>
<p><code>#import &lt;objc/Object.h&gt;</code></p>
<p><code>#import &lt;stdio.h&gt;</code></p>
<div class="code">
<pre>
@interface HelloWorld:Object
{
}
-(void) hello;
@end

@implementation HelloWorld
-(void) hello
{
    printf("Hello World");
}

@end

int main(int argv, char* argc[])
{
    id o = [HelloWorld new];

    [o hello];
}
</pre>
</div>
<p>You will note two differences in this version of the program.</p>
<ol>
<li>There is an interface class extending <code>Object</code> class</li>
<li>The implementation class doesn&#8217;t inherit the class <code>Object</code></li>
</ol>
<p>Now, you have to play by rules, the rules of the ObjC compiler.</p>
<ol>
<li>You should name your <code>@interface</code> as same as the <code>@implementation</code> class and you should not inherit any other object for the <code>@implementation</code> class.</li>
<li>Every <code>@interface</code> you write, should extend the <code>Object</code> class, so that you will be able to use the messages (or method) like <code>new, alloc,free</code> etc.,</li>
</ol>
<p>In above program, after declaring the interface you <strong>do not link the interface</strong> to the HelloWorld class, but the ObjC compiler will look for that any interface with the same name as the implementation class.</p>
<p>If you do not provide an interface class name, the compiler will throw out this error.</p>
<pre>helloworld.m:13: warning: cannot find interface declaration for 'HelloWorld'</pre>
<h3 id="hello-world-modularized">Hello World &#8211; Modularized</h3>
<p>Adding more spice to the program. The third variation to the program is below. I create three different files to split and hold the logical group of code into it&#8217;s individual file, i.e basically modularizing the code. You should be known of the advantages of modularizing the code. So, in here I create the below files</p>
<ol>
<li>HelloWorld.h &#8211; Has the interface definition</li>
<li>HelloWorld.m &#8211; Has the implementation details</li>
<li>main.m &#8211; Has code to instantiate and execute the objects</li>
</ol>
<p><strong>HelloWorld.h</strong></p>
<pre>
#import &lt;objc/Object.h&gt;

#import &lt;stdio.h&gt;
@interface HelloWorld:Object
{
-(void) hello;
}</pre>
<p><strong>HelloWorld.m</strong></p>
<pre>
#import "helloworld.h"
@implementation HelloWorld
-(void) hello
{
    printf("Hello World");
}

@end</pre>
<p><strong>main.m</strong></p>
<pre>
#import &lt;objc/Object.h&gt;

#import "helloworld.m"
int main(int argv, char* argc[])
{
    id o = [HelloWorld new];
[o hello];

}
</pre>
<p>This version of the program is what you will be writing in Realtime. Now let us try to understand the parts of the Objective-C language.</p>
<p><strong>Compile</strong></p>
<p>Since you have two module ( ending with <code>.m</code> ) to compile you might need to mention both of them, so that the <code>gcc</code> compiles all the required modules and then links them to create the executable.</p>
<blockquote><p>gcc -lobjc -arch i386 -o main main.m helloworld.m</p></blockquote>
<p>If you have more objective-c implementation files i.e <code>.m</code> files, then you can save the time and pain by including all the files with just using <code>*.m</code></p>
<blockquote><p>gcc -lobjc -arch i386 -o main *.m</p></blockquote>
<h3 id="understanding-the-program">Understanding the program</h3>
<p>Let us spend some time to understand the paradigm of the Objective-C program. The objective-c language, which has a strong influence of <a href="http://www.gnu.org/software/smalltalk/manual/gst.html">SmallTalk</a> based &#8220;message&#8221; passing mechanism and <a href="http://stackoverflow.com/questions/1413543/what-does-it-mean-to-program-to-a-interface">interface-based-programming</a>, makes you think and write the programs in terms of <strong>messages</strong> and <strong>interfaces</strong>.</p>
<p>If you look at the above program, you would notice a pattern which is pretty much as same as a C++ program, except the interfaces and the naming conventions used. Basically the program is of 3 sections:</p>
<ol>
<li>Headers &#8211; Common for any programming language ( C, C++,Java etc., )</li>
<li>Interface &amp; Implementation Classes</li>
<li>And a main program &#8211; which runs the code.</li>
</ol>
<p><em>Note: If you wanted to write a procedural program, then you don&#8217;t have to write a ObjC program</em></p>
<p>And if you are not familiar with the interface based program and if ObjC is going to be the 1st programming language learning <a href="http://stackoverflow.com/questions/1413543/what-does-it-mean-to-program-to-a-interface">interface-based programming</a>, then I strongly recommend to gain some basic knowledge of what does interfaces means and how they are used and useful to the software construction.</p>
<h4 id="write-your-interfaces">Write your interfaces</h4>
<p>Every class you wanted to create i.e the real concrete class which does some logic, you ought to tell the objective-c compiler, something about the class.Thats why you create <code>@interface</code>. <code>@interface</code> create a template of how your object is going to look like, what data it can hold and what messages it can receive to process ( also can receive messages that it cannot support, but you can handle it accordingly)  and then you write the <code>@implementation</code> class to say what does you object is going to do. So, it is two piece of work you have to do.</p>
<p>And remember that, when you are modelling your classes, it always becomes your <code>@interface</code> class not <code>@implementation</code> class.</p>
<p>The interface should extend a class which is of type <code>Object</code> or it should be from the family of the type <code>Object</code> to provide the basic operations like <code>new, free, alloc</code> etc., Again <code>Object</code> is an both <a href="http://www.opensource.apple.com/source/objc4/objc4-222/runtime/Object.h">interface</a> and has an <a href="http://opensource.apple.com/source/objc4/objc4-371/runtime/Object.m">implementation</a>, i.e type <code>Object</code> is a concrete class that you can use as below</p>
<pre>id o = [Object new];
@interface HelloWorld:Object
{
    /* data */
}

/* messages */
    -(void) hello;
@end</pre>
<h4 id="write-your-implementation">Write your implementation</h4>
<p>The implementation class is going to hold the logic what needs to be performed when a defined message by interface is sent to the object. In this case when a <code>hello</code> message is sent to the object, the implementation defines what needs to be done. Interface class starts with <code>@interface &lt;ClassName&gt;</code> and ends with <code>@end</code>.</p>
<pre>@implementation HelloWorld
-(void) hello
{
   ....
   ....
   ....
}

@end</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mymindleaks.com/blog/article/hello-world-in-objective-c-and-compiling-with-gcc.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JUnit best practices &#8211; How to write good junit test cases?</title>
		<link>http://www.mymindleaks.com/blog/article/junit-best-practices-how-to-write-good-junit-test-cases.html</link>
		<comments>http://www.mymindleaks.com/blog/article/junit-best-practices-how-to-write-good-junit-test-cases.html#comments</comments>
		<pubDate>Sat, 11 Dec 2010 01:07:42 +0000</pubDate>
		<dc:creator>Maheshwaran Subramaniya</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[parent:java]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.mymindleaks.com/blog/?p=1201</guid>
		<description><![CDATA[Writing unit test cases1 are the part of any development project process. But developers rarely follow process. For us, we wanted to code something and see it to work on what we have fixed and finally move it to production.When it works, we are happy with it. But wait, when it doesn&#8217;t work? Then comes [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>Writing unit test cases1 are the part of any development project process. But developers rarely follow process. For us, we wanted to code something and see it to work on what we have fixed and finally move it to production.When it works, we are happy with it. But wait, when it doesn&#8217;t work? Then comes a lot of head ache for developer. Ok stories apart, lets get back to work. I&#8217;m not going to discuss about how to write unit testcases, but rather discuss how to write some better unit testcases using JUnit and avoid some of the pitfalls that we developers falls. Since JUnit is based on xUnit testing framework, any xUnit based testing framework for the language you use like NUnit, CppUnit, etc.,</p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Write one test-condition per test method </a></li>
<li><a href="#sec-2">2 When testing output of Collections(List, Set) test for Null and Emptiness </a></li>
<li><a href="#sec-3">3 Use java reflection for adding new methods into test suites </a></li>
<li><a href="#sec-4">4 Compare the objects after performing an operation </a></li>
<li><a href="#sec-5">5 Test the exceptions </a></li>
<li><a href="#sec-6">6 Group logical test cases into test suites </a></li>
<li><a href="#sec-7">7 Check for order of execution of test cases </a></li>
<li><a href="#sec-8">8 Always include a message to assertion </a></li>
<li><a href="#sec-9">9 Know when to use assertEquals and assertSame </a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-3">
<h3 id="sec-1"><span class="section-number-3">1</span> Write one test-condition per test method</h3>
<div id="text-1" class="outline-text-3">
<p>This is first important point. Always, write only one test-condition3 in one test method. Do not group more than one test case in a single test-method.</p>
<p>Consider the following method.</p>
<pre class="example">public boolean validateZipCode(String zipCode)
{
    Matcher m = Pattern.compile("\d{5}").matcher(zipCode);
    return m.matchers();
}
</pre>
<p>You can think of following test cases</p>
<ol>
<li> Input is NULL</li>
<li> Input is Blank</li>
<li> Input is Alpha</li>
</ol>
<p>and many other test cases etc.,</p>
<pre class="example">public void testValidateZipCode()
{
    boolean output = validateZipCode(null);
    assertFalse(output);

    boolean output = validateZipCode("");
    assertFalse(output);

    boolean output = validateZipCode("    ");
    assertFalse(output);
}
</pre>
<p>When you run the above test case, the JUnit will fail in the first assestion. And it will not proceed to next the next test case. So, only if you fix the 1st failure, you will know the 2nd failure (if any). This is bad, because as humans we try to figure out as much issues during every shot.</p>
<pre class="example">public void testValidateZipCode1()
{
    boolean output = validateZipCode(null);
    assertFalse(output);
}

public void testValidateZipCode2()
{
    boolean output = validateZipCode("");
    assertFalse(output);
}

public void testValidateZipCode3()
{
    boolean output = validateZipCode("    ");
    assertFalse(output);
}
</pre>
<p>Now this helps in identifying all the existing issue in single run. Next, you can measure how many test case you have executed, which helps in how many are success and failed.</p>
</div>
</div>
<div id="outline-container-2" class="outline-3">
<h3 id="sec-2"><span class="section-number-3">2</span> When testing output of Collections(List, Set) test for Null and Emptiness</h3>
<div id="text-2" class="outline-text-3">
<p>Methods returning collections should be tested for more conditions.</p>
<ol>
<li> Test for NULL</li>
<li> Test for emptiness</li>
<li> Test for list not returning null ( if requirements allow )</li>
<li> Test for object are of same type, if your requirement is so ( applicable for Java 1.4 )</li>
</ol>
</div>
</div>
<div id="outline-container-3" class="outline-3">
<h3 id="sec-3"><span class="section-number-3">3</span> Use java reflection for adding new methods into test suites</h3>
<div id="text-3" class="outline-text-3">
<p>When you write a separate suite to execute the test cases in order, you might feel pain in the neck when you try to add every testXXX() method to the suite, esp. when your Test has more than 10 test conditions for each method and you are testing a class which has more than 10 methods.</p>
<p>A better way to deal with this is to use Reflection.</p>
<pre class="example">class ZipCodeTest extend TestSuite
{

    public void testSuite()
    {

    }

}
</pre>
<p>I would recommend you to read the JUnit FAQ to good a good understanding of JUnit tool</p>
</div>
</div>
<div id="outline-container-4" class="outline-3">
<h3 id="sec-4"><span class="section-number-3">4</span> Compare the objects after performing an operation</h3>
<div id="text-4" class="outline-text-3">
<p>It is recommended to compare the objects after performing an operation.Consider this.</p>
<pre class="example">class Engine
{

    int state, fuel = 100, timeToRun;

    public void run(int minutes)
    {
            this.timeToRun = minutes;
            this.start();
            this.fuel -= minutes * 1;
            this.stop();
    }

    public void start()
    {
            this.state = 1;
    }

    public void stop()
    {
            this.state = 0;
    }

    public boolean equals(Object o)
    {
            Engine e = (Engine) o;
            return this.state == e.state &amp;&amp; this.fuel == e.fuel;
    }

    public int hashCode()
    {
            return this.fuel;
    }

}

public void testEngineStatusAfterRun()
{
    Engine e = new Engine();
    e.run(5);

    /* less recommended */
    assertTrue(0 == e.state);

    /* recommended */
    Engine expected = new Engine();
    testCasse.state = 0;
    testCasse.fuel = 95;
    assertEquals( expected, e);

}
</pre>
<p>Why testing the entire objecti is recommended? The main reason is, class methods have ability to modify the class variables internally without your knowdlege or you might miss to see it. So, always compare the entire object to what you expect.</p>
</div>
</div>
<div id="outline-container-5" class="outline-3">
<h3 id="sec-5"><span class="section-number-3">5</span> Test the exceptions</h3>
<div id="text-5" class="outline-text-3">
<p>Most of the developers who write JUnit will forget / fail to test the exceptions thrown from the methods. Right exceptions thrown always convey it&#8217;s inherit information. Say you have a exception designed as below</p>
<pre class="example">class CarEngineException extends Exception
{
    int engineErrorCode;
    String message;

    public void runEngine() throws CarEngineException
    {

        if(someCondition1)
        {
                List l = someOtherProcess();
                if(l.isEmpty())
                {
                    CarEngineException ex = new CarEngineStartException();
                    ex.setMessage("some message for failure");
                    ex.setEngineErrorCode(1);
                }
                else if(l.size() == 1)
                {
                    CarEngineException ex = new CarEngineStartException();
                    ex.setMessage("some message for failure");
                    ex.setEngineErrorCode(1);
                }
         }
    }
}
</pre>
<p>In the above case, exceptions are vital part of the method&#8217;s response. One should test the method&#8217;s exception, else you are not performing complete testing.</p>
</div>
</div>
<div id="outline-container-6" class="outline-3">
<h3 id="sec-6"><span class="section-number-3">6</span> Group logical test cases into test suites</h3>
<div id="text-6" class="outline-text-3">
<p>Finally, once you have written as many test cases as possible, try to group them into logical collections. So that when you change a piece of code in a module, you would run only the logical test suite.</p>
<pre class="example">public double power(double num, int exp)
{
    ...
}

public double sqr(double num)
{
    return pow(num,2);
}

public double cube(double num)
{
    return pow(num,3);
}

public double exp(double raise)
{
    ...
}
</pre>
<p>Here are you test methods:</p>
<pre class="example">class MathTest
{

    ...

    public void testPow()
    {
        ...
    }

    public void testSqr()
    {
        ...
    }

    public void testCube()
    {
        ...
    }

    public void testExp()
    {
        ...
    }

}
</pre>
<p>Whenever you change something to exp() or pow() you might want to execute MathTest and which inturn will execute all the test cases, which are not necessary.</p>
<p>In this situation, you can create you own test suite, which will just execute the method you wanted to execute.</p>
<pre class="example">class TestPowMethods
{

    public static Test powMethodSuite()
    {
        TestSuite suite = new TestSuite();
        suite.addTest(new FunctionsTest("testPow"));
        suite.addTest(new FunctionsTest("testSqr"));
        suite.addTest(new FunctionsTest("testCube"));

        return suite;
    }

    public static void main(String[] args)
    {
        /*this will execute just pow() dependent methods */
        TestRunner.run(powMethodSuite());
    }

}
</pre>
</div>
</div>
<div id="outline-container-7" class="outline-3">
<h3 id="sec-7"><span class="section-number-3">7</span> Check for order of execution of test cases</h3>
<div id="text-7" class="outline-text-3">
<p>Always write a seperate test suite, when your module requires an order of execution of test cases, i.e run `test1..test5` before you start other tests, then you can write a seperate TestSuite in the same way as expalined in the above topic. This will give you a better hold of executing the test cases in order.</p>
</div>
</div>
<div id="outline-container-8" class="outline-3">
<h3 id="sec-8"><span class="section-number-3">8</span> Always include a message to assertion</h3>
<div id="text-8" class="outline-text-3">
<p><strong>More the messages, less your debug time</strong>. Providing as many details as possbile is always good for debugging. All the assertXXXX() methods in JUnit framework has an optional parameter a `String message`. But just giving a message isnt a good thing.</p>
<pre class="example">assertEquals("Error code should be 100", 100, e.getErrorCode() );
</pre>
<p>When your above assertion fails, you will get a message Error code should be 100. From this you can conclude that you havent received error code 100. But you are not sure what code have you received. If, your method returns 4 to 5 error codes, you might need to know which conditional part have execute and what error code has been received. Hence write you message wisely.</p>
<pre class="example">assertEquals("Error code should be 100. Received = " + e.getErrorCode(), 100, e.getErrorCode() );
</pre>
<p>Now this will print the received errorCode and you have a better chance of understanding what have happened.</p>
</div>
</div>
<div id="outline-container-9" class="outline-3">
<h3 id="sec-9"><span class="section-number-3">9</span> Know when to use assertEquals and assertSame</h3>
<div id="text-9" class="outline-text-3">
<p>In JUnit package you might find few methods which sound similar. assertEquals and assertSame. Both have a subtle difference2.</p>
<p><strong>assertSame(a,b)</strong>: does a == b. i.e compare both objects instances are same.</p>
<p><strong>assertEquals(a,b)</strong>: does a.equals(b), if equals() method has been overriden. Else it invokes assertSame()</p>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mymindleaks.com/blog/article/junit-best-practices-how-to-write-good-junit-test-cases.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Aggregation vs Composition</title>
		<link>http://www.mymindleaks.com/blog/article/aggregation-vs-composition.html</link>
		<comments>http://www.mymindleaks.com/blog/article/aggregation-vs-composition.html#comments</comments>
		<pubDate>Sat, 13 Nov 2010 03:06:48 +0000</pubDate>
		<dc:creator>Maheshwaran Subramaniya</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[parent:abc]]></category>

		<guid isPermaLink="false">http://www.mymindleaks.com/blog/?p=1148</guid>
		<description><![CDATA[Aggregation and Composition are type of Association which explains how two elements are associated to each other in a class model. Sometime it very confusing to choose between Aggregation &#38; Composition. Association In Object orientation, Association is an important relationship which explains how one element is related to another by type and instance(s) ( i.e [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>Aggregation and Composition are type of Association which explains how two elements are associated to each other in a class model. Sometime it very confusing to choose between  Aggregation &amp; Composition.</p>
<h3 id="association">Association</h3>
<p>In Object orientation, Association is an important relationship which explains how one element is related to another by type and instance(s) ( i.e multiplicity ). Almost most of the objects that you would model or work with will associate with something or other.</p>
<p>class Person<br />
{<br />
String firstName;<br />
String lastName;<br />
Integer age;<br />
}</p>
<p>In the above example, the attribute <code>firstName</code> and <code>lastName</code> are associated to the <code>class Person</code>.</p>
<p>It is very easy to understand about the Association and it is straight forward. But the problem arises for most of the programmers during the UML modeling is, when they come across another type of association i.e <strong>Composition</strong>. Though they are very similar in the <strong>action</strong>, but they are applied for different purposes. Both are certainly an easy to understand concepts, but understanding them requires few insight / visualization of few real world things and correlation with the concepts.</p>
<p><a title="Merriam-Webster Online" href="http://www.merriam-webster.com/">Merriam Webster<br />
</a> definition for</p>
<blockquote><p><strong><a href="http://www.merriam-webster.com/dictionary/aggregation">Aggregation</a></strong>:<em>the collecting of units or parts into a mass or whole</em>.</p>
<p><strong><a href="http://www.merriam-webster.com/dictionary/composition">Composition</a></strong>:<em>product of mixing or combining various elements or ingredients</em>.</p></blockquote>
<p>Does both sounds similar? No. There is a subtle difference. Lets look at those differences now.</p>
<h3 id="aggregation">Aggregation</h3>
<blockquote><p>Aggregation is the process of grouping <strong>homogenous objects</strong>.</p></blockquote>
<p>Notice the bold words <strong>homogenous objects</strong>. Yes, aggregation deals with same type of objects. Same type of object means? Let us see this example.</p>
<p>In Microsoft Excel, Aggregation is process of applying a specific function on set of similar object( Numbers, Text etc.,)</p>
<p><img title="Microsoft Excel Aggregation example" src="http://www.mymindleaks.com/wp-content/uploads/2010/11/aggregation-microsoft-excel.png" alt="Microsoft Excel Aggregation example" /></p>
<p>So, if you mix numbers along with text, the aggregation will not work. Same applies for Object Oriented Modelling too.</p>
<p>Another example is Book. A book is aggregation of pages, not anything else.</p>
<p><code><br />
class Book<br />
{<br />
Page[] pages;<br />
}</code></p>
<p><code> </code></p>
<p><code>class DuckPond<br />
{<br />
List ducks;<br />
}<br />
</code></p>
<p><img src="http://farm3.static.flickr.com/2645/4085456584_8b556c590a_m.jpg" alt="Ducks in Pond" /></p>
<p><em>Courtesy by <a title="Courtesy by John Morgan" href="http://www.flickr.com/photos/aidanmorgan/4085456584/">John Morgan</a></em></p>
<p>In the above example, the list will hold same <code>Address</code> object.</p>
<p>In Java Generics in the Collections are kind of Aggregation.</p>
<p><code><br />
List&lt;Driver&gt; driversList = new ArrayList&lt;Driver&gt;();<br />
</code></p>
<h3 id="composition">Composition</h3>
<p>Composition on the other hand is again grouping of object but, <strong>dis-similar</strong> objects. Than Association you will model objects with composition more frequently. Composition reflects the objects in real world.</p>
<p><code><br />
class Car<br />
{<br />
Wheel[] wheels;<br />
BodyStyle body;<br />
HeadLight[] headlights;<br />
}<br />
</code></p>
<p>The code builds a Car object, where a Car is composed of heterogenous parts like Wheels, Headlights, Body metals etc., Here the appropriate method is <strong>Composition</strong>. Aggregation wont fit here.</p>
<p>Let us consider the book example. A book is aggregation of pages, but pages are not just made of text. They are made of tex and pictures.</p>
<p><code><br />
class Page<br />
{<br />
List textblocks;<br />
List imageblocks;<br />
}<br />
</code></p>
<p><img src="http://www.mymindleaks.com/wp-content/uploads/2011/11/2073_idly_12898933201.jpg" alt="Example of Composition: Perfect South Indian Dish" /></p>
<p><em>Composition of different and appropriate object makes things better</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mymindleaks.com/blog/article/aggregation-vs-composition.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Javascript: Create DOM object only once</title>
		<link>http://www.mymindleaks.com/blog/article/javascript-create-dom-object-only-once.html</link>
		<comments>http://www.mymindleaks.com/blog/article/javascript-create-dom-object-only-once.html#comments</comments>
		<pubDate>Fri, 12 Nov 2010 06:12:39 +0000</pubDate>
		<dc:creator>Maheshwaran Subramaniya</dc:creator>
				<category><![CDATA[Misc...]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[parent:java]]></category>

		<guid isPermaLink="false">http://www.mymindleaks.com/blog/?p=1103</guid>
		<description><![CDATA[Browser [DOM](http://en.wikipedia.org/wiki/Document_Object_Model &#8220;Document Object Model&#8221;) is always created once and the same DOM is referred every time when used (like any other object model). It is not destroyed / deleted unless it is explicitly triggered. But some aspects of browser would make the DOM object reset. For example, during the XHR based requests, more than [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>Browser [DOM](http://en.wikipedia.org/wiki/Document_Object_Model &#8220;Document Object Model&#8221;)  is always created once and the same DOM is referred every time when used (like any other object model). It is not destroyed / deleted unless it is explicitly triggered.</p>
<p>But some aspects of browser would make the DOM object reset. For example, during the XHR based requests, more than one page might contain the same script to perform and you are not likely to put them as a common script in the parent. When the same script is loaded by more than one page ( a.html &amp; b.html), your DOM will likely to reset.</p>
<pre class="brush:js">
YAHOO.namespace("mymindleaks.loadonce");

YAHOO.mymindleaks.loadonce = (function()
{
	var context;
	var _init = function()
	{
		if( !context )
		{
			context = createHTTPRequest("http://www.mymindleaks.com/ping");
		}

		return context;
	};

	return{
		init: _init

	};
})();

YAHOO.mymindleaks.loadonce.init();
</pre>
<p>When this code is embedded in a HTML file and when it is loaded more than one time in the same HTML session, everytime the page is loaded, the object YAHOO.mymindleaks.loadonce will be created new and the value will be initialized. Hence there will be more than one &#8220;ping&#8221; to the URL, which is not intented.</p>
<p>In order to make only one ping from the browser per session, you have to restrict the browser not to invoke the function again. This can be done simply by adding a <code>if-condition</code></p>
<pre class="brush:js">
YAHOO.namespace("mymindleaks.loadonce");

if( !YAHOO.mymindleaks.loadonce )
{
	YAHOO.mymindleaks.loadonce = (function()
	{
		var context;
		var _init = function()
		{
			if( !context )
			{
				context = createHTTPRequest("http://www.mymindleaks.com/ping");
			}

			return context;
		};

		return{
			init: _init

		};
	})();

	YAHOO.mymindleaks.loadonce.init();
}
</pre>
<p>by adding a <code>if-condition</code> the browser restricts the invocation of the anonymous function as the object <code>YAHOO.mymindleaks.loadonce</code> is already existing in the DOM.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mymindleaks.com/blog/article/javascript-create-dom-object-only-once.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tamil dictionary for the Computer Words</title>
		<link>http://www.mymindleaks.com/blog/article/tamil-dictionary-computer-words.html</link>
		<comments>http://www.mymindleaks.com/blog/article/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[Computing]]></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[
<!-- ALL ADSENSE ADS DISABLED -->
<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/article/tamil-dictionary-computer-words.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Computing the Services &#8211; Part 2: Characteristics</title>
		<link>http://www.mymindleaks.com/blog/article/computing-the-services-part-2.html</link>
		<comments>http://www.mymindleaks.com/blog/article/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[Service Oriented Architecture]]></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[
<!-- ALL ADSENSE ADS DISABLED -->
<p style="clear: both;">Continuing with the <a title="Computing the Services - Part 1" href="http://www.mymindleaks.com/blog/archives/computing-the-services-part-1.html" 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 class="brush:js" 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 class="brush:js" 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="" width="600" height="162" />Fig 1. Decomposing the methods to create more granular methods.</p>
<pre class="brush:js" 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="" width="600" height="236" />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/article/computing-the-services-part-2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Numbers in Tamil language – Why zero might not be important</title>
		<link>http://www.mymindleaks.com/blog/article/numbers-tamil-language.html</link>
		<comments>http://www.mymindleaks.com/blog/article/numbers-tamil-language.html#comments</comments>
		<pubDate>Sun, 04 Apr 2010 21:20:24 +0000</pubDate>
		<dc:creator>Maheshwaran Subramaniya</dc:creator>
				<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[numbers]]></category>
		<category><![CDATA[numbers in tamil]]></category>
		<category><![CDATA[numericals]]></category>
		<category><![CDATA[tamil language]]></category>

		<guid isPermaLink="false">http://www.mymindleaks.com/blog/?p=970</guid>
		<description><![CDATA[Tamil language also has it's own glyphs to write numbers. Also, Tamils did not consider zero to be the part of the numbers chart.]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p style="clear: both;">Every civilization had their own representation of numbers in their age. Like what we have now , the <a title="Arabic Numerals" href="http://en.wikipedia.org/wiki/Arabic_numerals" target="_blank">Arabic Numerals</a> [1. The Story of Mathematics - Richard Mankiewicz ] [2. Number System - http://www.math.wichita.edu/history/topics/num-sys.html]. This representation is no more in use as universally as the arabic numerals that are taught now. Though different civilizations had different glyphs to represent number, everyone have understood the importance of numbers and found a way to represent them and did known how to handle it.</p>
<blockquote style="clear: both;"><p>In Tamil, Number is called as “EN&#8221; ( Tamil:???) and “Digit&#8221; is called as Illakangal ( Tamil: ??????? )</p></blockquote>
<h3>Numbers in Tamil</h3>
<p style="clear: both;"><a title="Tamil Language" href="http://en.wikipedia.org/wiki/Tamil_language" target="_blank">Tamil language</a> instructs to write numbers based on how the pronunciation is made rather than how the digits are spelled.</p>
<p style="clear: both; text-align: center;"><a class="image-link" href="http://www.mymindleaks.com/wp-content/uploads/2010/04/number-pronounce-spell1-full.png" target="_blank"><img class="linked-to-original" style="text-align: center; display: block; margin: 0 auto 10px;" src="http://www.mymindleaks.com/wp-content/uploads/2010/04/number-pronounce-spell1-thumb.png" alt="" width="380" height="86" /></a>Fig 1. How a number is spelled and pronounced</p>
<p style="text-align: left;">Below list maps the modern number we use, to the tamil glyphs that was used by the Tamils. It is interesting to find that the list doesn&#8217;t contain a tamil representation for equivalent for zero. I&#8217;m wondering why the tamil havent created any glyph for &#8220;ZERO&#8221;. Did they think that it&#8217;s not mandatory that one should require ZERO to write down numbers? or did they find ZERO is &#8216;evil&#8217;? or ZERO is not necessarily to write down any number in this world, other than ZERO.</p>
<p style="clear: both; text-align: center;"><a class="image-link" href="http://www.mymindleaks.com/wp-content/uploads/2010/04/list-numbers-tamil1-full.png" target="_blank"><img class="linked-to-original" style="text-align: center; display: block; margin: 0 auto 10px;" src="http://www.mymindleaks.com/wp-content/uploads/2010/04/list-numbers-tamil1-thumb.png" alt="" width="380" height="354" /></a>Fig 2. Listing the tamil glyphs for modern numbers we use</p>
<h3>ZERO, un-important in Tamil numbers?</h3>
<p style="clear: both; text-align: justify;">Even in our modern world, we don&#8217;t use zero when we pronounce the number. We don&#8217;t say , &#8220;<em>One Hundred <strong>Zero</strong> Three</em>&#8221; for 103. If that is the text, it would literally means &#8220;<em>One followed by Hundred Zeros and a Three</em>&#8220;. So, we are accustomed to say, &#8220;<em>One Hundred and Three</em>&#8220;. We can see that we don&#8217;t require ZERO when we say a number. It&#8217;s only required when we spell the number. But Tamils <strong>haven&#8217;t</strong> or <strong>&#8216;didn&#8217;t wanted&#8217;</strong> to have two formats to say a number ( pronouncing &amp; spelling ). This could be one reason that I can think of why ZERO is missing in the number set.</p>
<p style="clear: both;"><a title="INFITT" href="http://www.infitt.org/ti2010/" target="_blank">INFITT ( International Forum for Information Technology in Tami)</a> aka “??????? (Uttamam)&#8221; have made proposal to include <a href="http://std.dkuug.dk/jtc1/sc2/wg2/docs/n2741" target="_blank">ZERO into the tamil number</a> glyph’s list and createa UNICODE symbol for it in the tamil language font.</p>
<p style="clear: both;">I tried to translate few numbers from arabic to tamil [3. Tamil Unicode List - http://www.unicode.org/notes/tn21/tamil_numbers.pdf]and here is on how to write numbers in tamil. You can also try few and if possible share it.</p>
<p style="clear: both; text-align: center;"><a class="image-link" href="http://www.mymindleaks.com/wp-content/uploads/2010/04/how-to-write-numbers-in-tamil1-full.png" target="_blank"><img class="linked-to-original" style="text-align: center; display: block; margin: 0 auto 10px;" src="http://www.mymindleaks.com/wp-content/uploads/2010/04/how-to-write-numbers-in-tamil1-thumb.png" alt="" width="380" height="303" /></a>Fig 3. Some sample on how to write a number</p>
<p style="clear: both;">One thing I could realize is that, in olden days people in any civilization ( not Babylons ) who didn’t had ZEROs in their set, to write / speak about any number.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mymindleaks.com/blog/article/numbers-tamil-language.html/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Computing the Services – Part 1: Introduction</title>
		<link>http://www.mymindleaks.com/blog/article/computing-the-services-part-1.html</link>
		<comments>http://www.mymindleaks.com/blog/article/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[Service Oriented Architecture]]></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[
<!-- ALL ADSENSE ADS DISABLED -->
<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="" width="451" height="295" /> 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="" width="166" height="166" align="middle" /><br style="clear: both;" /><br style="clear: both;" /><a href="http://www.dealerrefresh.com/5-steps-to-better-customer-service/">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>
<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/article/computing-the-services-part-1.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My Mind Leaks plugged out Bluehost and plugged in Webfaction</title>
		<link>http://www.mymindleaks.com/blog/article/my-mind-leaks-plugged-out-bluehost-plugged-in-webfaction.html</link>
		<comments>http://www.mymindleaks.com/blog/article/my-mind-leaks-plugged-out-bluehost-plugged-in-webfaction.html#comments</comments>
		<pubDate>Thu, 14 Jan 2010 11:40:21 +0000</pubDate>
		<dc:creator>Maheshwaran Subramaniya</dc:creator>
				<category><![CDATA[Misc...]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[Applications & Utilities]]></category>
		<category><![CDATA[bluehost]]></category>
		<category><![CDATA[comaprision]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[mymindleaks]]></category>
		<category><![CDATA[webfaction]]></category>

		<guid isPermaLink="false">http://www.mymindleaks.com/blog/?p=910</guid>
		<description><![CDATA[I was looking for something much more than of web hosting simply. It was time to say good bye to bluehost, when I saw Webfaction and it's services. They really empower the hosting with set of web frameworks and user requested tools to provide a good comfort level as both developers and customers. This post is all about why I chose to move to Webfaction, leaving Bluehost after 2 years of hosting. And I have a point.]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>I wanted to write about my migration to new hosting. I write this post to say that why I&#8217;m leaving Bluehost and why did I chose Webfaction. Loyal Bluehost hosters dont get furious, this is my personal opinion on why I switched. Now, this blog is powered by <a href="http://www.webfaction.com/?affiliate=mymindleaks">Webfaction</a>. Moving a blog to a new hosting provider is  as exiting as moving to a new city.  Today I completely moved my blog from Bluehost to Webfaction. Believing <a href="http://en.wikiquote.org/wiki/Heraclitus">Change is always constant</a>, I keep on looking for some kind of change. Now, it&#8217;s time to change my blog&#8217;s hosting provider.</p>
<div>
<h3>So, why did I change?</h3>
</div>
<div>There is a strong intention for moving out from Bluehost. Despite a fairly a good service and good customer support, <a href="http://www.bluehost.com">Bluehost</a> is still failed to cater my needs. Bluehost supports PHP, Ruby, Python, Rails etc., but not good enough web frameworks except Rails.<br />
I wanted Python and Django web-framework. Though you can still build Django framework with some spoof [<a href="http://www.bluehostforum.com/showthread.php?t=715">http://www.bluehostforum.com/showthread.php?t=715</a>],  it&#8217;s still makes you feel like you are doing the olden days &#8220;<a href="http://en.wikipedia.org/wiki/Data_scraping">Content-Scraping</a>&#8220;, i.e you are forcing the system to get you what it is not supposed to give you. Also, the fcgi script which is inserted between the python process and web request is not sure how it can handle the loads.</p>
<p>Also, when I first took the Bluehost, I was impressed with the following items</p>
<ul>
<li>Unlimited Space</li>
<li>Unlimited Bandwith</li>
<li>Lots of tools, scripting language etc.,</li>
<li>WordPress</li>
</ul>
<p>But, after a quite an amount of time, when I look back and see, I haven&#8217;t used those features to full extend. So, I&#8217;ve jotted few questions.</p>
<ul>
<li>Am I really making use of the  &#8216;Unlimited&#8217; marketing terms?</li>
<li>Does the hosting provider solve my programming needs? Am I using all the tools he gives?</li>
<li>Will I be able to host self-developed apps?</li>
<li>What about the system Performance? Am I compromising with Unlimited &#8216;blah-blah&#8217;?</li>
<li>Are the hosting service ready to setup the web framework I am asking for?</li>
<li>At-last, am I happy with my current hosting provider?</li>
</ul>
<h3>Am I really making use of the  &#8216;Unlimited&#8217; marketing terms?</h3>
<p>To my perspective the Unlimited bandwidth and Unlimited disk space is kind of a marketing strategy compared to the real usability perspective. Its real hard for a single blog to fill a more than 200 GB if he writes 10 posts per day, 365 days for 50 years and each post is of size 1000 KiloBytes.</p>
<p>So, for a blog having a unlimited diskspace is just a too much. For bandwidth, a site with 200,000 hits per month viewing 1000 KiloBytes of data on an average would just occupy ~200 GB of bandwidth. Hence I&#8217;m satisfied with Webfaction, as my blog is not a top hit blog to get 200,000 hits per month.</p>
<p>So, Webfaction have given me a satisfiable and stomach full of disk-space and bandwidth to survive with.</p>
<h3>Does the hosting provider solve my programming needs?</h3>
<p>Yes and No. Yes Bluehost gives a set of tools like PHP, Python, Ruby, MySQL / PostgreSQL. Really appreciate it. Except rails, they aren&#8217;t providing any web frameworks namely Django  or any other framework etc., Also, power programming includes, access to most of the tools via shell. Having access to most of the utils like gcc, emacs etc., provides a good interface to develop any utilities and use them as CGI service. Even though you have PHP, still I was not given access to configure the PHP to solve my programming needs.  And, I failed to love Bluehost for not providing one of my cool tool &#8216;<em>wget&#8217;</em>.</p>
<h3>Will I be able to host self-developed apps?</h3>
<p>Yes only if you have developed the application in PHP / Rails. No other programming language framework was supported by Bluehost. You can write script, but not a full scale application except PHP / Rails. Now, looking at Webfaction, I could host applications developed in the following <a href="http://docs.webfaction.com/user-guide/websites.html#creating-an-application">frameworks</a>.</p>
<ul>
<li>CherryPy</li>
<li>Django</li>
<li>Drupal</li>
<li>Pylons</li>
<li>Python (Apache with mod_python or WSGI)</li>
<li>Ruby on Rails</li>
<li>Static/CGI/PHP</li>
<li>TurboGears</li>
<li>WordPress</li>
<li>Zope</li>
</ul>
<p>So, I have enough framework on my plates to play with it. Bluehost again fails in this. They provide excellent blog support ( WordPress, Drupal, Joomla, Wiki ), but no frameworks.</p>
<h3>What about the system Performance? Am I compromising with Unlimited &#8216;blah-blah&#8217;?</h3>
<p>In the beginning, I was never worried about the performance of the system provided, due to the magic-sweet-googly-woogly word &#8216;Unlimited blah-blah&#8217;. That magic word makes the customer, forget about few important aspects of the service, i.e PERFORMANCE. Bluehost provides a standard Quad-Core machine, on a sharing basis. Webfaction provides a slice of CPU &amp; Computing Memory whatever the load be. So, you always get that processing speed irrespective of your neighboring host apps processing in the same server.</p>
<p>Since, Bluehost aren&#8217;t able to provide slices / VPS kind of service, I believe they are reluctant on providing web frameworks or application frameworks, which deeply affects the performance.</p>
<h3>Are the hosting service ready to setup the web framework I am asking for?</h3>
<p>Yes, Webfaction openly welcomes to ask for any specific tools which they can install and make their customer happy. Bluehost, has most of the tools already built in, but they should expand up their services to provide web frameworks.</p>
<p>With the above mentioned items, I&#8217;m satisfied with the Webfaction&#8217;s service and happy to host with them. More over their monthly billing support was one of the good feature to attract customers. Their pricing is also very comfortable for people who have limited fund to run and still get good performance, disk space, band width and more. Webfaction, seems to be happy welcoming customers and make customers happy even when they leave Webfaction, which is most important. But, still Webfaction is still lacking few things, like Little Knowledge base, No UI for file manager, Cron Jobs etc.,</p>
<p>Some alternatives to Webfaction</p>
<ol>
<li><a href="http://www.slicehost.com/">Slicehost</a></li>
<li><a href="http://www.rackspace.com">Rackspace</a></li>
<li><a href="http://mediatemple.net/webhosting/gs/">Media Temple</a></li>
</ol>
</div>
<div>
<ol></ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mymindleaks.com/blog/article/my-mind-leaks-plugged-out-bluehost-plugged-in-webfaction.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Does pretty links &amp; SEO URL really sensible for search engines?</title>
		<link>http://www.mymindleaks.com/blog/article/does-pretty-links-seo-url-really-sensible-for-search-engines.html</link>
		<comments>http://www.mymindleaks.com/blog/article/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[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[
<!-- ALL ADSENSE ADS DISABLED -->
<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">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">protocol</a></li>
<li><em>www</em> -&gt; <a href="http://en.wikipedia.org/wiki/Subdomain">subdomain</a></li>
<li><em>mymindleaks</em> -&gt; <a href="http://en.wikipedia.org/wiki/Domain_name">domain name</a></li>
<li><em>com</em> -&gt;  <a href="http://en.wikipedia.org/wiki/Top-level_domain">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/">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">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">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">Peter Norvig</a> - <a href="http://norvig.com">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">Xahlee</a> - <a href="http://xahlee.org">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">John Chow</a> - <a href="http://johnchow.com">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">Problogger</a> - <a href="http://problogger.net">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">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/article/does-pretty-links-seo-url-really-sensible-for-search-engines.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

