<?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>Regular Geek &#187; java</title>
	<atom:link href="http://regulargeek.com/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://regulargeek.com</link>
	<description>Where programming, the internet and social media collide.</description>
	<lastBuildDate>Fri, 11 May 2012 12:56:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<cloud domain='regulargeek.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Is Object Serialization Evil?</title>
		<link>http://regulargeek.com/2011/07/06/is-object-serialization-evil/</link>
		<comments>http://regulargeek.com/2011/07/06/is-object-serialization-evil/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 15:00:22 +0000</pubDate>
		<dc:creator>Rob Diana</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[MarkLogic]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[Object-Relational Mapping]]></category>
		<category><![CDATA[RDBMS]]></category>
		<category><![CDATA[Serialization]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://regulargeek.com/?p=3353</guid>
		<description><![CDATA[In my daily work, I use both an RDBMS and MarkLogic, an XML database. MarkLogic can be considered akin to the newer NoSQL databases, but it has the added structure of XML and standard languages in XQuery and XPath. The NoSQL databases are typically storing documents or key-value pairs, and some other things in between. Given [...]]]></description>
			<content:encoded><![CDATA[<p>In my daily work, I use both an <a class="zem_slink" title="Relational database management system" href="http://en.wikipedia.org/wiki/Relational_database_management_system" rel="wikipedia">RDBMS</a> and <a class="zem_slink" title="MarkLogic" href="http://www.marklogic.com/" rel="homepage">MarkLogic</a>, an <a class="zem_slink" title="XML" href="http://en.wikipedia.org/wiki/XML" rel="wikipedia">XML</a> database. MarkLogic can be considered akin to the newer <a class="zem_slink" title="NoSQL" href="http://en.wikipedia.org/wiki/NoSQL" rel="wikipedia">NoSQL</a> databases, but it has the added structure of XML and standard languages in <a class="zem_slink" title="XQuery" href="http://www.w3.org/XML/Query/" rel="homepage">XQuery</a> and <a class="zem_slink" title="XPath" href="http://en.wikipedia.org/wiki/XPath" rel="wikipedia">XPath</a>. The NoSQL databases are typically storing documents or key-value pairs, and some other things in between. Given that any datastore will be searched at some point, you will always care how the data is actually stored or whether there is some way to query it easily. Once you start thinking about the problem, you quickly generalize to the &#8220;how do I persist any type of data&#8221; question. However, my focus is not going to be the comparison of the various data stores, but the comparison of how data is stored. More specifically, I want to show the <a class="zem_slink" title="Serialization" href="http://en.wikipedia.org/wiki/Serialization" rel="wikipedia">object serialization</a>, mainly the <a class="zem_slink" title="Java (programming language)" href="http://www.oracle.com/technetwork/java/" rel="homepage">Java</a> built in method, as a data persistence format is evil.</p>
<p>Given what you normally read on this blog, this may seem like an oddly timed post, but I have run into serialization issues lately in some production code and <a href="http://www.markhneedham.com/blog/2011/06/26/coding-light-weight-wrapper-vs-serialisationdeserialisation/" target="_blank">Mark Needham recently wrote an interesting post</a> about this as well. Coincidentally, Mark is also working with MarkLogic, and there is an interesting item in his post:</p>
<blockquote><p>The advantage of doing things this way [using lightweight wrappers] is that it means we have less code to write than we would with the serialisation/deserialisation approach although it does mean that we’re strongly coupled to the data format that our storage mechanism uses. However, since this is one bit of the architecture which is not going to change it seems to makes sense to accept the leakage of that layer.</p></blockquote>
<p>The interesting part of this is that he has accepted using the data format of the storage mechanism, XML in MarkLogic in this case. Why is this interesting? First, it is a move away from the <a class="zem_slink" title="Object-relational mapping" href="http://en.wikipedia.org/wiki/Object-relational_mapping" rel="wikipedia">ORM</a> technologies that try to hide the complexities of converting data into objects in the RDBMS world. Also, this is a glimpse into the types of issues that could arise from non-RDBMS storage choices as well as how to persist objects in general.</p>
<p>So, an RDBMS is typically used to map object attributes to a table and columns. The mapping is mostly straightforward with some defined relationship for child objects and collections. This is a well-known area, called <a class="zem_slink" title="Object-relational mapping" href="http://en.wikipedia.org/wiki/Object-relational_mapping" rel="wikipedia">Object-Relational Mapping</a> (ORM), and several open source and commercial options exist. In this scenario, object attributes are stored in a similar datatype, meaning a String is stored as a varchar and an int is stored as an integer. But, what happens when you move away from an RDBMS for data persistence?</p>
<p>If you look at Java and its session objects, pure object serialization is used. Assuming that an application session is fairly short-lived, meaning at most a few hours, object serialization is simple, well supported and built into the Java concept of a session. However, when the data persistence is over a longer period of time, possibly days or weeks, and you have to worry about new releases of the application, serialization quickly becomes evil. As any good Java developer knows, if you plan to serialize an object, even in a session, you need a real serialization ID (serialVersionUID), not just a 1L, and you need to implement the Serializable interface. However, most developers do not know the real rules behind the Java deserialization process. If your object has changed, more than just adding simple fields to the object, it is possible that Java cannot deserialize the object correctly even if the serialization ID has not changed. Suddenly, you cannot retrieve your data any longer, which is inherently bad.</p>
<p>Now, may developers reading this may say that they would never write code that would have this problem. That may be true, but what about a library that you use or some other developer no longer employed by your company? Can you guarantee that this problem will never happen? The only way to guarantee that is to use a different serialization method.</p>
<p>What options do we have? Obviously, there are the NoSQL datastores but the actual object format is the relevant question not which solution to choose. Besides the obvious serialized object, some NoSQL datastores use <a class="zem_slink" title="JSON" href="http://json.org" rel="homepage">JSON</a> to store objects, MarkLogic uses XML and there are others that store just key-value pairs. Key-value pairs are typically a mapping of a text key to a value that is a serialized object, either a binary or textual format. So, that leaves us with XML, JSON and other textual formats.</p>
<p>One of the benefits of a structured format like XML or JSON is that they can be made searchable and provide some level of context. I have <a title="The Problem Is Not JSON Or XML, It Is About Data Context" href="http://regulargeek.com/2010/12/02/the-problem-is-not-json-or-xml-it-is-about-data-context/">talked about data formats before</a>, so I won&#8217;t go into a comparison again. However, do these types of formats avoid the issues that native Java object serialization has? This is really dependent upon what library you are using for serialization. Some libraries will deserialize an object without any issues regardless of whether the object field list has changed. Other libraries could have problems depending upon whether a serialized field exists in the target object, or there might not be solid support for collections (though that is doubtful at this point).</p>
<p>Given that even structured formats could have serialization issues, is the only safe path hand-coded mappings like those used by ORM tools? Some JSON and XML serialization tools use the same mapping methods as the ORM tools in order to avoid these problems. However, once you define these mappings, you are explicitly stating how an object gets translated. This explicit definition will require maintenance, but that is definitely cleaner than trying to trace down a serialization defect in some random stack trace.</p>
<p>So is implicit object serialization really worth the potential headaches? Or should we just consider it evil and never speak of it again?</p>
<div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" src="http://img.zemanta.com/zemified_e.png?x-id=f365d933-6a80-4fbc-94ea-5ab968c174ee" alt="Enhanced by Zemanta" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://regulargeek.com/2011/07/06/is-object-serialization-evil/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Problem Is Not JSON Or XML, It Is About Data Context</title>
		<link>http://regulargeek.com/2010/12/02/the-problem-is-not-json-or-xml-it-is-about-data-context/</link>
		<comments>http://regulargeek.com/2010/12/02/the-problem-is-not-json-or-xml-it-is-about-data-context/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 15:00:57 +0000</pubDate>
		<dc:creator>Rob Diana</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://regulargeek.com/?p=2642</guid>
		<description><![CDATA[There is an interesting discussion occurring regarding data transfer in web applications. The discussion has centered on the differences between JSON and XML in the JavaScript heavy sites. It started with Norm Walsh commenting on Twitter and Foursquare removing support for XML in their APIs. The basic idea of his post was that if you are [...]]]></description>
			<content:encoded><![CDATA[<p>There is an interesting discussion occurring regarding data transfer in web applications. The discussion has centered on the differences between <a class="zem_slink" title="JSON" rel="homepage" href="http://json.org">JSON</a> and <a class="zem_slink" title="XML" rel="wikipedia" href="http://en.wikipedia.org/wiki/XML">XML</a> in the <a class="zem_slink" title="JavaScript" rel="wikipedia" href="http://en.wikipedia.org/wiki/JavaScript">JavaScript</a> heavy sites. It started with <a href="http://norman.walsh.name/2010/11/17/deprecatingXML" target="_blank">Norm Walsh commenting on Twitter and Foursquare</a> removing support for XML in their <a class="zem_slink" title="Application programming interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/Application_programming_interface">APIs</a>. The basic idea of his post was that if you are using JavaScript, and you are only passing around atomic values or lists and hashes of atomic values, then JSON makes complete sense. He then talks about the difficulty of JSON when you need more context or you have mixed content. Overall, it was a very sensible post. The discussion  gained steam because of Norm&#8217;s &#8220;Meh&#8221; reaction, and because talking about &#8220;which is the better technology&#8221; tends to get people all riled up.</p>
<p>A few days after Norm&#8217;s post, two other posts appeared refuting his stance even though in many comments it is considered a non-debate. First, <a href="http://digitalbazaar.com/2010/11/22/json-vs-xml/" target="_blank">Manu Sporny talked about the move to JSON being more of a paradigm shift</a> to simpler markup. The complaints about <a class="zem_slink" title="SOAP" rel="wikipedia" href="http://en.wikipedia.org/wiki/SOAP">SOAP</a> and XML Schemas are obvious, but he complicates the argument by introducing <a href="http://json-ld.org/" target="_blank">JSON-LD</a> into the conversation. JSON-LD introduces syntax for JSON to denote <a class="zem_slink" title="Linked Data" rel="wikipedia" href="http://en.wikipedia.org/wiki/Linked_Data">LinkedData</a>, and there is notation very similar to XML Namespaces, to which Norm replies &#8220;Wow. By the time you start doing that, you’re sure you wouldn’t be better with a richer markup vocabulary?&#8221; Lastly, <a href="http://blog.jclark.com/2010/11/xml-vs-web_24.html" target="_blank">James Clark throws his opinion</a> into the mix. His commentary is more about the fact that XML is losing web developers which could be a bad thing.</p>
<p>Now that you have the background story, I wanted to state that people are missing Norm Walsh&#8217;s original point. This problem is about context and it is not really being treated that way. People are using JSON for web development because there is almost zero learning curve. It is used because of the increasing trend of JavaScript heavy sites to drive interactivity and some of the mashup creativity. Because Twitter&#8217;s is readily available, people have created widgets to display their tweets on a web page. For many web developers that means grabbing a JSON representation of some tweets and converting it to <a class="zem_slink" title="HTML" rel="wikipedia" href="http://en.wikipedia.org/wiki/HTML">HTML</a>. This process barely takes longer than trying to find the correct API documentation.</p>
<p>In this same context, if the APIs are XML based you then need something to parse the XML into an appropriate JavaScript object. You can already tell that this is getting more complicated than simple JSON. To make matters worse, past browsers handled XML differently and sometimes very poorly. Because web developers were depending on the XML support in the browser, the problems of cross-browser support arose again. Obviously, developers do not want to go down that path and JSON is easier anyway.</p>
<p>However, what if you are using <a class="zem_slink" title="PHP" rel="homepage" href="http://www.php.net/">PHP</a> or Java on the server? PHP has plenty of XML handling libraries, with <a class="zem_slink" title="SimplePie" rel="homepage" href="http://simplepie.org/">SimplePie</a> being a hugely popular <a class="zem_slink" title="RSS" rel="wikipedia" href="http://en.wikipedia.org/wiki/RSS">RSS feed</a> processing library. If you can make the Twitter API call from your Java server code, there are plenty of libraries for handling XML there as well. So, in that context XML may be a better option.</p>
<p>If you look at the type of problem, this could also change the data format. In the Twitter API example, if you have a simple widget that just displays tweets, then a solution based on JavaScript and JSON makes a lot of sense. What if that widget needed to be more dynamic? For example, let&#8217;s say that someone registered on your site will see those tweets displayed differently and there are additional links in the tweet for replying or retweeting. You could write some JavaScript code to just check for registered users and generate different HTML, but this gets unwieldy if the number of different displays grows beyond 2 or 3. If the data is in XML, then you can write different <a class="zem_slink" title="XSLT" rel="wikipedia" href="http://en.wikipedia.org/wiki/XSLT">XSLT</a> scripts for each display which remains separate from the main widget code. You just need to select the appropriate XSLT based on the user interacting with the site. At this point people are likely going to complain about the use of SOAP for web services and its complexity. Let&#8217;s ignore that option as REST has won, and SOAP is overly complex, can we agree on that and move on?</p>
<p>As with any programming problem, different requirements and different contexts may call for different technologies. If you get stuck on saying that JSON is better than XML (or the other way around), you lose another tool in your toolbox.</p>
<p>The other context that people are missing is why Twitter and Foursquare chose to support JSON only. This is likely a question of application complexity and analytics. Like any good API provider, Twitter is probably tracking all calls to the API and this includes the data format requested. It is very possible that the demand for XML was fairly low and it did not warrant separate support. In addition to this, there are plenty of JSON processing libraries available for mainstream languages like Java, so there was little risk in dropping support for XML. If there is no support for XML, then their API becomes simpler to support. That means less code to maintain, simpler maintenance of code because there are not multiple representations of one set of data, and fewer questions about the different formats.</p>
<p>So, quit whining about whose data format is better. Each one is better in a different context, otherwise it is highly unlikely that they would have become so popular. The important thing is to learn both formats, and other popular ones that appear, that way you can make an educated decision on which format to use in your situation.</p>
<div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" src="http://img.zemanta.com/zemified_e.png?x-id=1445a73d-7239-49b5-b55a-59d87d6a60e1" alt="Enhanced by Zemanta" /></a><span class="zem-script more-related"></span></div>
]]></content:encoded>
			<wfw:commentRss>http://regulargeek.com/2010/12/02/the-problem-is-not-json-or-xml-it-is-about-data-context/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Development Concerns Moving Away From The Controller</title>
		<link>http://regulargeek.com/2010/11/30/development-concerns-moving-away-from-the-controller/</link>
		<comments>http://regulargeek.com/2010/11/30/development-concerns-moving-away-from-the-controller/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 17:04:43 +0000</pubDate>
		<dc:creator>Rob Diana</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Cassandra]]></category>
		<category><![CDATA[Hadoop]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[PowerBuilder]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[visual basic]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[web services]]></category>

		<guid isPermaLink="false">http://regulargeek.com/?p=2623</guid>
		<description><![CDATA[For many years, people have been concerned with how applications were structured. This concept became very popular with the client-server applications built with tools like PowerBuilder and Visual Basic. In the late 1990&#8242;s, there was a move towards 3-tier applications (client, middleware and server) as web development first started to take hold. As developers started [...]]]></description>
			<content:encoded><![CDATA[<p>For many years, people have been concerned with how applications were structured. This concept became very popular with the client-server applications built with tools like <a class="zem_slink" title="PowerBuilder" rel="homepage" href="http://www.sybase.com/products/internetappdevttools/powerbuilder">PowerBuilder</a> and <a class="zem_slink" title="Visual Basic" rel="homepage" href="http://msdn.microsoft.com/en-us/vbasic/default.aspx">Visual Basic</a>. In the late 1990&#8242;s, there was a move towards 3-tier applications (client, middleware and server) as web development first started to take hold. As developers started to see issues with basic <a class="zem_slink" title="Computer-generated imagery" rel="wikipedia" href="http://en.wikipedia.org/wiki/Computer-generated_imagery">CGI</a> programming, the Model-View-Controller designs started to take shape as programmers tried to separate the concerns of each component in the application. As web development evolved, the need for web services (SOAP, <a class="zem_slink" title="Representational State Transfer" rel="wikipedia" href="http://en.wikipedia.org/wiki/Representational_State_Transfer">REST</a> and anything else) was obvious. Mobile web development is having similar effects on programming, but the focus is not on application architecture.</p>
<p>I have started to see some development trends recently, one that makes complete sense to me and another that took me by surprise even though I should have connected the dots. I am not the only person seeing these trends either. <a href="http://radar.oreilly.com/2010/11/free-to-choose-ebook-deal-reve.html" target="_blank">O&#8217;Reilly posted a list of the top books</a> from a cyber-monday promotion, and the trends should be fairly obvious:</p>
<ol>
<li><a href="http://www.amazon.com/gp/product/0596802358?ie=UTF8&amp;tag=spogee-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0596802358">Data Analysis with Open Source Tools</a><img style="border: none !important; margin: 0px !important;" src="http://regulargeek.com/wordpress/wp-content/uploads/2010/11/irtspogee-20amplas2ampo1ampa0596802358" border="0" alt="" width="1" height="1" /></li>
<li><a href="http://www.amazon.com/gp/product/1449382673?ie=UTF8&amp;tag=regulargeek-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=1449382673">Head First Python</a><img style="border: none !important; margin: 0px !important;" src="http://regulargeek.com/wordpress/wp-content/uploads/2010/11/irtregulargeek-20amplas2ampo1ampa1449382673" border="0" alt="" width="1" height="1" /></li>
<li>HTML5 Mobile Web Development (O&#8217;Reilly <a href="http://training.oreilly.com/html5mobile/">Training</a> and <a href="http://oreilly.com/catalog/0636920015109/">Video</a>)</li>
<li><a href="http://www.amazon.com/gp/product/0596806752?ie=UTF8&amp;tag=regulargeek-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0596806752">JavaScript Patterns</a><img style="border: none !important; margin: 0px !important;" src="http://regulargeek.com/wordpress/wp-content/uploads/2010/11/irtregulargeek-20amplas2ampo1ampa0596806752" border="0" alt="" width="1" height="1" /></li>
<li><a href="http://www.amazon.com/gp/product/0596805829?ie=UTF8&amp;tag=regulargeek-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0596805829">REST in Practice</a><img style="border: none !important; margin: 0px !important;" src="http://regulargeek.com/wordpress/wp-content/uploads/2010/11/irtregulargeek-20amplas2ampo1ampa0596805829" border="0" alt="" width="1" height="1" /></li>
<li><a href="http://www.amazon.com/gp/product/0596808321?ie=UTF8&amp;tag=regulargeek-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0596808321">Making Software</a><img style="border: none !important; margin: 0px !important;" src="http://regulargeek.com/wordpress/wp-content/uploads/2010/11/irtregulargeek-20amplas2ampo1ampa0596808321" border="0" alt="" width="1" height="1" /></li>
<li><a href="http://www.amazon.com/gp/product/1449390412?ie=UTF8&amp;tag=regulargeek-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=1449390412">Cassandra: The Definitive Guide</a><img style="border: none !important; margin: 0px !important;" src="http://regulargeek.com/wordpress/wp-content/uploads/2010/11/irtregulargeek-20amplas2ampo1ampa1449390412" border="0" alt="" width="1" height="1" /></li>
<li><a href="http://www.amazon.com/gp/product/1449389732?ie=UTF8&amp;tag=regulargeek-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=1449389732">Hadoop: The Definitive Guide</a><img style="border: none !important; margin: 0px !important;" src="http://regulargeek.com/wordpress/wp-content/uploads/2010/11/irtregulargeek-20amplas2ampo1ampa1449389732" border="0" alt="" width="1" height="1" /></li>
<li><a href="http://www.amazon.com/gp/product/0596806027?ie=UTF8&amp;tag=regulargeek-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0596806027">HTML5: Up and Running</a><img style="border: none !important; margin: 0px !important;" src="http://regulargeek.com/wordpress/wp-content/uploads/2010/11/irtregulargeek-20amplas2ampo1ampa0596806027" border="0" alt="" width="1" height="1" /></li>
<li><a href="http://www.amazon.com/gp/product/0596158068?ie=UTF8&amp;tag=regulargeek-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0596158068">Learning Python</a><img style="border: none !important; margin: 0px !important;" src="http://regulargeek.com/wordpress/wp-content/uploads/2010/11/irtregulargeek-20amplas2ampo1ampa0596158068" border="0" alt="" width="1" height="1" /></li>
</ol>
<p>So, we have 3 books about big data, 4 books about client-side web development and 2 about Python. The trend that makes sense to me is big data. With all of the web activity, ecommerce or social media, there is a ton of data floating around. This data is worth billions of dollars to marketing people, and we are already seeing that it can help in other segments like customer service and even charities. Even the known big data problems, like search and web analytics, are still fairly young technologies. For many years it has been difficult to gain experience working with big data, but the rise of social media and the application <a class="zem_slink" title="Application programming interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/Application_programming_interface">APIs</a> have given almost any programmer free access to larger amounts of data to play with.</p>
<p>The other trend that I was not paying attention to was client-side development. I had seen all the pieces falling into place but did not put everything together. The pieces are JavaScript frameworks like <a class="zem_slink" title="JQuery" rel="homepage" href="http://jquery.com/">JQuery</a> and YUI, RESTful web services and HTML5. Taken separately, they are all very useful technologies. If you put them together, you get a very interesting web application platform that is very different than the traditional <a class="zem_slink" title="Model–View–Controller" rel="wikipedia" href="http://en.wikipedia.org/wiki/Model%E2%80%93View%E2%80%93Controller">MVC model</a>. Today, this may seem obvious, but because of the traditional separation between client and server programming, the evolution occurred in parallel. REST and the proliferation of application APIs really made AJAX calls become much more interesting than simple auto-suggest text boxes. The combination RESTful web services and a JavaScript framework allowed web developers to create real dynamic content from various web applications, like Twitter widgets, RSS widgets and others. HTML5 will make these dynamic capabilities even more interesting.</p>
<p>Is this all saying that MVC is dead? Not exactly, MVC is just evolving. First, the model and view are still very much present, as the model is only changing from a Java object to a text-based object in JSON or XML. Obviously the view still exists, it is just being built dynamically, and potentially rebuilt based on user interaction. The controller is the part that is really changing because of the benefits of web services. If you look at <a class="zem_slink" title="Spring Framework" rel="homepage" href="http://www.springsource.org">Spring MVC</a>, there is still a very strong coupling between the controller and the view. This coupling was due to the page-based model of web interaction. With RESTful web services, the web moved to a data-centric model where pages are optional.</p>
<p>If you review the list of books again, you will see that Python is represented twice. This is not as obvious a trend as big data or client-side development, but it is still surprising for a list of top 10 books. I was surprised until I read why Python is in the list. In the O&#8217;Reilly post, there is a link to an <a href="http://radar.oreilly.com/2010/06/what-is-data-science.html" target="_blank">explanation of data science</a> (a very good read) and that article talks about the use of Python within the big data community. The reasoning is that data needs to be massaged or &#8220;conditioned&#8221; as the article states. When dealing with this type of unstructured activity, scripting languages are used widely. Ages ago, Perl was the language of choice for this type of thing, but in the past 10 years Python has grown significantly in popularity. In addition to its usage in big data and as a general glue language, Python is also being used for server code where Java has been the standard language.</p>
<p>If you put all of this together, this list of books is a very good sampling of web development&#8217;s future.</p>
<p><em>Disclosure: All book title links are Amazon affiliate links. If you buy something I will probably make a few pennies.</em></p>
<div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" src="http://img.zemanta.com/zemified_e.png?x-id=0ef18691-087a-4e52-a3f2-3d12150fd552" alt="Enhanced by Zemanta" /></a><span class="zem-script more-related"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://regulargeek.com/2010/11/30/development-concerns-moving-away-from-the-controller/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>For Enterprise Development, If Not Java Then What?</title>
		<link>http://regulargeek.com/2010/11/25/for-enterprise-development-if-not-java-then-what/</link>
		<comments>http://regulargeek.com/2010/11/25/for-enterprise-development-if-not-java-then-what/#comments</comments>
		<pubDate>Thu, 25 Nov 2010 12:58:32 +0000</pubDate>
		<dc:creator>Rob Diana</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[JavaServer Faces]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[Programming language]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://regulargeek.com/?p=2609</guid>
		<description><![CDATA[The Java is dead meme has resurfaced, this time the instigator is Mike Gualtieri from Forrester. Given his general premise of Java is dead for enterprise development, I find it odd that he basically starts with: Java is still a great choice for app dev teams that have developed the architecture and expertise to develop [...]]]></description>
			<content:encoded><![CDATA[<p>The Java is dead meme has resurfaced, this time the instigator is Mike Gualtieri from Forrester. Given his general premise of <a href="http://blogs.forrester.com/mike_gualtieri/10-11-23-java_is_a_dead_end_for_enterprise_app_development" target="_blank">Java is dead for enterprise development</a>, I find it odd that he basically starts with:</p>
<blockquote><p>Java is still a great choice for app dev teams that have developed the architecture and expertise to develop and maintain business applications. It is also an excellent choice (along with C#) for software vendors to develop tools, utilities, and platforms such as <a class="zem_slink" title="Business process management" rel="wikipedia" href="http://en.wikipedia.org/wiki/Business_process_management">BPM</a>, CEP, IaaS, and ECP.</p></blockquote>
<p>He goes on to state that &#8220;Java development is too complex for business application development&#8221;. Depending on your point of view, I could agree with this, but some of his points just do not make any sense. &#8220;Business requirements have changed&#8221;, &#8220;Development authoring is limited to programming languages&#8221;, &#8220;Java frameworks prove complexity&#8221; and &#8220;Java has never been the only fame in town&#8221; really talk more to the state of software than any criticism of Java itself. My favorite point is &#8220;Java is a 20 year old language based on C++&#8221;, so obviously it is not suited for enterprise applications. That is like saying C++ is a 30 year old language based on C and meaning that it is not suitable for writing an operating system or a game. What does one have to do with the other? There are two points that do make an interesting case for the future of Java:</p>
<ul>
<li><strong>Java bungled the presentation layer. </strong>Swing is a nightmare and <a class="zem_slink" title="JavaFX" rel="homepage" href="http://javafx.com/">JavaFX</a> is a failure. <a class="zem_slink" title="JavaServer Faces" rel="wikipedia" href="http://en.wikipedia.org/wiki/JavaServer_Faces">JSF</a> was designed for pre-Ajax user interfaces even though some implementations such as <a class="zem_slink" title="ICEfaces" rel="homepage" href="http://www.icefaces.org">ICEfaces</a> incorporate Ajax. There is a steady stream of new UI approaches reflecting Java lack of leadership in in the presentation layer.</li>
<li><strong>Java’s new boss is the same as the old boss. </strong>Oracle’s reign is unlikely to transform Java.Oracle’s recent Java <a href="http://www.oracle.com/us/technologies/java/index.html" target="_blank">announcements</a> were a disappointment. They are focused on more features, more performance, and more partnerships with other vendors. So far, it appears that Oracle is continuing with Sun’s same failed Java policies.</li>
</ul>
<p>Java and presentation were never a happy couple. Thankfully, <a class="zem_slink" title="Abstract Window Toolkit" rel="wikipedia" href="http://en.wikipedia.org/wiki/Abstract_Window_Toolkit">AWT</a> was not even mentioned. Oracle&#8217;s stewardship of Java has not started well, though I am sure things will get better. The long term question is still there, what innovations can really be added without being obviously bolted onto the language? There is another way to look at this as well. What if we ignore these two issues? If Java did not change and people could only add features if they build there own library, would that make a big difference to people? Java is a fairly mature language, and does not really need additional core features. Cool features could be added through other frameworks, which would mean that the long-term leadership would not really matter.</p>
<p>The presentation layer has long been separated from Java in terms of actual implementation, so that is not a real concern either. Many application user interfaces are being developed within a browser, and this trend will likely continue with HTML5. There is also a trend moving the control of the application into the browser as well. What this means is that the server is just a collection of web services (REST or otherwise) that serve data in some predetermined format. This data is then rendered into the pages based on whatever the action was mean to accomplish. Granted, this trend is a topic for another day, but from the server perspective, and enterprise applications, it has very interesting implications.</p>
<p>So, if the server application is just a collection of web services that serve data in <a class="zem_slink" title="JSON" rel="homepage" href="http://json.org">JSON</a> or XML, what language do they need to be written in? In reality it does not matter, and this is a good reason to wonder if Java can maintain its leadership in the enterprise. Ruby and Python have been gaining developer mindshare for years based on their popularity for web development. They are also great glue languages, which means that enterprise developers may be using them outside of the enterprise applications already. C++ and C# are obvious alternatives for Java on the server as well, and Perl is still a very viable option especially when you remove the presentation concerns. Basically, any language that can be executed by a server that responds to HTTP requests is an option in the web services scenario.</p>
<p>Is Java dead for enterprise applications? Obviously not, and until something significant changes, it is still a very good option for people to use. Should Java be concerned about the growth of other languages and the simplicity and platform-independence of using web services? Absolutely.</p>
<div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" src="http://img.zemanta.com/zemified_e.png?x-id=4056d661-704a-4172-996c-3c237d016b7f" alt="Enhanced by Zemanta" /></a><span class="zem-script more-related"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://regulargeek.com/2010/11/25/for-enterprise-development-if-not-java-then-what/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Simple Tips For Clean Memory Management In Java</title>
		<link>http://regulargeek.com/2010/02/04/simple-tips-for-clean-memory-management-in-java/</link>
		<comments>http://regulargeek.com/2010/02/04/simple-tips-for-clean-memory-management-in-java/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 12:45:27 +0000</pubDate>
		<dc:creator>Rob Diana</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[Garbage collection]]></category>
		<category><![CDATA[Memory management]]></category>

		<guid isPermaLink="false">http://regulargeek.com/?p=1465</guid>
		<description><![CDATA[The other day I was asked how much I knew about Java garbage collection. I am not a performance guru, so I admitted that I knew very little, basically only that it works. As the conversation continued, I realized that while I did not know much about the internals of the garbage collection mechanism, I [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I was asked how much I knew about <a class="zem_slink" title="Java (programming language)" rel="homepage" href="http://java.sun.com">Java</a> <a class="zem_slink" title="Garbage collection (computer science)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29">garbage collection</a>. I am not a performance guru, so I admitted that I knew very little, basically only that it works. As the conversation continued, I realized that while I did not know much about the internals of the garbage collection mechanism, I did know a few things what it did.</p>
<p>First, a quick refresher on how garbage collection works in theory. You continuously create objects in Java, but at some point the memory needs to be cleaned up. Generally, if you create objects within a method, those objects may be garbage collected when the method has completed. Another important point is that if you keep passing objects around to various other classes and methods, those objects will only be garbage collected when there are no longer any references to them. Sometimes the garbage collector will clean more aggressively if you start using large amounts of memory as well. Granted, this is a simplification of the way garbage collection really works, but it gives us some basic ideas on how to keep your java application running smoothly without those weird OutOfMemory errors.</p>
<p><strong>Do not create a lot of objects</strong>. This sounds silly, but a surprising number of issues can be resolved by limiting the number of objects that get created. Think of it a different way. If we have a reporting application, are you going to create objects for every row of data in a report? If your application has a lot of reports each having thousands of rows, that is a lot of objects to create.</p>
<p><strong>Create objects only when you need them</strong>. If you do need to hold onto a lot of data, does it make sense to create thousands of objects? Can you just pass around a list of ids or a small hashmap? This is similar to the concepts of <a class="zem_slink" title="Lazy loading" rel="wikipedia" href="http://en.wikipedia.org/wiki/Lazy_loading">lazy loading</a> data from a database when you are dealing with persistence frameworks. Why load an entire object when just the id will suffice?</p>
<p><strong>Close all files and streams</strong>. This is probably one of the most common issues when it comes to <a class="zem_slink" title="Memory management" rel="wikipedia" href="http://en.wikipedia.org/wiki/Memory_management">memory management</a> in Java. Sometimes you just miss closing the file because you are more concerned with the contents of the file. There are also times when your error handling takes a different path than the normal code and thus the file stays open. Just remember, finally is your friend.</p>
<p><strong>Do you copy lists or pass lists?</strong> This is a harder problem to deal with. If your lists are long and filled with large objects, you may want to avoid the overhead of copying the data in the list. However, if you continuously pass lists around, you are maintaining several references to the objects in that list. This could mean that those objects will not be garbage collected.</p>
<p>These are just some simple tips for clean memory management. In some cases, these issues are easy to avoid. In other cases, the amount of cleanup you need to do is rather annoying and easy to skip. A lot of frameworks, like Spring, will do a lot of the basic cleanup for you, especially in the areas of persistence. The real key is to keep this as simple as possible and to clean up as you go. Just because Java has automatic garbage collection does not mean you should make more trash.</p>
<div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/a333ae23-cda3-4f79-9d39-3db7fb28e5be/"><img class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_c.png?x-id=a333ae23-cda3-4f79-9d39-3db7fb28e5be" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://regulargeek.com/2010/02/04/simple-tips-for-clean-memory-management-in-java/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Can You Defend Your Technical Decisions?</title>
		<link>http://regulargeek.com/2009/12/07/can-you-defend-your-technical-decisions/</link>
		<comments>http://regulargeek.com/2009/12/07/can-you-defend-your-technical-decisions/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 13:17:20 +0000</pubDate>
		<dc:creator>Rob Diana</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[decisions]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[why]]></category>

		<guid isPermaLink="false">http://regulargeek.com/?p=1310</guid>
		<description><![CDATA[Some days, you have to search the news and various sites to find something interesting to write about. Other days, the topic appears in your email. Today, there was a blog post and an email that just fit nicely together. The email asked what being a software engineer was like, and I will answer that [...]]]></description>
			<content:encoded><![CDATA[<p>Some days, you have to search the news and various sites to find something interesting to write about. Other days, the topic appears in your email. Today, there was a blog post and an email that just fit nicely together. The email asked what being a software engineer was like, and I will answer that in a full post later this week but the blog post goes into one of those things all software engineers need to do. The post is about <a href="http://www.socialmediaexplorer.com/2009/12/07/the-most-important-question-is-why/" target="_blank">&#8220;The Most Important Question, Why?&#8221;</a> and comes from <a href="http://twitter.com/jasonfalls" target="_blank">Jason Falls</a> at <a href="http://www.socialmediaexplorer.com/" target="_blank">Social Media Explorer</a>. Jason is specifically talking about social media and business, and this quote should resonate with a lot of people:</p>
<blockquote><p>Too many times, especially when it comes to social media and technology, businesses flock to the hot new trend or the shiny new object with delusions of grandeur. Two years ago, clients would come to me and say, “I want a blog.” Today, they say, “I want a Facebook page,” or “I want a Twitter account.” My answer has always been the same: Why? Seldom can answer that question.</p></blockquote>
<p>As a software engineer, you need to ask yourself why almost every day. A software engineer needs to make technical decisions at almost every step in the development process. When the project is first in design, we may determine that the software will be developed in <a class="zem_slink" title="Java (programming language)" rel="homepage" href="http://java.sun.com">Java</a> and deployed to Apache and Tomcat servers. Why? Can you defend your reasons for picking Java and Tomcat? Does the application need to be deployed into a web infrastructure or does it make more sense as a desktop application? Can you defend your decision against someone that thinks the application should be written in Ruby?</p>
<p>In many cases, engineers may take the lazy route and just make decisions based on what they are comfortable with. In my case, that likely means Java on Tomcat. By taking the comfortable route, you may miss opportunities to make a better choice, or even learn new things.</p>
<p>In addition to the initial platform choices, there are several other things that need to be decided. If we are writing a web application, do we use traditional servlets, <a href="http://struts.apache.org/" target="_blank">Struts</a>, <a href="http://www.springframework.org" target="_blank">Spring</a> or some other framework? This is when the decisions start to get really interesting. Spring may be the best choice for your organization, but are your developers familiar with Spring? Maintenance is a significant concern for any development organization. If your developers can not maintain an application due to a lack of technical knowledge, you have failed as an organization. Sometimes, you may be able to get training on the newer technology, but other times you may have to choose the older but known technology. These decisions get fairly hairy as well because people tend to feel very strongly about their favorite frameworks.</p>
<p>Once the core framework is chosen, the persistence framework needs a direction. Sometimes this is guided by your core framework, but frameworks like Spring allow you to integrate almost anything. With Spring, you can easily integrate <a href="http://www.hibernate.org/" target="_blank">Hibernate</a>, <a href="http://ibatis.apache.org/" target="_blank">iBatis</a> or standard <a class="zem_slink" title="Java Database Connectivity" rel="wikipedia" href="http://en.wikipedia.org/wiki/Java_Database_Connectivity">JDBC</a>. You can also use <a href="http://java.sun.com/developer/technicalArticles/J2EE/jpa/" target="_blank">JPA</a> with any of those technologies as the JPA provider. Why you choose one persistence framework over another is highly dependent upon your organization and what you plan to do with your persistence layer. Hibernate is really good for straightforward data models that can easily be mapped to Java domain objects. iBatis allows you to customize your <a class="zem_slink" title="SQL" rel="wikipedia" href="http://en.wikipedia.org/wiki/SQL">SQL</a> fairly easily and allows great flexibility in your SQL. JDBC allows you to focus on the actual SQL without any of the quirks of the frameworks. JPA is considered the future of Java persistence, so it is a good technology to start working with.</p>
<p>This is really just the beginning of the decisions made on a project as well. There are various design decisions that are made every day that typically do not get questioned until a problem arises. You may be able to save yourself some time by questioning all of your decisions. Did you make the decision based on sound reasoning or did you make the same decision as you did last time because it is simpler to keep the same direction? Can you answer why? More importantly, can you explain why to your fellow engineers?</p>
<div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/9e0bdcbb-7b8a-4617-8ae4-951e484ef2cf/"><img class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_c.png?x-id=9e0bdcbb-7b8a-4617-8ae4-951e484ef2cf" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://regulargeek.com/2009/12/07/can-you-defend-your-technical-decisions/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>In A Surprising Ending, Oracle Buys Sun</title>
		<link>http://regulargeek.com/2009/04/21/in-a-surprising-ending-oracle-buys-sun/</link>
		<comments>http://regulargeek.com/2009/04/21/in-a-surprising-ending-oracle-buys-sun/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 12:03:21 +0000</pubDate>
		<dc:creator>Rob Diana</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[Sun Microsystems]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://regulargeek.com/?p=599</guid>
		<description><![CDATA[Image via CrunchBase By now you have heard that Oracle bought Sun. I did not want to write about it yesterday as I wanted to sit and think about the effect this has on anything Sun related. There is some good high-level business analysis from Reuters as well. There is one important quote from that [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img">
<div>
<dl class="wp-caption alignright">
<dt class="wp-caption-dt"><a href="http://www.crunchbase.com/company/oracle"><img title="Image representing Oracle Corporation as depic..." src="http://www.crunchbase.com/assets/images/resized/0001/7825/17825v1-max-450x450.png" alt="Image representing Oracle Corporation as depic..." /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution">Image via <a href="http://www.crunchbase.com">CrunchBase</a></dd>
</dl>
</div>
</div>
<p>By now you have heard that <a href="http://www.centernetworks.com/oracle-to-acquire-sun-for-74-billion" target="_blank">Oracle bought Sun</a>. I did not want to write about it yesterday as I wanted to sit and think about the effect this has on anything <a href="http://www.sun.com" target="_blank">Sun</a> related. There is some good <a href="http://www.reuters.com/article/technologyNews/idUSN2038153320090421?sp=true" target="_blank">high-level business analysis from Reuters</a> as well. There is one important quote from that article that needs sharing:</p>
<blockquote><p>Sun was more comfortable striking a deal with Oracle because the two operate complementary rather than overlapping businesses, and antitrust roadblocks are less likely.</p></blockquote>
<p>This is probably the most significant difference between an <a href="http://www.oracle.com" target="_blank">Oracle</a> and <a class="zem_slink" title="IBM" rel="homepage" href="http://www.ibm.com">IBM</a> deal for Sun. This deal also gets Oracle into the hardware game without having to buy a lesser player. However, the software side of this deal is much more interesting.</p>
<h3>Java</h3>
<p>So, what happens to Java? Hopefully nothing. The JCP exists in order to take real ownership out of the hands of one entity anyway. Oracle also has a lot of interest in keeping Java alive and well. We may see a renewed push for all things data related in Java now that Oracle is a much more important player in that space.</p>
<h3><span class="zem_slink">NetBeans</span></h3>
<p>Oracle already has a tool called <a class="zem_slink" title="JDeveloper" rel="homepage" href="http://www.oracle.com/technology/products/jdev/index.html">JDeveloper</a> that technically competes with <a href="http://www.netbeans.org/" target="_blank">NetBeans</a>. Up until recently, both tools were considered terrible by many people with only Eclipse and <a class="zem_slink" title="IntelliJ IDEA" rel="homepage" href="http://www.jetbrains.com/idea/">IntelliJ</a> considered as decent java development environments. However, the recent versions of NetBeans have been reviewed well, so Oracle could have upgraded their java tools as a bonus.</p>
<h3><a class="zem_slink" title="MySQL" rel="homepage" href="http://www.mysql.com">MySQL</a></h3>
<p>This is the big question in this deal. MySQL is used almost everywhere as a free alternative to the expensive commercial <a class="zem_slink" title="Relational database" rel="wikipedia" href="http://en.wikipedia.org/wiki/Relational_database">RDBMS</a>. MySQL is used as the backbone of <a class="zem_slink" title="WordPress" rel="homepage" href="http://wordpress.org">WordPress</a> and many internet sites as well. Is there a danger that Oracle will neglect MySQL? Absolutely. Will that really happen? Absolutely not.</p>
<p>Oracle purchased an interesting business with MySQL. They can keep it open source, add on &#8220;premium&#8221; features that enterprise customers may want, and eventually push for upgrades to their enterprise offering of Oracle. In addition, they get some nice consulting and services deals out of this as well. If anything, this just makes Oracle&#8217;s database position much stronger. They have always had a problem getting smaller businesses to run on Oracle, and now they have something that almost anyone can run.</p>
<p>The main problem with Oracle buying MySQL is that there will definitely be work on a &#8220;more open source&#8221; version of MySQL. My understanding is that a fork of MySQL was started a while ago, but with Oracle now owning it, I am assuming that people will put more effort in an open source offering. I call this a problem because it just means that there will be yet another choice in the database game, and it is likely to confuse things a bit.</p>
<h3>Final Words</h3>
<p>Oracle is a big winner with this deal, mainly because of the hardware they have always coveted. However, there are two jewels in this deal, MySQL and the cloud services. I already talked about MySQL, but the cloud services that Sun has mentioned recently will be a big bonus for Oracle. Oracle is already working with cloud providers to have Oracle as a data storage choice, so owning their own cloud offering could be huge for them. They have always wanted an entire stack offering from hardware to database and middleware. Now they can offer that, and soon offer it in the form of cloud services. Oracle has just positioned themselves as a major player for the next few years.</p>
<div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/0132884b-3599-443f-a137-f19fe20a6224/"><img class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_c.png?x-id=0132884b-3599-443f-a137-f19fe20a6224" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://regulargeek.com/2009/04/21/in-a-surprising-ending-oracle-buys-sun/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tools For Unit Testing Java Web Applications</title>
		<link>http://regulargeek.com/2009/04/17/tools-for-unit-testing-java-web-applications/</link>
		<comments>http://regulargeek.com/2009/04/17/tools-for-unit-testing-java-web-applications/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 12:12:58 +0000</pubDate>
		<dc:creator>Rob Diana</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[cactus]]></category>
		<category><![CDATA[canoo webtest]]></category>
		<category><![CDATA[cobertura]]></category>
		<category><![CDATA[dbunit]]></category>
		<category><![CDATA[htmlunit]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[jwebunit]]></category>
		<category><![CDATA[Mock object]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[struts]]></category>
		<category><![CDATA[testng]]></category>
		<category><![CDATA[Unit testing]]></category>
		<category><![CDATA[watij]]></category>

		<guid isPermaLink="false">http://regulargeek.com/?p=591</guid>
		<description><![CDATA[As a java developer, I write unit tests all the time. There are a lot of ways to do this, but sometimes unit testing becomes difficult. This could be because you need to test a Struts action or you do not want your unit tests to hit your database. So, the question is what tools [...]]]></description>
			<content:encoded><![CDATA[<p>As a java developer, I write unit tests all the time. There are a lot of ways to do this, but sometimes unit testing becomes difficult. This could be because you need to test a <a class="zem_slink" title="Apache Struts" rel="homepage" href="http://struts.apache.org/1.x/">Struts</a> action or you do not want your unit tests to hit your database. So, the question is what tools can you use for testing java web applications? This is not meant as a complete and thorough overview, just some of the tools I know of or have looked into at some time. In many cases, you will find that your testing code is very repetitive, so you may end up building frameworks on top of these frameworks. I am sure I missed something or maybe even your favorite, so just leave me a comment.</p>
<p><strong>Basic Java Testing &#8211; </strong><a href="http://junit.org/" target="_blank">JUnit</a> and <a href="http://testng.org/" target="_blank">TestNG</a> are the most popular tools for basic java unit testing. JUnit typically has a small advantage as it has been around longer and is included with most packages of Eclipse. However, I do not think one is really better than the other, they are just different.</p>
<p><strong>Mock Objects</strong> &#8211; <a href="http://easymock.org" target="_blank">EasyMock</a> and <a href="http://www.jmock.org/" target="_blank">jMock</a> are popular mock objects frameworks. Sometimes you have to simulate the way another system works, and mock objects are perfect for this. You can even create your own mock object, but the frameworks make it easy to avoid extra code.</p>
<p><strong>Database Interaction</strong> &#8211; <a href="http://www.dbunit.org" target="_blank">DBUnit</a> is really the only decent framework I have seen. It allows you to insert data before the test is run and cleans up after the test is complete. However, capturing the appropriate data for a test is not simple for anything but the most trivial applications.</p>
<p><strong>User Interface Testing</strong> &#8211; UI testing is notoriously difficult and many applications skip it entirely. If you are testing your generated html, you will want to look at the following tools and determine which best suits your needs. This is a special case, as there is no &#8220;one true way&#8221; to test the user interface. These are all free tools as I am a fan of keeping things as cheap as possible if the tools are good enough.</p>
<ul>
<li><a href="http://seleniumhq.org/" target="_blank">Selenium</a> &#8211; Maybe the most complete package of the bunch and supports testing in IE, FireFox and Safari. Your unit tests are written in java, so you just need to learn the API. They also have interesting server options where you can run your tests across servers. You can even record tests using a FireFox add-on.</li>
<li><a href="http://webtest.canoo.com" target="_blank">Canoo WebTest</a> &#8211; This is another framework that can record tests with a FireFox add-on. The tests for WebTest are typically written in xml files. This gives you the option to build a library of fragments of functionality to include in various tests. You can also write your tests in Groovy or use the Java API directly. These can also be run directly from within Ant.</li>
<li><a href="http://watij.com/" target="_blank">Watij</a> &#8211; This is a port of the popular Ruby testing framework, Watir. The tests are written in Java using their API. They also include <a class="zem_slink" title="BeanShell" rel="homepage" href="http://www.beanshell.org/">BeanShell</a> so that you can interactively test your code. This is a really interesting option if you are not sure what a unit test should look like initially.</li>
<li><a href="http://jwebunit.sourceforge.net/" target="_blank">JWebUnit</a> &#8211; This is more of a meta-framework, where it can build upon <a class="zem_slink" title="HtmlUnit" rel="homepage" href="http://htmlunit.sourceforge.net/">HtmlUnit</a> or Selenium. HtmlUnit is fairly good by itself, but sometimes a framework is just too low-level for some people or people find that they keep doing the same things and decide to build upon the framework. There is one problem with JWebUnit, the documentation is very sparse, so the learning curve ciould be problematic.</li>
<li><a href="http://jakarta.apache.org/cactus/index.html" target="_blank">Cactus</a> &#8211; This is another meta-framework, but this is from Apache. It is meant as a wrapper for testing an entire application from basic java testing, servlet testing and down to the user interface testing. Due to this meta concept, the documentation can be a bit vague. However, I have heard good things from those people that spent the time to learn more. Disappointingly, I have not had the time to dive into it much.</li>
</ul>
<p>There are a lot of other tools out there as well. <a href="http://www.fitnesse.org/" target="_blank">FitNesse</a> is very popular, but it takes a very distinct approach to how unit tests are built. For Struts applications, there is a framework called <a href="http://strutstestcase.sourceforge.net/">StrutsTestCase</a> that is immensely helpful as well. For a big list of testing and related software, take a look at <a href="http://xprogramming.com/software.htm" target="_blank">XProgramming.com</a>. They list testing frameworks for almost every language. Lastly, it is always a good idea to know how well your software is tested. This is not a question of whether all of your tests pass, but how much of the code is actually tested. My favorite test code coverage tool is <a href="http://cobertura.sourceforge.net/" target="_blank">Cobertura</a>. It is fairly simple to use and the reports are generated in a similar manner to how JUnit generates reports.</p>
<p>So, if you know of a good free java testing tool, drop me a note in the comments. Sometimes a good tool may not be getting enough publicity or I may not have had time to look at it. In any case, keep testing until you have good test coverage. And remember the testing mantra, &#8220;Red, Green, Refactor&#8221; <img src='http://regulargeek.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/c780b124-11b1-46c0-8ae6-8f951aee29fe/"><img class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_c.png?x-id=c780b124-11b1-46c0-8ae6-8f951aee29fe" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://regulargeek.com/2009/04/17/tools-for-unit-testing-java-web-applications/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.565 seconds -->

