<?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>Monomorphic &#187; java</title>
	<atom:link href="http://www.monomorphic.org/wordpress/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.monomorphic.org/wordpress</link>
	<description>Nystrom re-presents</description>
	<lastBuildDate>Tue, 27 Jul 2010 02:12:31 +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>Tips for academics who develop software</title>
		<link>http://www.monomorphic.org/wordpress/advice-for-academics-who-develop-software/</link>
		<comments>http://www.monomorphic.org/wordpress/advice-for-academics-who-develop-software/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 17:44:14 +0000</pubDate>
		<dc:creator>johan</dc:creator>
				<category><![CDATA[Software development]]></category>
		<category><![CDATA[academic]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[software engineering]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.monomorphic.org/wordpress/?p=533</guid>
		<description><![CDATA[Academics and practitioners, having rather different goals in life, tend to approach software development in quite different ways. No doubt there are many things each side of the fence can learn from the other, but I think academics in particular could often benefit quite a lot by adopting some of the practices used in industrial [...]]]></description>
			<content:encoded><![CDATA[<p>Academics and practitioners, having rather different goals in life, tend to approach software development in quite different ways. No doubt there are many things each side of the fence can learn from the other, but I think academics in particular could often benefit quite a lot by adopting some of the practices used in industrial development. And not just computer science academics!</p>
<p>A common misconception is that these techniques only are useful with large projects and large teams. I find, though, that they can help reduce much of the growth pains even in small projects, helping them reach maturity much faster.</p>
<p><strong>Use version control.</strong> Classical, but invalid, counter arguments include &#8220;it&#8217;s a hassle and too much work to set up&#8221;, or &#8220;there&#8217;s only one person working on this project anyway&#8221;. Even if it&#8217;s only you, you will benefit massively from being able to undo your changes far back in time. It will let you experiment safely. Plus, setup is no longer an issue with free and easy-to-use services like <a href="http://www.gitbub.com">github</a> and <a href="http://www.bitbucket.org">bitbucket</a>. My tool of choice is now Mercurial, and I used to use SVN. And there are many other good choices.</p>
<p><strong>Use a debugger.</strong> If there is a debugger available for your language, and there most certainly is, then you should use it to find nontrivial errors, rather than extensive printf style testing.</p>
<p><strong>Don&#8217;t optimise prematurely, but when you need to, use a profiler.</strong> Profilers tell you where a program&#8217;s performance bottlenecks are. You can profile things like heap usage (what classes use most space in Java, for instance) and CPU usage (which functions use the most CPU time). For Java, I&#8217;ve discovered that the NetBeans IDE has a very good built in profiler. Eclipse also has one, but it didn&#8217;t work on Mac last time I checked. For C/C++, GProf used to be good and probably still is.</p>
<p><strong>Use unit testing wisely.</strong> All of the above apply even to very small projects, but I think some projects are too small to need unit tests, at least initially. You be the judge. I find that unit tests can have a lot of benefit when applied to the fragile, complicated parts of a system, where many different things interlock. If you are ambitious you can also write tests first and code later &#8212; test driven development.</p>
<p><strong>Use a good IDE if you can.</strong> For a language like Java, where you have to type a lot of code to get something done and spread out your code across lots of files, a good IDE that can generate boilerplate code and navigate quickly can really speed up your work. It&#8217;s beneficial for other languages too. But I have no problem with people who use pure vim or emacs, after all these are practically IDEs.</p>
<p>I believe that honing your software development skills as an academic can pay off. Also see: Daniel Lemire on <a href="http://feedproxy.google.com/~r/daniel-lemire/atom/~3/yCTh62CVGi0/">why you should open source your projects</a>. (I will get around to doing this eventually, I promise <img src='http://www.monomorphic.org/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> )</p>
]]></content:encoded>
			<wfw:commentRss>http://www.monomorphic.org/wordpress/advice-for-academics-who-develop-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where is Java going?</title>
		<link>http://www.monomorphic.org/wordpress/where-is-java-going/</link>
		<comments>http://www.monomorphic.org/wordpress/where-is-java-going/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 05:51:16 +0000</pubDate>
		<dc:creator>johan</dc:creator>
				<category><![CDATA[Software development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[platforms]]></category>
		<category><![CDATA[programming languages]]></category>
		<category><![CDATA[scala]]></category>

		<guid isPermaLink="false">http://www.monomorphic.org/wordpress/?p=391</guid>
		<description><![CDATA[Today, Java is one of the most popular programming languages. Introduced in 1995, it rests on a tripod of the language itself, its libraries, and the JVM. In the TIOBE programming language league charts, it has been at the top for as long as the measurements have been made (since 2002), overtaken by C only [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.monomorphic.org/wordpress/wp-content/uploads/2009/11/creative.jpg"><img class="aligncenter size-medium wp-image-401" title="creative" src="http://www.monomorphic.org/wordpress/wp-content/uploads/2009/11/creative-225x300.jpg" alt="creative" width="225" height="300" /></a></p>
<p>Today, Java is one of the most popular programming languages. Introduced in 1995, it rests on a tripod of the language itself, its libraries, and the JVM. In the <a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html">TIOBE programming language league charts</a>, it has been at the top for as long as the measurements have been made (since 2002), overtaken by C only for a brief period due to measurement irregularities.</p>
<p>Yet not all is <a href="http://www.sun.com/">Sun</a>-shine in Java world. Sun Microsystems is about to be taken over by Oracle, pending EU approval. (EU is really dragging its feet in this matter but it seems unlikely they would really reject the merger). Larry Ellison has voiced strong support for Java and for Sun&#8217;s way of developing software, so maybe this is really not a threat by itself. But how far can the language itself go?</p>
<p>The Java language was carefully designed to be relatively easy to understand and work with. James Gosling, its creator, has <a href="http://www.computer.org/portal/web/csdl/doi/10.1109/2.587548">called it a blue collar language</a>, meaning it was designed for industrial, real world use. In a world where C++ was the de facto standard for OO programming, Java was a big step forward in terms of ease of development, with its lack of pointers and strong type system &#8211; to say nothing of its garbage collection. Many classes of common programming errors were removed altogether. However, in the interests of simplicity and clarity, some tradeoffs were made. The language&#8217;s detractors today point to problems such as excessive verbosity, the lack of closures, the limited generics, and the checked exceptions.</p>
<p>For some time there has been a lot of exciting alternative languages available on the JVM. Clojure is a Lisp dialect. Scala, the only non-Java JVM language I have used extensively, mixes the functional and object oriented paradigms. Languages like JPython and JRuby basically exist to allow scripting and interoperability with popular scripting languages on the JVM.</p>
<p>Today it seems as if the JVM and the standardized libraries will be Java&#8217;s most prominent legacy. The language itself will not go away for a long time either &#8211; considering that many companies still maintain or develop in languages like Cobol and Fortran, we will probably be maintaining Java code 30 years from now (what a sad thought!), but newer and more modern JVM languages will probably take turns being number one. The JVM and the libraries guarantee that we will be able to mix them relatively easily anyway, unless they stray too far from the standard with their custom features.</p>
<p>So in hindsight, developing this intermediate layer, this virtual machine &#8211; and disseminating it so widely &#8211; Â was a stroke of genius. Will it be that in future programming models we have even more standardized middle layers, and not just one?</p>
<p>Meanwhile, there&#8217;s a lot of debate about the process being used to shape and define Java. For a long time, Sun employed something called the Java Community Process, JCP, which was supposed to ensure openness. Some people <a href="http://www.jroller.com/scolebourne/entry/no_more_java_7">proclaim</a> that the openness has ended. To take one example, very recently, Sun announced that there will be support for closures in Java 7, after first announcing that there would be no support for closures in Java 7. The process by which this decision has been managed has been <a href="http://blogs.tedneward.com/2009/11/19/Closures+Are+Back+Again.aspx">described as</a> not being a community effort. Some aspects of Java are definitely up in the air these days.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.monomorphic.org/wordpress/where-is-java-going/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An unusual Java construct</title>
		<link>http://www.monomorphic.org/wordpress/an-unusual-java-construct/</link>
		<comments>http://www.monomorphic.org/wordpress/an-unusual-java-construct/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 09:11:08 +0000</pubDate>
		<dc:creator>johan</dc:creator>
				<category><![CDATA[Software development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming languages]]></category>

		<guid isPermaLink="false">http://www.monomorphic.org/wordpress/?p=215</guid>
		<description><![CDATA[I now break the longstanding tradition of not posting code on this blog. I just wanted to share what I believe to be a somewhat unusual pattern in Java: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 public IMethod findMethod&#40;String name, String&#91;&#93; types&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>I now break the longstanding tradition of not posting code on this blog. I just wanted to share what I believe to be a somewhat unusual pattern in Java:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> IMethod findMethod<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name, <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> types<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		outer<span style="color: #339933;">:</span>
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>IMethod m<span style="color: #339933;">:</span> m_methods<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>m.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
				<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>IType t<span style="color: #339933;">:</span> m.<span style="color: #006633;">getArgList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTypes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> t.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>types<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
					<span style="color: #009900;">&#123;</span>
						<span style="color: #000000; font-weight: bold;">continue</span> outer<span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span>
					i<span style="color: #339933;">++;</span>
				<span style="color: #009900;">&#125;</span>
				<span style="color: #000000; font-weight: bold;">return</span> m<span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>On line 2, there&#8217;s a label <tt>outer:</tt> which identifies a location in the code. Normally this feature is used with keywords like the <a href="http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html">hotly debated</a> <tt>goto</tt> in C. Java has <tt>goto</tt> as a keyword, but doesn&#8217;t support the feature. However, you can still use the labels with statements like <tt>continue</tt> above (line 12), which in this case starts a new iteration of the outer loop rather than the inner one.</p>
<p>I can&#8217;t remember ever having had to use this feature of any C-like language before (perhaps once) so it was intriguing when it popped up. It&#8217;s possible that a neater implementation of this would put the inner loop in a <tt>matchesSignature</tt> method in the <tt>IMethod</tt> interface instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.monomorphic.org/wordpress/an-unusual-java-construct/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
