<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6896799837802490811</id><updated>2011-07-31T00:11:45.016-07:00</updated><title type='text'>Miles to code</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-1018629736981341781</id><published>2009-07-30T03:04:00.000-07:00</published><updated>2009-07-30T03:06:16.408-07:00</updated><title type='text'>Moving to WordPress</title><content type='html'>WordPress has built in code formatting (SyntaxHighlighter) so no more manual formatting of code. My new blog is &lt;a href="http://rahulj51.wordpress.com/"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;.&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-1018629736981341781?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/1018629736981341781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=1018629736981341781' title='37 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/1018629736981341781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/1018629736981341781'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2009/07/moving-to-wordpress.html' title='Moving to WordPress'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>37</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-3597787215473601297</id><published>2009-07-18T02:05:00.000-07:00</published><updated>2009-07-18T02:26:58.041-07:00</updated><title type='text'>Random thoughts</title><content type='html'>&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Slack&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Reading a book called &lt;a href="http://www.amazon.com/Slack-Getting-Burnout-Busywork-Efficiency/dp/0767907698"&gt;Slack&lt;/a&gt; by Tom DeMarco.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Very large text files processing&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you are dealing with very large text files, i.e. more than 500MB in size,  here are a few tips that might help&lt;br /&gt;&lt;ol&gt;&lt;li&gt;  On windows, use &lt;a href="http://www.textpad.com/"&gt;Textpad &lt;/a&gt;for viewing/editing files. It handles large files very well. Alternatively you can use unix utilities or cygwin if you are working on windows.&lt;/li&gt;&lt;li&gt;  Java doesn't handle large files very well. Consider using Perl or unix shell script. You will be amazed at the performance gains.&lt;/li&gt;&lt;li&gt;   If you need to save this to a database, consider a direct bulk copy using your database's load utility e.g. sqlldr (oracle) or bcp(sybase, ms-sql).&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Procrastinators logic: Cleaning your apartment is O(1) complexity&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;N being the number of days since you last cleaned your apartment, for small N,  the time taken, t, to clean your apartment will not vary much over N.&lt;br /&gt;&lt;br /&gt;This makes apartment cleaning an O(1) complexity algorithm.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-3597787215473601297?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/3597787215473601297/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=3597787215473601297' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/3597787215473601297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/3597787215473601297'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2009/07/random-thoughts.html' title='Random thoughts'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-4280374626784362960</id><published>2009-06-30T21:34:00.000-07:00</published><updated>2009-07-07T22:22:50.398-07:00</updated><title type='text'>Netbeans 6.7 is released. I am still not happy with "Go To File".</title><content type='html'>&lt;a href="http://www.netbeans.org/"&gt;Netbeans 6.7&lt;/a&gt; is released. &lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5353348938387075410" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 203px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_ZVTF1zKeSv0/SkrqfwdGsVI/AAAAAAAAADw/3GRuO-3DV-Y/s320/nb67.JPG" border="0" /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Despite "Improved search" as one of the features of the new release, the "Go To File" feature (Alt+Shift+O) is still as slow as the previous version. This is a bummer as I use this feature most often. In Netbeans, file search is either very slow or throws a &amp;lt;No Files Found &amp;gt; &lt;no&gt;&lt;no&gt;even when the file exists.&lt;/div&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5353350188138137538" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 199px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_ZVTF1zKeSv0/SkrrogI-h8I/AAAAAAAAAD4/pQRmTOs2pEM/s320/nb-gtf.JPG" border="0" /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Compare this with "Open Resource" (Ctrl + R) feature in Eclipse. Works like a charm and gives you a filtered list of all matching resources even before you've finished typing.&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5353350327466921618" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 266px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_ZVTF1zKeSv0/SkrrwnLjDpI/AAAAAAAAAEA/q3YIc5IY5OI/s320/ec-or.JPG" border="0" /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;--------&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-4280374626784362960?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/4280374626784362960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=4280374626784362960' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/4280374626784362960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/4280374626784362960'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2009/06/netbeans-67-is-released-i-am-still-not.html' title='Netbeans 6.7 is released. I am still not happy with &quot;Go To File&quot;.'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_ZVTF1zKeSv0/SkrqfwdGsVI/AAAAAAAAADw/3GRuO-3DV-Y/s72-c/nb67.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-6589055191322560465</id><published>2009-06-30T21:02:00.001-07:00</published><updated>2009-06-30T21:27:41.646-07:00</updated><title type='text'>Are you testing your units ?</title><content type='html'>Read a brilliant and very apt article on &lt;a href="http://sdk.org.nz/2009/02/25/why-unit-testing-is-a-waste-of-time/"&gt;Functional testing&lt;/a&gt; by &lt;a href="http://sdk.org.nz/author/tim/"&gt;Tim Sutherland&lt;/a&gt;.  The article makes a case of why functional testing is more important than unit testing in some applications specially those that do not have complex algorithms or &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;APIs&lt;/span&gt; in the code.&lt;br /&gt;&lt;br /&gt;The application I work on at my workplace is a case in point. It's a highly data centric, legacy,  &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;ETL&lt;/span&gt; application written in Java. Most of the code does not have any complex business logic that requires testing at a unit level. In fact it is the integration of the tiny java components and how they collaborate during run time that contributes to the complexity of the application. In the last 2 years that I have worked on this code, I have seen very few cases where a bug could have been caught during unit testing. Typically, most defects occur due to unexpected or bad data. &lt;br /&gt;&lt;br /&gt;In such cases, I strongly agree with the author of the above post that a small, carefully written set of functional tests is more useful than unit tests. We can run these tests nightly as part of continuous integration and also for smoke testing during every release.&lt;br /&gt;&lt;br /&gt;I do think, however, that at the unit level, a test driven approach might still be useful. So when I am writing, let's say, a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;DAO&lt;/span&gt;, I can write a few integration tests first for testing the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;DAO&lt;/span&gt;. Even in such cases, hard core unit testing (with mocking etc.) does not yield much benefits.  These tests could be reused later for low level integration testing of individual components. But they need not be run regularly as part of the continuous integration process to save time.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-6589055191322560465?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/6589055191322560465/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=6589055191322560465' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/6589055191322560465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/6589055191322560465'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2009/06/are-you-testing-your-units.html' title='Are you testing your units ?'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-9120077723046706697</id><published>2009-06-22T01:44:00.000-07:00</published><updated>2009-06-30T21:58:24.161-07:00</updated><title type='text'>Why isn't my unix sort working?</title><content type='html'>Gaah.Today I ran into a strange problem while running the 'sort' command on Unix. On running this command with the following input,&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:courier new;"&gt;AECS&lt;br /&gt;@ADS&lt;br /&gt;@AED&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;I was getting&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;@ADS&lt;br /&gt;AECS&lt;br /&gt;@AED&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;as the output. I was expecting the output to be&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;@ADS&lt;br /&gt;@AED&lt;br /&gt;AECS&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;It was as if the &lt;b&gt;'@'&lt;/b&gt; character in my input data was completely being ignored. This caused a long running data load process to fail due to wrong data as I was using sort and merge logic to eliminate duplicates and merge data from multiple files.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On seraching the internet, I found that the 'sort' command depends on locale to decide the ordering of characters. you can check the default locale by using the 'locale' command.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The solution to fix the above sort is to set LC_ALL to "C" before calling sort. "C" stands for collation locale.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&gt; export LC_ALL=C&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&gt; cat inputdata sort -s -T .&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Turns out that there are some other comands that depend on locale. Read more on this subject &lt;a href="http://dcsmail.anu.edu.au/pipermail/nauty-list/2004/000112.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-----------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-9120077723046706697?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/9120077723046706697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=9120077723046706697' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/9120077723046706697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/9120077723046706697'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2009/06/why-isnt-my-unix-sort-working.html' title='Why isn&apos;t my unix sort working?'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-2868064161026899574</id><published>2009-05-15T03:15:00.000-07:00</published><updated>2009-05-17T18:32:41.457-07:00</updated><title type='text'>Ruby on Rails</title><content type='html'>I attended a 2 day course on RoR during the Good Friday weekend. It was a beginners course.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;RoR has a lot of "magic" moments when you just click a few buttons and 'viola', it spews out a shiny new web application for you. Nothing hard core though as the "scaffolding" as it is called is only good for the very basic CRUD web apps.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On the other hand, I found very little information available on the net that could explain what was happening under the hoods. It is possible that I did not look in the right places, though.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I am now practicing the concepts by creating a simple effort tracking web application in my free time.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;---&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-2868064161026899574?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/2868064161026899574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=2868064161026899574' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/2868064161026899574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/2868064161026899574'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2009/05/ruby-on-rails.html' title='Ruby on Rails'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-2437947309810534161</id><published>2009-04-22T02:08:00.000-07:00</published><updated>2009-05-15T03:00:36.973-07:00</updated><title type='text'>Beware of ls --color on Unix</title><content type='html'>I ran into a ver interesting problem today.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span &gt;I was trying to redirect the output of the '&lt;strong&gt;ls&lt;/strong&gt;' command to a file.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;$ ls&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;1.dat 2.dat 3.dat&lt;br /&gt;$ ls &gt; log&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="font-family:georgia;font-size:100%;"&gt;To my surprise the output file contained lots of 'special' characters'.&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;$ vi log&lt;br /&gt;&lt;br /&gt;^[[00m^[[00m1.dat^[[00m^&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;[[00m2.dat^[[00m^&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;[[00m3.dat^[[00m^&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;[[00mlog^[[00m^[[m&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This was giving several errors in some other process that was using this file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After spending an hour on this problem, I figured out that the culprit was an '&lt;strong&gt;alias&lt;/strong&gt;' that had mapped '&lt;strong&gt;ls&lt;/strong&gt;' to '&lt;strong&gt;ls --color&lt;/strong&gt;'. This had caused the output to contain the escape sequences for colors.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The problem got resolved by unaliasing with '&lt;strong&gt;unalias ls&lt;/strong&gt;'.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-2437947309810534161?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/2437947309810534161/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=2437947309810534161' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/2437947309810534161'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/2437947309810534161'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2009/04/beware-of-ls-color-on-unix.html' title='Beware of ls --color on Unix'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-1345188718360223398</id><published>2009-04-03T03:35:00.000-07:00</published><updated>2009-04-03T03:39:10.464-07:00</updated><title type='text'>Java is verbose</title><content type='html'>While I had read and heard this several times, I never really understood till today what it meant when people said Java was verbose.&lt;br /&gt;&lt;br /&gt;Today, for the first time, I accept the veracity of this sad fact. Java is indeed very verbose; specially when compared to new languages.  Suddenly I can see how most of the code I write in java can be avoided.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-1345188718360223398?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/1345188718360223398/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=1345188718360223398' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/1345188718360223398'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/1345188718360223398'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2009/04/java-is-verbose.html' title='Java is verbose'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-4944535583180271681</id><published>2009-04-03T03:24:00.000-07:00</published><updated>2009-04-03T03:27:37.829-07:00</updated><title type='text'>Job ad trap</title><content type='html'>&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;Read this in a job ad recently.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;You may occasionally need to be on calls....some weekend work on production releases may be required , but no actual shift work.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;Take my advice. Don't fall into this trap. Not only will you work extra hours, you will not get compensated for it either. Negotiate for shift job.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-4944535583180271681?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/4944535583180271681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=4944535583180271681' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/4944535583180271681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/4944535583180271681'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2009/04/job-ad-trap.html' title='Job ad trap'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-2657311443466750880</id><published>2009-03-16T01:43:00.001-07:00</published><updated>2009-05-15T03:05:30.669-07:00</updated><title type='text'>Random thoughts</title><content type='html'>&lt;strong&gt;Epic Fail&lt;br /&gt;&lt;span style="FONT-WEIGHT: normal"&gt;Heard someone use the word 'Rightsizing' while referring to the lay offs. Yuck!!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Privacy&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I wonder if it's possible to maintain privacy while trying to run a successful small web based business?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;New language&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I decided to learn Scala and JavaFx. Having struggled with learning a new programming language many times in the past, I realized that my problem is that for a second language, I need a top-down approach instead of the bottom-up approach most programming books offer. Before I learn the dirty details of the syntax, I must grasp the big picture. I want to know how a language compares to Java which is my primary programming language. It is important for me to understand how a new language "does things" before I start learning the syntax. So I have decided to skim through the Scala book first without writing even a single line of code. I'll then give the book another read, this time for the syntax and other granular details. I think it is a good way to learn a second/third language.&lt;br /&gt;&lt;br /&gt;As for JavaFx, I am using the online course at &lt;a href="http://www.javapassion.com/"&gt;www.javapassion.com&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Architects&lt;/span&gt;&lt;br /&gt;The real reason why we need architects is that in many places (specially big organizations), programmers are not considered important or worthy enough to take any high level design decisions. Having an architect ensures that such decisions are at least coming from someone who has a technical background and experience required to make such decisions. Otherwise, such decisions are left in the hands of inept Project Managers. If there is an architect, project managers usually don’t poke their nose into technical discussions or decision making and leave it to the architect.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-2657311443466750880?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/2657311443466750880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=2657311443466750880' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/2657311443466750880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/2657311443466750880'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2009/03/random-thoughts.html' title='Random thoughts'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-2683599560079756518</id><published>2008-11-12T14:52:00.000-08:00</published><updated>2008-11-12T14:58:48.668-08:00</updated><title type='text'>Programming Problem 1 - Train Times</title><content type='html'>&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;The Problem&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;City transportation planners are developing a light rail transit system to carry commuters between the suburbs and the downtown area. Part of their task includes scheduling trains on different routes between the outermost stations and the metro center hub.&lt;br /&gt;&lt;br /&gt;Part of the planning process consists of a simple simulation of train travel. A simulation consists of a series of scenarios in which two trains, one starting at the metro center and one starting at the outermost station of the same route, travel toward each other along the route. The transportation planners want to find out where and when the two trains meet. You are to write a program to determine those results.&lt;br /&gt;&lt;br /&gt;This model of train travel is necessarily simplified. All scenarios are based on the following assumptions:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;    All trains spend a fixed amount of time at each station.&lt;/li&gt;&lt;li&gt;All trains accelerate and decelerate at the same constant rate. All trains have the same maximum possible velocity.&lt;/li&gt;&lt;li&gt;When a train leaves a station, it accelerates (at a constant rate) until it reaches its maximum velocity. It remains at that maximum velocity until it begins to decelerate (at the same constant rate) as it approaches the next station. Trains leave stations with an initial velocity of zero (0.0) and they arrive at stations with terminal velocity zero. Adjacent stations on each route are far enough apart to allow a train to accelerate to its maximum velocity before beginning to decelerate.&lt;/li&gt;&lt;li&gt;    Both trains in each scenario make their initial departure at the same time.&lt;/li&gt;&lt;li&gt;    There are at most 31 stations along any route.&lt;/li&gt;&lt;li&gt;    The meeting time of both trains will never be at the departure of one of the trains from a station.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Input&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;All input values are real numbers. Data for each scenario are in the following format:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="font-style: italic; font-weight: bold;font-family:courier new;" &gt;d1 d2...dn 0.0&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; For a single route, the list of distances (in miles - there are 5,280 feet in a mile) from each station to the metro centre hub, separated by one or more spaces. Stations are listed in ascending order, starting with the station closest to the metro centre hub (station 1) and continuing to the outermost station. All distances are greater than zero. The list is terminated by the sentinel value 0.0.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="font-style: italic; font-weight: bold;font-family:courier new;" &gt;v&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; The maximum train velocity, in feet/minute.&lt;br /&gt;&lt;br /&gt; &lt;span style="font-style: italic; font-weight: bold;font-family:courier new;" &gt;s&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; The constant train acceleration rate in feet/minute2.&lt;br /&gt;&lt;br /&gt; &lt;span style="font-style: italic; font-weight: bold;font-family:courier new;" &gt;m&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; The number of minutes a train stays in a station.&lt;br /&gt;&lt;br /&gt;The series of runs is terminated by a data set which begins with the number -1.0.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Output&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For each scenario, the program should determine the following:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;    The number of the scenario (numbered consecutively, starting with Scenario #1).&lt;/li&gt;&lt;li&gt;    The time when the two trains meet in terms of minutes from starting time. All times must be displayed to one decimal place. Also, if the trains meet in a station, the station number where they meet.&lt;/li&gt;&lt;li&gt;    The distance in miles between the metro centre hub and the place where the two trains meet. Distances must be displayed to three decimal places.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Sample Input&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;15.0 0.0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;5280.0&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;10560.0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;5.0&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;3.5 7.0 0.0&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;5280.0&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;10560.0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;2.0&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;3.4 7.0 0.0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;5280.0&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;10560.0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;2.0&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;-1.0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Sample output&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Scenario #1:&lt;br /&gt;&lt;br /&gt;Meeting time: 7.8 minutes&lt;br /&gt;&lt;br /&gt;Meeting distance: 7.500 miles from metro centre hub&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Scenario #2:&lt;br /&gt;&lt;br /&gt;Meeting time: 4.0 minutes&lt;br /&gt;&lt;br /&gt;Meeting distance: 3.500 miles from metro centre hub, in station 1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Scenario #3:&lt;br /&gt;&lt;br /&gt;Meeting time: 4.1 minutes&lt;br /&gt;&lt;br /&gt;Meeting distance: 3.400 miles from metro centre hub, in station 1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-2683599560079756518?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/2683599560079756518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=2683599560079756518' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/2683599560079756518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/2683599560079756518'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2008/11/programming-problem-1-train-times.html' title='Programming Problem 1 - Train Times'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-6865138704125153455</id><published>2008-11-11T20:09:00.000-08:00</published><updated>2008-11-12T18:26:33.878-08:00</updated><title type='text'>SpringSource acquires G2One</title><content type='html'>&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SpringSource&lt;/span&gt; &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;acquires&lt;/span&gt; G2One - the company behind Groovy and Grails. I hope it augurs well for Groovy and helps in more shops adopting it for commercial development.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-6865138704125153455?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/6865138704125153455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=6865138704125153455' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/6865138704125153455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/6865138704125153455'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2008/11/spring.html' title='SpringSource acquires G2One'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-3090577550275912013</id><published>2008-09-03T19:11:00.000-07:00</published><updated>2008-09-03T19:14:58.205-07:00</updated><title type='text'>Language Remix</title><content type='html'>I stumbled across an interesting paper on polyglot programming &lt;a href="http://theuntitledblog.com/wp-content/uploads/2008/08/polyglot_programming-a_business_perspective.pdf"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I am convinced more than ever that in the war of programming languages, it is impossible for one language to outshine others. So should we start looking at things differently? Should we move our focus away from trying to pick a winner?&lt;br /&gt;&lt;br /&gt;A few trends are worth taking note of.&lt;br /&gt;&lt;br /&gt;- Developers are not scared anymore to experiment with different programming languages and styles. While they still have favourites, they are increasingly using the most suitable language or tool for a given job. This is a welcome change from the days when we were 'shoehorning' every solution into one tool or technology.&lt;br /&gt;&lt;br /&gt;- IDEs allow one to seamlessly integrate different tools and technologies into one platform.&lt;br /&gt;&lt;br /&gt;- Virtual machines have brought the languages closer to each other in such a way that the language has become merely a tool for expression. Code written in one or mixed languages produces the same byte code so the run time environment has become language agnostic.&lt;br /&gt;&lt;br /&gt;These trends suggest that the time is ripe to try out a polyglot approach to development and see if it has any real benefits or not. The paper above makes a convincing argument in favor of polyglot programming.&lt;br /&gt;&lt;br /&gt;     &lt;br /&gt;&lt;a href="http://theuntitledblog.com/wp-content/uploads/2008/08/polyglot_programming-a_business_perspective.pdf"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-3090577550275912013?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/3090577550275912013/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=3090577550275912013' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/3090577550275912013'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/3090577550275912013'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2008/09/language-remix.html' title='Language Remix'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-5682703409645220264</id><published>2008-08-29T20:04:00.000-07:00</published><updated>2008-08-29T20:10:23.247-07:00</updated><title type='text'>Fluent Interfaces</title><content type='html'>A &lt;a href="http://en.wikipedia.org/wiki/Fluent_interface"&gt;Fluent Interface&lt;/a&gt; is a design construct that makes your interfaces read like natural language instructions.&lt;br /&gt;&lt;br /&gt;I kinda like how a little refactoring of method signatures can make an interface much more "interesting", shall we say ? The idea is to make the interface read more like English. So, for ex., instead of&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-family:courier new;font-size:85%;"  &gt;//&lt;&lt;crude&gt;&gt;&lt;br /&gt;Aggregator a = new Aggregator();&lt;br /&gt;List l  = dao.getfeedFromEurope();&lt;br /&gt;List l1 = dao.getfeedFromAPAC();&lt;br /&gt;List l2 = dao.getfeedFromAmericas();&lt;br /&gt;a.aggregate(l);&lt;br /&gt;a.aggregate(l1);&lt;br /&gt;a.aggregate(l2);&lt;br /&gt;a.setFilterPolicy(FilterPolicy.NonPayingCountries);&lt;br /&gt;a.filter();&lt;br /&gt;List l3 = a.getFeeds();&lt;br /&gt;...&lt;/crude&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;you'll write&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;&lt;span style="color: rgb(0, 102, 0);"&gt;Aggregator a = new Aggregator();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;List l3 = a.aggregate(l).and_aggregate(l1).and_aggregate(l2).filterWith(FilterPolicy.NonPayingCountries);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Neat, isn't it? The Aggregate class methods are self-referential. In the above example, and_aggregate() just calls aggregate() internally. But the goal here is to improve readability of the interface. Of course, like everything else, fluent interfaces can be overused or misused. You can, for ex. make a very verbose interface or worse make all the interfaces fluent.&lt;br /&gt;&lt;br /&gt;I had a difficult time explaining this construct to the code reviewers last time. I guess it takes some time getting used to this style.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-5682703409645220264?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/5682703409645220264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=5682703409645220264' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/5682703409645220264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/5682703409645220264'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2008/08/fluent-interfaces.html' title='Fluent Interfaces'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-2881522450734375823</id><published>2008-08-29T04:16:00.000-07:00</published><updated>2008-08-29T04:23:06.284-07:00</updated><title type='text'>The first class</title><content type='html'>The snippet below prints the first class in the stacktrace. Might be useful for logging in some situations.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#009900;"&gt;public vid test ()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#009900;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#009900;"&gt;Throwable th = new Throwable();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#009900;"&gt;stackTraceElement[] ste = th.getStackTrace();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#009900;"&gt;System.out.println(ste[ste.length -1].getClassName());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#009900;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:85%;color:#009900;"&gt;               &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:85%;color:#009900;"&gt;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:85%;color:#009900;"&gt;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:85%;color:#009900;"&gt;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:85%;color:#009900;"&gt;&lt;/span&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-2881522450734375823?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/2881522450734375823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=2881522450734375823' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/2881522450734375823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/2881522450734375823'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2008/08/first-class.html' title='The first class'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-503068984424670310</id><published>2008-08-29T03:40:00.000-07:00</published><updated>2008-09-06T00:31:59.001-07:00</updated><title type='text'>I live inside Eclipse</title><content type='html'>I have a fetish for Eclipse plugins. I use&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Mylyn for tasks management. Super-cool productivity plugin.&lt;/li&gt;&lt;li&gt;Database Development Plugin. Replaces crappy DBArtisan on my desktop. Lets me perform basic database operations easily. Lightweight and super-fast.&lt;/li&gt;&lt;li&gt;Azzuri clay Database Modelling plugin to create ER diagrams and generate DDLs from them; a basic feature that Micro$oft decided not to provide in Visio Professional edition.&lt;/li&gt;&lt;li&gt;Beyond-CVS to integrate beyond-compare (my favourite comparison tool) with Eclipse.&lt;/li&gt;&lt;li&gt;QuickREx for those esoteric regular expressions. I don't miss RegEx buddy now. &lt;/li&gt;&lt;li&gt;Remote System Explorer for connecting to linux machines and running telnet/ssh/ftp shells. &lt;/li&gt;&lt;li&gt;Eclipse web browser. Limited in features but helps during basic debugging or investigation when I want to search for an inexplicable ibatis error or how to convert dates to varchar and vice versa in the database (i always keep forgetting that). Also for keeping an eye on the latest on reddit :-). Wish it offered tabbed browsing.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;My wish List&lt;/p&gt;&lt;ol&gt;&lt;li&gt;A Mind map plugin to let me gather my thoughts.&lt;/li&gt;&lt;li&gt;More powerful text editor. I use block-editing heavily.&lt;/li&gt;&lt;li&gt;A plugin for MS Outlook that lets me attach emails to Mylyn tasks.&lt;/li&gt;&lt;li&gt;A plugin for MS Excel&lt;/li&gt;&lt;li&gt;A powerful desktop indexing and search plugin.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Amen.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-503068984424670310?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/503068984424670310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=503068984424670310' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/503068984424670310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/503068984424670310'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2008/08/i-live-inside-eclipse.html' title='I live inside Eclipse'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-6358720923607718095</id><published>2008-08-27T20:42:00.000-07:00</published><updated>2008-08-27T20:48:28.926-07:00</updated><title type='text'>Random Thoughts</title><content type='html'>Xtreme Programming is not a synonym for planning-less programming. It is not a euphemism that poor management can hide behind.&lt;br /&gt;&lt;br /&gt;Xtreme is an ideological change and should be a conscious decision.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-6358720923607718095?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/6358720923607718095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=6358720923607718095' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/6358720923607718095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/6358720923607718095'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2008/08/random-thoughts.html' title='Random Thoughts'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-4091847304197793682</id><published>2008-08-27T20:15:00.000-07:00</published><updated>2008-09-06T00:48:55.122-07:00</updated><title type='text'>Ternary logic in SQL</title><content type='html'>A fellow colleague ran into a strange problem recently with a "not-in" SQL query. There were two tables, say A and B and we weretrying to get all values of a column from table A that did not exist in Table B.&lt;br /&gt;&lt;br /&gt;Here's a result of the queries we ran.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;select count(distinct column1) from A&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;-----17567 records&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;select count(distinct column1) from B&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;-----10234 records&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;So to get the values of column1 that are in A but not in B, we tried,&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;select distinct column1 from A where column1 not in (select distinct column1 from B)&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;-----0 records&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Funnily, the query returned no records. Something was wrong.&lt;br /&gt;&lt;br /&gt;After breaking our heads for several hours on this problem, the culprit turned out to be some null values in table B.&lt;br /&gt;&lt;br /&gt;We changed the above query as follows to make it work.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;select distinct column1 from A where column1 not in (select distinct column1 from B where column1 is not null)&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;-----~8000 records&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SQL implements what is known as &lt;a href="http://en.wikipedia.org/wiki/Ternary_logic"&gt;ternary logic&lt;/a&gt; for handling NULLs. I found a lucid explanation of this problem &lt;a href="http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-4091847304197793682?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/4091847304197793682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=4091847304197793682' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/4091847304197793682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/4091847304197793682'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2008/08/ternary-logic-in-sql.html' title='Ternary logic in SQL'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-3649705060951485213</id><published>2008-07-24T08:48:00.000-07:00</published><updated>2008-09-06T01:05:22.148-07:00</updated><title type='text'>My experience with unit testing</title><content type='html'>I am not new to programming but have had bad programming habits for too long. "Enough is enough", I said to myself one day and decided to use a test-first approach for the next project.&lt;br /&gt;&lt;br /&gt;Here's what I experienced.&lt;br /&gt;&lt;br /&gt;1. Although I created the test cases before writing the classes, I didn't keep up with the policy for long.  I found it a little distracting to think of and write a test case before any change to my code. The result was that soon my test cases were totally out of sync with the code.&lt;br /&gt;&lt;br /&gt;2. It is difficult to be disciplined enough to keep test cases up to date specially when you are working with tight deadlines. Effort estimation must take into account this fact.&lt;br /&gt;&lt;br /&gt;3. I had to continuously refactor my code to make it more testable. Writing test cases turned out to be a great way to write well formed APIs and good code in general. I had to make several modifications to my initial design to allow dependency injection. Moral of the story - automated unit tests can't be implemented as an after thought.&lt;br /&gt;&lt;br /&gt;4. I found it difficult to test private methods and had to change their visibility to test them.&lt;br /&gt;&lt;br /&gt;5. I found it difficult to automate everything. There were times when I just wanted to print the values of  a hashmap and inspect manually. I found it too time consuming to completely automate the testing in such cases. Perhaps it's a case of old habits. But I realized how much of our testing is based on manually inspecting the results. It is difficult to break this habit and to learn to rely on automated test results.&lt;br /&gt;&lt;br /&gt;6. Mocks are confusing (jmock) but very very helpful.&lt;br /&gt;&lt;br /&gt;7. Seeing the unit tests run successfully didn't give me much confidence except for the first time when I ran them with fresh code. I can think of several reasons for it. Firstly, as I mentioned before, manually verifying the results of a testcase gives one a confidence that's difficult to achieve by running automated tests. There is something reassuring about seeing the results with your own eyes. Secondly, my test cases were not comprehensive enough to test full functionality. So after some time, I didn't see much value being added by running these tests.  And lastly, I was coding for a database intensive CRUD application; my code was heavily dependent on file i/o and database access, both of which needed extensive integration testing. After a while, the unit tests were rendered completely useless and I was hardly running them.&lt;br /&gt;&lt;br /&gt;8. There is only so much that unit tests can achieve. Most of the bugs in my code were caught during integration testing. But I must admit that at least some of these could have been caught during unit testing if I had better unit tests.&lt;br /&gt;&lt;br /&gt;10. There should be a set of integration tests that check essential functionality. These tests may not run during the continuous build but must run during the nightly build.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-3649705060951485213?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/3649705060951485213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=3649705060951485213' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/3649705060951485213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/3649705060951485213'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2008/07/my-experience-with-unit-testing.html' title='My experience with unit testing'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-8342503747084981369</id><published>2008-07-10T02:54:00.000-07:00</published><updated>2008-07-10T02:56:04.764-07:00</updated><title type='text'>Java Code Review Tools</title><content type='html'>Today I gave a presentation to the team on java code review tools. I covered 2 tools in detail, PMD and Jupiter. while I was talking about them, I realized that both the tools can do with some improvements.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;PMD   &lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Improved filtering to allow me to run the tool on selective files.    &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;strong&gt;Jupiter&lt;/strong&gt;  &lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Must let me view defects data in a more user friendly way. I want to be able to view all defects and then aply filters on them. The functionality is there but not in the way I want it.       &lt;/li&gt;&lt;li&gt;Must allow me to generate reports on defects metrics.      &lt;/li&gt;&lt;li&gt;The workflow is confusing (why should i choose a reviewer in the 'rework' phase ?). The process should be simplified.&lt;/li&gt;&lt;li&gt;There should be a filtering icon in each view.  &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#cc0000;"&gt;Note to self: Explore option of adding these features yourself.&lt;/span&gt;&lt;/em&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-8342503747084981369?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/8342503747084981369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=8342503747084981369' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/8342503747084981369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/8342503747084981369'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2008/07/java-code-review-tools.html' title='Java Code Review Tools'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-5672662583732574246</id><published>2008-07-09T23:59:00.000-07:00</published><updated>2008-12-10T03:20:02.509-08:00</updated><title type='text'>Use groovy as your scratchpad during java development</title><content type='html'>How many times have you wanted to test out a small piece of java logic before implementing it in your code?&lt;br /&gt;&lt;br /&gt;In the past, whenever I did something 'smart' with Dates or Calendar or Strings or StringBuffers, I wrote a small java program (often called Test.java) to test the logic I had in mind. The process, as we all know, is slow to do in java because of Java's write-compile-run cycle. Even if you are using the most sophisticated IDEs, it is still a chore.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Enter Groovy&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://groovy.codehaus.org/"&gt;Groovy&lt;/a&gt; is a dynamic language written for the Java virtual machine. You can use Java syntax in a perl like language. While Groovy is a full featured new-age programming language (I am having lots of fun learning it by the way), I use it more often to test out bits of java logic before I want to introduce it into my code.&lt;br /&gt;&lt;br /&gt;The other day, I wanted to check how GrgorianCalendar's firstDayOfWeek is affected by the Locale. Normally, I would have written this in Test.java but not any more. I opened the Groovy console and typed in the code snippet I wanted to test. I didn't have to create any class or import anything (java.unit.* is imported by default). There was no manual compilation needed (because it happens under the hood). All I had to do was type my code and press Ctrl-R. Presto. The output was displayed in the output screen. I changed the Locale in the constructor and again pressed Ctrl-R to re-run. No recompilation, nothing.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_ZVTF1zKeSv0/SHW1s1dTlTI/AAAAAAAAAC0/hK4FY9lrTbU/s1600-h/groovy.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5221279124874827058" style="CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_ZVTF1zKeSv0/SHW1s1dTlTI/AAAAAAAAAC0/hK4FY9lrTbU/s320/groovy.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_ZVTF1zKeSv0/SHW1dzGsbII/AAAAAAAAACs/K_J9fsaqkSc/s1600-h/groovy.JPG"&gt;&lt;/a&gt;&lt;a href="http://3.bp.blogspot.com/_ZVTF1zKeSv0/SHW1dzGsbII/AAAAAAAAACs/K_J9fsaqkSc/s1600-h/groovy.JPG"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I recommend this tool to every serious java developer as a productivity tool. Of course once you get hooked to Groovy as a programming language, I am sure you'll find it as interesting as I do.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-5672662583732574246?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/5672662583732574246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=5672662583732574246' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/5672662583732574246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/5672662583732574246'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2008/07/use-groovy-as-your-scratchpad-during.html' title='Use groovy as your scratchpad during java development'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_ZVTF1zKeSv0/SHW1s1dTlTI/AAAAAAAAAC0/hK4FY9lrTbU/s72-c/groovy.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6896799837802490811.post-7791061471083364492</id><published>2008-07-09T23:27:00.000-07:00</published><updated>2008-09-06T01:08:49.449-07:00</updated><title type='text'>Working on maintenance projects</title><content type='html'>&lt;p&gt;&lt;em&gt;&lt;span style="color: rgb(102, 51, 51);"&gt;first posted on personal blog on Monday, November 13, 2006&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;It is difficult to understand why people have such an anathema towards maintenance projects. I often come across programmers whose enthusiasm takes a nosedive every time they are asked to work in a maintenance project.&lt;/p&gt;&lt;p&gt;I think, it is an attitude problem more than anything else.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Most projects that I have worked on have been either maintenance (bug fixing) or enhancement projects. If one has the right kind of attitude, working on a bug fixing project can be a very fulfilling experience.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;What attitude, you ask? I suggest the following.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;All bugs can be replicated and fixed.&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;All bugs can be detected, analyzed and fixed. If you can't replicate it, don't give up. Check that you are following the right steps. Make sure that your assumptions are correct. Investigate and find out more about the conditions in which the bug was reported.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;The software doesn't control you. You control it.&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;A program does what it is told to do. So even the seemingly erratic/intermittent behavior will have some logical explanation. Don't be afraid of ripping open the class files using a decompiler if needed. As a bug fixer, you are like a private detective. You have access to all areas of the application and you must go through all the code if needed. I once saw a colleague going through the decompiled code of log4j. He was apparently getting some trouble with logging and wanted to understand log4j code to see what was wrong.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;...And it's all small stuff.&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Don't be smug. Don't ignore trivial causes. Are you running the right build? Are you connected to the correct database? Are you using the right version of code? I can't begin to count the number of occasions where I have done this mistake or have seen someone else doing it. It's like forgetting the attachments in your emails. No matter how experienced you are, you will still catch yourself doing silly mistakes every once in a while.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Be humble.&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;As I said before, it's software you are working on. Software &lt;strong&gt;will&lt;/strong&gt; have bugs. Even after you fix them, there will still be some more. So don't take it personally if someone points out a bug in your code or if the fix that you provide doesn't work. Be humble and accept your mistakes. I hate to see programmers getting defensive about their code or design.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Pretend that the "Go to" guys don't exist.&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Do not get into the habit of raising an SOS every time you see a NullPointerException. There will always be a few star programmers in your project but it irritates them beyond belief if you go asking for their help for every stupid exception that your program throws. Try to fix the problem yourself first. That's what separates good programmers from lazy nincompoops. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Do your homework before seeking help. &lt;/strong&gt;&lt;/p&gt;&lt;p&gt;In other words RTFM and save the logs. If you do need to take help, do your homework first. Read the specs, do some research, google the error message and find out if someone has already faced it before. Post your query on the forums. And for God's sake, save the logs before calling someone for help.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Be lazy. Automate!!&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;I learnt this very early. Best programmers are creatively lazy. Automate. Find out tools that can help reduce your time. In short, be a smart coder.  If you are working on legacy code, you will need powerful tools and good skills to search the codebase. Learn regular expressions and use them in your searches. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Think out of the box.&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;People have been known to recover from the dreadful "rm-rf" that someone accidentally typed on a Unix box. The point is, no problem is big enough that it can't be solved. There must exist a solution. And you should find it. Think laterally if needed.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Always get the big picture. Don't forget to ask the "whys".&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;This is very important. There is a reason why everything works the way it does. There is a reason why your client chose Java over C++ (or vice versa) and there is a reason again in why they chose to not use entity beans. Be inquisitive. Question everything. Get a bigger perspective.It will help you come up with better solutions to problems that you are working on.&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6896799837802490811-7791061471083364492?l=miles-to-code.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://miles-to-code.blogspot.com/feeds/7791061471083364492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6896799837802490811&amp;postID=7791061471083364492' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/7791061471083364492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6896799837802490811/posts/default/7791061471083364492'/><link rel='alternate' type='text/html' href='http://miles-to-code.blogspot.com/2008/07/working-on-maintenance-projects.html' title='Working on maintenance projects'/><author><name>Rahul</name><uri>http://www.blogger.com/profile/01970515790674651790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
