<?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>« Simple and Pragmatic Thoughts » &#187; Java</title>
	<atom:link href="http://isagoksu.com/categories/development/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://isagoksu.com</link>
	<description>Nobody can be perfect, but you can think better, design better, and always use baby steps!</description>
	<lastBuildDate>Tue, 16 Mar 2010 03:39:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Single, Dynamic, Multiple and Double Dispatching</title>
		<link>http://isagoksu.com/2009/development/java/single-dynamic-multiple-and-double-dispatching/</link>
		<comments>http://isagoksu.com/2009/development/java/single-dynamic-multiple-and-double-dispatching/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 10:57:33 +0000</pubDate>
		<dc:creator>Isa Goksu</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[dispatch]]></category>
		<category><![CDATA[double]]></category>
		<category><![CDATA[languages]]></category>
		<category><![CDATA[Multiple]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[single]]></category>

		<guid isPermaLink="false">http://isagoksu.com/?p=625</guid>
		<description><![CDATA[<p>Today I was reading couple articles about programming languages and I noticed that there is still some confusion about dispatching. So I&#8217;ll try to explain as much as I can. Everbody is welcome to correct!</p>]]></description>
			<content:encoded><![CDATA[<p>Today I was reading couple articles about programming languages and I noticed that there is still some confusion about dispatching. So I&#8217;ll try to explain as much as I can. Everbody is welcome to correct!</p>]]></content:encoded>
			<wfw:commentRss>http://isagoksu.com/2009/development/java/single-dynamic-multiple-and-double-dispatching/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Creating Custom Annotations and Using Them</title>
		<link>http://isagoksu.com/2009/development/java/creating-custom-annotations-and-making-use-of-them/</link>
		<comments>http://isagoksu.com/2009/development/java/creating-custom-annotations-and-making-use-of-them/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 08:58:25 +0000</pubDate>
		<dc:creator>Isa Goksu</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[annotation]]></category>
		<category><![CDATA[create]]></category>
		<category><![CDATA[element-type]]></category>
		<category><![CDATA[retention]]></category>
		<category><![CDATA[target]]></category>
		<category><![CDATA[use]]></category>

		<guid isPermaLink="false">http://isagoksu.com/?p=565</guid>
		<description><![CDATA[<p>Okay, here is another topic that I couldn&#8217;t find much information in the Internet :) So I guess I&#8217;m gonna cover it quickly.</p>]]></description>
			<content:encoded><![CDATA[<p>Okay, here is another topic that I couldn&#8217;t find much information in the Internet :) So I guess I&#8217;m gonna cover it quickly.</p>]]></content:encoded>
			<wfw:commentRss>http://isagoksu.com/2009/development/java/creating-custom-annotations-and-making-use-of-them/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Naming the Java Implementation Classes</title>
		<link>http://isagoksu.com/2009/development/java/naming-the-java-implementation-classes/</link>
		<comments>http://isagoksu.com/2009/development/java/naming-the-java-implementation-classes/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 03:53:33 +0000</pubDate>
		<dc:creator>Isa Goksu</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[convention]]></category>
		<category><![CDATA[impl]]></category>
		<category><![CDATA[implementation]]></category>
		<category><![CDATA[naming]]></category>

		<guid isPermaLink="false">http://isagoksu.com/2009/general/naming-the-java-implementation-classes/</guid>
		<description><![CDATA[Today I was reading an answer to a question (http://bit.ly/FkgKB) about naming the implementation classes. For instance, if your interface name is Item, your implementation class name would be ItemImpl. A bridging class is even easier to name, since it will belong in one domain but implement interfaces in another: for example, SnipersTableModel (a user interface class) implements SniperListener and PortfolioListener (from the application core).]]></description>
			<content:encoded><![CDATA[<p> Today I was reading an answer to a question (<a href="http://bit.ly/FkgKB" title="The question" target="_blank">http://bit.ly/FkgKB</a>) about naming the implementation classes. People in these days are using <em>Impl</em> suffix to their implementation classes which implements a certain interface. For instance, if your interface name is <strong>Item</strong>, your implementation class name would be <strong>ItemImpl</strong>. Honestly I hate this bullshit naming convention. And I&#8217;ll forever blame the guy who invented such a crappy naming. Actually I first saw this naming convention in the <a href="http://www.ibm.com/developerworks/" title="IBM Developerworks" target="_blank">IBM Developerworks</a> articles. I guess it is some sort of <a href="http://www.ibm.com/developerworks/" title="IBM Developerworks" target="_blank">IBM</a> crap (I never got along with any of IBM related thing so far though). Anyways, let me tell you why it&#8217;s crappy: </p>]]></content:encoded>
			<wfw:commentRss>http://isagoksu.com/2009/development/java/naming-the-java-implementation-classes/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Convert String to Enum</title>
		<link>http://isagoksu.com/2009/development/java/convert-string-to-enum/</link>
		<comments>http://isagoksu.com/2009/development/java/convert-string-to-enum/#comments</comments>
		<pubDate>Tue, 19 May 2009 00:32:59 +0000</pubDate>
		<dc:creator>Isa Goksu</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[Enum]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://isagoksu.com/2009/general/convert-string-to-enum/</guid>
		<description><![CDATA[Last month we were coding some Groovy stuff and we needed to use Enum equivalents of couple Strings. After a little reading, we came up with following solution: enum Colors { BLUE, WHITE } // ..]]></description>
			<content:encoded><![CDATA[<p>Last month we were coding some <em>Groovy</em> stuff and we needed to use <strong>Enum</strong> equivalents of couple <strong>Strings</strong>. We had couple dynamic <strong>Strings</strong> coming from off-shore developers, which defines the type of the entity. In our system, those types were represented by <strong>Enums</strong>. Anyways, basically we had to resolve the <strong>Enums</strong> from given <strong>Strings</strong>. After a little reading, we came up with following solution:</p>]]></content:encoded>
			<wfw:commentRss>http://isagoksu.com/2009/development/java/convert-string-to-enum/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Avoid NullPointerExceptions (NPE)?</title>
		<link>http://isagoksu.com/2009/development/java/how-to-avoid-nullpointerexceptions-npe/</link>
		<comments>http://isagoksu.com/2009/development/java/how-to-avoid-nullpointerexceptions-npe/#comments</comments>
		<pubDate>Mon, 04 May 2009 09:38:02 +0000</pubDate>
		<dc:creator>Isa Goksu</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[avoid]]></category>
		<category><![CDATA[NPE]]></category>
		<category><![CDATA[nullpointerexception]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://isagoksu.com/?p=279</guid>
		<description><![CDATA[Please check the following code: public void getUserDetails(final User user) { // make sure that user is not null assert (user != null) : "User cannot be null";]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sure every Java developer has had some hard times with <strong>NPEs</strong> (NullPointerException) since Java doesn&#8217;t really have a nice mechanism to avoid them :) Let&#8217;s recall something here: NPE is a run time exception and it occurs in the run time, therefore it means it is a design mistake, bad code quality or careless programming. Anyways, whatever the reason is, we all see NPEs all over our codes :) In this post, I want to cover this issue and give some tips from my experience so far.</p>]]></content:encoded>
			<wfw:commentRss>http://isagoksu.com/2009/development/java/how-to-avoid-nullpointerexceptions-npe/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Understanding Static Blocks</title>
		<link>http://isagoksu.com/2009/development/java/understanding-static-blocks/</link>
		<comments>http://isagoksu.com/2009/development/java/understanding-static-blocks/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 00:58:25 +0000</pubDate>
		<dc:creator>Isa Goksu</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[initializer]]></category>
		<category><![CDATA[static]]></category>
		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://isagoksu.com/?p=225</guid>
		<description><![CDATA[Before talking about Static Initializer, I wanna talk a little bit about what is this static thingy in Java. I hope this clarifies things a little bit :) Yes, we have couple limitations about static blocks: You shouldn't try to access super since there is no such a thing for static blocks You cannot use this keyword since there is no instance :) You cannot throw Checked Exceptions And please don't try to return anything from this block Please share your knowledge on this topic by adding new comments.]]></description>
			<content:encoded><![CDATA[<p>
Before talking about <strong>Static Initializer</strong>, I wanna talk a little bit about what is this static thingy in Java. 
</p>]]></content:encoded>
			<wfw:commentRss>http://isagoksu.com/2009/development/java/understanding-static-blocks/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Varargs Collection Factory Method</title>
		<link>http://isagoksu.com/2009/development/java/varargs-collection-factory-method/</link>
		<comments>http://isagoksu.com/2009/development/java/varargs-collection-factory-method/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 03:28:27 +0000</pubDate>
		<dc:creator>Isa Goksu</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[collection factory]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[varargs]]></category>

		<guid isPermaLink="false">http://isagoksu.com/?p=219</guid>
		<description><![CDATA[myStringArgs) { for (String stringArg : myStringArgs) { // do something } } // and call would be like doSomething("arg1", "arg2");]]></description>
			<content:encoded><![CDATA[<p>If you read my double brace post, you might find it very handy. However, sometimes you might be warned by <strong>PMD</strong> or <strong>Checkstyle</strong> for this kind of usage. Because they don&#8217;t like this kind of usages. One way to fix this problem is putting either <strong>//no pmd</strong> or suppressing method for <strong>PMD.NonStaticInitializer</strong>.</p>]]></content:encoded>
			<wfw:commentRss>http://isagoksu.com/2009/development/java/varargs-collection-factory-method/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Double Brace Initialization</title>
		<link>http://isagoksu.com/2009/development/java/double-brace-initialization/</link>
		<comments>http://isagoksu.com/2009/development/java/double-brace-initialization/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 02:50:19 +0000</pubDate>
		<dc:creator>Isa Goksu</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[double brace initialization]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://isagoksu.com/?p=209</guid>
		<description><![CDATA[Java has double brace initialization which allows you to initialize any of your objects (this only works for non-final classes) in double brace syntax. This type of initializer block is called an instance initializer, because it is declared within the instance scope of the class.]]></description>
			<content:encoded><![CDATA[<p>Java doesn&#8217;t have a really nice way to initialize the collections. Because of this creating some constant collections, passing them to a method, or using them while unit-testing is kinda way too hard. For instance; you just need a 3 items in your list, but Java expects you to define in the following way:</p>]]></content:encoded>
			<wfw:commentRss>http://isagoksu.com/2009/development/java/double-brace-initialization/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>What Is Hash Code</title>
		<link>http://isagoksu.com/2009/development/java/what-is-hash-code/</link>
		<comments>http://isagoksu.com/2009/development/java/what-is-hash-code/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 06:20:10 +0000</pubDate>
		<dc:creator>Isa Goksu</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[equals]]></category>
		<category><![CDATA[generate]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[hashcode]]></category>
		<category><![CDATA[map]]></category>

		<guid isPermaLink="false">http://isagoksu.com/?p=133</guid>
		<description><![CDATA[It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results.]]></description>
			<content:encoded><![CDATA[<blockquote>If you want to file something away for later retrieval, it can be faster if you file it numerically rather than by a long alphabetic key. A hashCode is a way of computing a small (32-bit) digest numeric key from a long String or even an arbitrary clump of bytes. The numeric key itself is meaningless and the hashCode functions for computing them can look a bit insane. However, when you go to look for something, you can do the same digest calculation on the long alphabetic key you are looking for, and no matter how bizarre an algorithm you used, you will calculate the same hashCode, and will be able to look up numerically with it. Of course there is always the possibility two different Strings will have the same digest hashCode. However, even then, all is not lost; it greatly narrows down the search, hence speeding it up. A <span class="jclass">Hashtable</span> goes a step further, scrunching down the hashCode even further to an even smaller number that it can use to directly index an array, usually by dividing it by some (ideally prime) number and taking the remainder.</blockquote>

<p>I saw this introduction in one of the <a href="http://mindprod.com" target="_blank">site</a> that I was surfing. The main idea of hashing was exactly this. In Java 1.0.x and 1.1, <em>String.hashCode</em> function was working by sampling every <em>n</em>th character. However, this was slowing down the Hashtable lookup. With Java 1.2, function has been improved to multiply the result by 31 then add the next character in sequence. This was much slower, but much secure to avoid the collisions. For <em>Object.hashCode</em> things were almost same. Then Sun came up with a much wider spec which 1.4 implementation made sense after.</p>]]></content:encoded>
			<wfw:commentRss>http://isagoksu.com/2009/development/java/what-is-hash-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

