<?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-5365644000153420081</id><updated>2011-11-27T16:02:41.502-08:00</updated><category term='email'/><category term='eclipse'/><category term='loop'/><category term='java'/><category term='refactoring'/><category term='plugin'/><category term='IDE'/><category term='security'/><category term='programming'/><category term='internet'/><title type='text'>Java Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://fastcodejava.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://fastcodejava.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>My Story</name><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>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5365644000153420081.post-8079277396722805142</id><published>2011-03-10T23:42:00.000-08:00</published><updated>2011-03-21T21:26:24.116-07:00</updated><title type='text'>Be careful of google's search results</title><content type='html'>&lt;script type="text/javascript" src="http://widgets.digg.com/buttons.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;(function() {&lt;br /&gt;var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];&lt;br /&gt;s.type = 'text/javascript';&lt;br /&gt;s.async = true;&lt;br /&gt;s.src = 'http://widgets.digg.com/buttons.js';&lt;br /&gt;s1.parentNode.insertBefore(s, s1);&lt;br /&gt;})();&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;!-- Medium Button --&gt;&lt;br /&gt;&lt;a class="DiggThisButton DiggMedium"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It has recently been  in the news that there's lot of spam in search results. But I did not know it will really hit home so  soon. I recently entered the search for delay Windows 7 activation. I got this &lt;a href="http://www.techspot.com/news/35915-use-windows-7-free-for-up-to-four-months.html"&gt;link&lt;/a&gt; as the first result. But this should not have been the first result for this query. It refers to the original post on &lt;a href="http://www.techspot.com/news/35915-use-windows-7-free-for-up-to-four-months.html"&gt;Windowssecrets.com&lt;/a&gt;. But that is not the main point. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The first link in the search result does not give enough details. Being a lazy person as I am I did not click on the link mentioned in that article and it cost me dearly. The article in question does not caution the user to only execute the necessary command at the end of one month period. it does  however mention that the command can be a used maximum of four times.  But I somehow missed that. So I kept issuing the command every two days. As a result the time to enjoy Windows 7 without activation was severely reduced.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Moral of the story is don't always trust the first result from Google. It is unfortunate that Google will show a less reliable article as the first result than the more detailed one. But that's the way it works in Internet sometimes. So be careful of it.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5365644000153420081-8079277396722805142?l=fastcodejava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fastcodejava.blogspot.com/feeds/8079277396722805142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5365644000153420081&amp;postID=8079277396722805142' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/8079277396722805142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/8079277396722805142'/><link rel='alternate' type='text/html' href='http://fastcodejava.blogspot.com/2011/03/be-careful-of-googles-search-results.html' title='Be careful of google&apos;s search results'/><author><name>My Story</name><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-5365644000153420081.post-4928875759801281448</id><published>2010-09-26T21:56:00.000-07:00</published><updated>2010-09-26T23:15:21.828-07:00</updated><title type='text'>One Way to Negotiate Salaries.</title><content type='html'>There are different ways salaries are negotiated. Some companies give you salaries based on the salary at the previous company. Some people can negotiate salaries pretty much independently of their salary history. They go by market; if the market is hot and their demand is high the will ask for a big salary. If they cannot get their base salary high enough they will try to get a big bonus or some other perks such as stock options. But few people negotiate their salaries the following way. It can definitely earn them more, so try it. I definitely will at the next job offer I get.&lt;br /&gt;&lt;br /&gt;The idea is to ask for a very low salary in the beginning, lets say just &lt;span style="font-weight:bold;"&gt;1 c&lt;/span&gt;. Then take double that in the next month, &lt;span style="font-weight:bold;"&gt;2 c&lt;/span&gt;. This will make HR people very happy although a bit surprised. They are not technical people so they will not dig deeper. So your paycheck will look like :&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;1 c&lt;/b&gt; First month&lt;/li&gt;&lt;li&gt;&lt;b&gt;2 c &lt;/b&gt;Second month&lt;/li&gt;&lt;li&gt;&lt;b&gt;4 c &lt;/b&gt;Third month&lt;/li&gt;&lt;li&gt;&lt;b&gt;8 c&lt;/b&gt; Fourth month&lt;/li&gt;&lt;li&gt;&lt;b&gt;16 c &lt;/b&gt;Fifth month&lt;/li&gt;&lt;li&gt;&lt;b&gt;32 c &lt;/b&gt;Sixth month&lt;/li&gt;&lt;li&gt;&lt;b&gt;64 c &lt;/b&gt;Seventh month&lt;/li&gt;&lt;li&gt;&lt;b&gt;$1.28 &lt;/b&gt;Eighth month&lt;/li&gt;&lt;li&gt;&lt;b&gt;$2.56 &lt;/b&gt;Ninth month&lt;/li&gt;&lt;li&gt;&lt;b&gt;$5 &lt;/b&gt;Tenth month (Rounding up)&lt;/li&gt;&lt;li&gt;&lt;b&gt;$10 &lt;/b&gt;Elventh month (Rounding up)&lt;/li&gt;&lt;li&gt;&lt;b&gt;$20 &lt;/b&gt;Twelfth month&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;So at the end of one year you will be getting a &lt;b&gt;$20&lt;/b&gt; paycheck. But it will be quite different in another year, you will make pretty fat paycheck at the level with the company's CEO, and in another year you will sitting on pretty good fortune and may not have to work anymore. You probably cannot work there anyway as that company will most likely be bankrupt.&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/5365644000153420081-4928875759801281448?l=fastcodejava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fastcodejava.blogspot.com/feeds/4928875759801281448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5365644000153420081&amp;postID=4928875759801281448' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/4928875759801281448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/4928875759801281448'/><link rel='alternate' type='text/html' href='http://fastcodejava.blogspot.com/2010/09/one-way-to-negotiate-salaries.html' title='One Way to Negotiate Salaries.'/><author><name>My Story</name><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>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5365644000153420081.post-7529595185614835724</id><published>2010-06-05T22:57:00.002-07:00</published><updated>2010-06-12T21:18:28.145-07:00</updated><title type='text'>New Way to Write Equals.</title><content type='html'>This is typical way to write the important equals method in java :&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;public boolean &lt;b&gt;equals&lt;/b&gt;(final Object object) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (this == object) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return true;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (!(object instanceof MyClass)) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return false;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// now comes the real comparison of fields, foo, bar, etc.&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&lt;br /&gt;My idea is to refactor the later part of the comparison to another method :&lt;br /&gt;&lt;br /&gt;public boolean &lt;b&gt;equals&lt;/b&gt;(final MyClass myClass) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Do the real comparison of fields, foo, bar, here.&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;So the original &lt;span style="font-weight:bold;"&gt;equals&lt;/span&gt; method becomes :&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;public boolean &lt;b&gt;equals&lt;/b&gt;(final Object object) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (this == object) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return true;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (!(object instanceof MyClass)) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return false;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return &lt;b&gt;equals&lt;/b&gt;((MyClass) object);&lt;br /&gt;}&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Benefit of having two &lt;b&gt;equals &lt;/b&gt;is obvious, it keeps it simple and clear. In most cases &lt;b&gt;equals &lt;/b&gt;will be only called with the object of same class only. In that case, it comes directly to the specific method, so it might be tiny bit faster as the instanceof is not being checked.&lt;span class="Apple-tab-span" style="white-space:pre"&gt; Also first six lines of the method could be refactored into another method so the equals method &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;becomes even more compact. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5365644000153420081-7529595185614835724?l=fastcodejava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fastcodejava.blogspot.com/feeds/7529595185614835724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5365644000153420081&amp;postID=7529595185614835724' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/7529595185614835724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/7529595185614835724'/><link rel='alternate' type='text/html' href='http://fastcodejava.blogspot.com/2010/06/new-way-to-write-equals_2230.html' title='New Way to Write Equals.'/><author><name>My Story</name><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-5365644000153420081.post-6325211872363595192</id><published>2010-04-22T01:42:00.000-07:00</published><updated>2010-04-22T21:53:23.876-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='email'/><category scheme='http://www.blogger.com/atom/ns#' term='internet'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>Do Not Keep Same Password For All System</title><content type='html'>&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Recently &lt;a href="http://google.com"&gt;google&lt;/a&gt; was subject of &lt;a href="http://www.guardian.co.uk/technology/2010/apr/20/google-chinese-hackers"&gt;hacker attack&lt;/a&gt;. Actually, one friend of mine had it gmail account hacked. He not only lost access to his emails, fraudulent emails were sent to his contacts asking for money. It said he is stuck somewhere in Europe and needs money. I got one of those emails, but I knew it was phishing email and his email was hacked.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It is very usual to have many emails e.g. yahoo, gmail, aol, etc etc these days. It seems convenient also to keep same password for all system as it makes it easy to keep track of. But it can be very dangerous as well. If a hacker gets to know one password, he can gain access to all your emails and you have no way to reset as your backup email will not work either. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So although convenient, it is mandatory to keep different password for different systems. Also it is recommended to change the password every so often.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5365644000153420081-6325211872363595192?l=fastcodejava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fastcodejava.blogspot.com/feeds/6325211872363595192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5365644000153420081&amp;postID=6325211872363595192' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/6325211872363595192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/6325211872363595192'/><link rel='alternate' type='text/html' href='http://fastcodejava.blogspot.com/2010/04/do-not-keep-same-password-for-all.html' title='Do Not Keep Same Password For All System'/><author><name>My Story</name><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-5365644000153420081.post-5011719899358599224</id><published>2010-04-16T20:38:00.000-07:00</published><updated>2010-04-22T21:51:14.836-07:00</updated><title type='text'>Uses of Breadcrumbs in Eclipse</title><content type='html'>&lt;!-- AddThis Button BEGIN --&gt;&lt;br /&gt;&lt;a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&amp;amp;pub=xa-4a90db2f0ecd7160"&gt;&lt;img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-TOP: 0px; BORDER-RIGHT: 0px"&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js?pub=xa-4a90db2f0ecd7160"&gt;&lt;/script&gt;&lt;br /&gt; &lt;!-- AddThis Button END --&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Eclipse has the breadcrumb feature for a while. It is immensely useful. One can turn it off or on by pressing &lt;span style="font-weight:bold;"&gt;Alt-Shift-B. &lt;/span&gt;&lt;span&gt;It's main purpose is, of course, easy navigation. It makes it easy to navigate to different packages, classes or project without opening the package explorer view which takes up valuable space. But that is not the only use. Other uses are :&lt;/span&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Quickly go to the beginning of a class.  If you are in the middle of a long class and you want to go to the beginning of the class. To do this, just type &lt;span class="Apple-style-span" style="font-weight: bold; "&gt;Alt-Shift-B &lt;/span&gt;and which will put the focus on the breadcrumb and use the left arrow key to highlight the class names and hit enter. &lt;/li&gt;&lt;li&gt;Quickly go to other methods in a class. If you are in the middle of long class which has many methods and you want to go to some other method. One way to do it will be to use &lt;b&gt;Ctrl-Shift&lt;/b&gt;-&lt;b&gt;Up/Down&lt;/b&gt; which will take you to the next of previous method. One can also use &lt;b&gt;Ctrl-O &lt;/b&gt;which will show all the methods. Yet another way is to type &lt;span class="Apple-style-span" style="font-weight: bold; "&gt;Alt-Shift-B &lt;/span&gt;and use the up/down arrow key to go to the desired method.&lt;/li&gt;&lt;li&gt;Quickly delete a method or the whole class.  Before there was breadcrumb one had to go to the package explorer view or the outline view. Not anymore. One can just  go to the breadcrumb and hit the delete key now.&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5365644000153420081-5011719899358599224?l=fastcodejava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fastcodejava.blogspot.com/feeds/5011719899358599224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5365644000153420081&amp;postID=5011719899358599224' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/5011719899358599224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/5011719899358599224'/><link rel='alternate' type='text/html' href='http://fastcodejava.blogspot.com/2010/04/use-of-breadcrumbs-in-eclipse.html' title='Uses of Breadcrumbs in Eclipse'/><author><name>My Story</name><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>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5365644000153420081.post-6693586876041553681</id><published>2009-12-20T20:36:00.000-08:00</published><updated>2009-12-20T21:29:06.101-08:00</updated><title type='text'>Alternative to Getter/Setters Contd...</title><content type='html'>Looks like my last blog on this subject got some attention in &lt;a href="http://www.dzone.com/links/better_alternative_for_gettersetters.html"&gt;dzone&lt;/a&gt;. It was pleasing to see those up votes. There were some down votes as well. I am trying to figure out why there were so many down votes. Probably they did not like the idea that a private field which have getter/setter can be treated just like a public field. Although essentially it is public but idea that you could directly access and change the field without going to through the getter/setters is not palatable to lot of people. If it walks like duck, quacks like duck, sometimes it is really not a duck! Some people pointed out getter/setters could be quite different from &lt;span style="font-style: italic;"&gt;[return field;] &lt;/span&gt;and   &lt;span style="font-style: italic;"&gt;[this.field = field&lt;/span&gt;;] kind of code. In that case, one could provide explicit getter/setters. The annotation model will only apply to the most common case. In the lombok project also, this is the case the annotation will cover. Even then, I do not think java community, in general, will like the idea to treat private fields as public fields.&lt;br /&gt;&lt;br /&gt;This was &lt;span style="font-style: italic;"&gt;the idea &lt;/span&gt;my&lt;span style="font-style: italic;"&gt; &lt;/span&gt;last blog that I was trying to push. Most of the other ideas presented have already been featured in the &lt;a href="http://projectlombok.org/"&gt;lombok project&lt;/a&gt;. Although it is not fashionable now, it might become in future.&lt;br /&gt;&lt;br /&gt;What is not yet implemented in the lombok project is the &lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;Constructor &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;annotation&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;This will really save lot of code clutter. This constructor annotation could have optional parameters to call super(), or some other method. e.g. init(), etc.&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt; &lt;/span&gt;&lt;/span&gt;If anyone has any comments or suggestions please post below.&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5365644000153420081-6693586876041553681?l=fastcodejava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fastcodejava.blogspot.com/feeds/6693586876041553681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5365644000153420081&amp;postID=6693586876041553681' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/6693586876041553681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/6693586876041553681'/><link rel='alternate' type='text/html' href='http://fastcodejava.blogspot.com/2009/12/alternative-to-gettersetters-contd.html' title='Alternative to Getter/Setters Contd...'/><author><name>My Story</name><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-5365644000153420081.post-7966814730767068812</id><published>2009-11-22T22:16:00.000-08:00</published><updated>2009-11-23T21:54:13.769-08:00</updated><title type='text'>Better Alternative for Getter/Setters?</title><content type='html'>&lt;script type="text/javascript"&gt;var dzone_url = 'http://www.dzone.com/links/better_alternative_for_gettersetters.html';&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var dzone_title = 'Dzone';&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var dzone_style = '2';&lt;/script&gt;&lt;br /&gt;&lt;script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"&gt;&lt;/script&gt;&lt;br /&gt;Recently &lt;a href="http://projectlombok.org/"&gt;lombok project&lt;/a&gt; has created &lt;a href="http://projectlombok.org/"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;quite a buzz. It is a very nice project which lets one put short and concise annotations in place of getter setters. There are other projects also which takes this approach which has similar annotations in place. With the annotations no explicit getter setters are not necessary and still other classes can call the getter setters as if they are there. The lombok project also fits into eclipse ide which makes the getter setters appear as code completion even though they are not there.&lt;br /&gt;&lt;br /&gt;Could there be a better alternative? How about having annotation similar to lombok project and let's say they called @&lt;span style="font-weight: bold;"&gt;Getter &lt;/span&gt;&amp;amp; @&lt;span style="font-weight: bold;"&gt;Setter &lt;/span&gt;which will create the getter and setter implicitly so other classes can call the methods and not get compilation error. What if @&lt;span style="font-weight: bold;"&gt;Getter &lt;/span&gt;annotation makes the field public for reading purpose and  @Setter annotation makes it public for writing purpose. So if a field is annotated with @&lt;span style="font-weight: bold;"&gt;Getter &lt;/span&gt;then one should able to do &lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;something = &lt;/span&gt;&lt;span style="font-style: italic;"&gt;instance.field&lt;/span&gt;, &lt;/li&gt;&lt;/ul&gt;where instance is the instance of the class and &lt;span style="font-style: italic;"&gt;field &lt;/span&gt;is a private field in the class. And if it is annotated with @&lt;span style="font-weight: bold;"&gt;Setter&lt;/span&gt;, one should be able to do &lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;instance.&lt;/span&gt;&lt;span style="font-style: italic;"&gt;field&lt;/span&gt;&lt;span style="font-style: italic;"&gt;= something.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;With both &lt;span style="font-weight: bold;"&gt;&lt;/span&gt;@&lt;span style="font-weight: bold;"&gt;Get&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;ter&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&amp;amp; @&lt;span style="font-weight: bold;"&gt;Setter &lt;/span&gt;annotations, one will be able to use them essentially as public fields. Java IDEs will have to change to make this work. In particular, refactoring will probably be difficult&lt;span style="font-style: italic;"&gt;, &lt;/span&gt;but it will be well worth the effort for the simplicity it brings.&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;In addition to &lt;/span&gt;&lt;span&gt;not having the getter/setters&lt;/span&gt;&lt;span style="font-style: italic;"&gt;, &lt;/span&gt;&lt;span&gt;this will &lt;/span&gt;&lt;span&gt;also &lt;/span&gt;&lt;span&gt;make it apparent which fields are really private and which are modifiable and accessible. One does not need to scroll down hundred lines to see if there are getters setters for it. An optional body could be supplied to the &lt;/span&gt;annotations as well. But in most cases, simple &lt;span style="font-style: italic;"&gt;return field&lt;/span&gt; (for getters) and &lt;span style="font-style: italic;"&gt;this&lt;/span&gt;.&lt;span style="font-style: italic;"&gt;field&lt;/span&gt; = &lt;span style="font-style: italic;"&gt;field&lt;/span&gt;(for setters) will do.&lt;br /&gt;&lt;span&gt;&lt;br /&gt;The two &lt;/span&gt;annotations can be combined to one annotation called @&lt;span style="font-weight: bold;"&gt;Get&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;ter&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Setter&lt;/span&gt;. A @&lt;span style="font-weight: bold;"&gt;Data&lt;/span&gt; annotation can be created as well just like lombok project does which will make all private fields having @&lt;span style="font-weight: bold;"&gt;Get&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;ter&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Setter&lt;/span&gt; annotation. To be complete, a negative annotation &lt;span style="font-weight: bold;"&gt;@NotGet&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;ter @Not&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Setter&lt;/span&gt; can be applied to few fields which are not supposed to be &lt;span&gt;accessible and &lt;/span&gt;&lt;span&gt;modifiable&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&lt;br /&gt;Another &lt;/span&gt;&lt;span&gt;useful &lt;/span&gt;annotation&lt;span&gt; &lt;/span&gt;&lt;span&gt;&lt;span&gt;to cut code clutter can be to introduce&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt; @&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="font-weight: bold;"&gt;Constructor &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;annotation which can be attached to a class. This can take optional parameters &lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;@&lt;span style="font-weight: bold;"&gt;Constructor&lt;/span&gt;(field1, &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;field2, &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;field3,..). &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;There can be &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;multiple &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;Constructos &lt;/span&gt;&lt;/span&gt;&lt;span&gt;with varying numbers of fields.&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;This could be &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;extended to &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;equals, hashCode, and toString &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;methods as well&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;For these methods&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;, a &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;template &lt;span&gt;could be &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;defined which will present in the classpath&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;I&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; am not providing further details for simplicity.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5365644000153420081-7966814730767068812?l=fastcodejava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fastcodejava.blogspot.com/feeds/7966814730767068812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5365644000153420081&amp;postID=7966814730767068812' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/7966814730767068812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/7966814730767068812'/><link rel='alternate' type='text/html' href='http://fastcodejava.blogspot.com/2009/11/better-alternative-for-gettersetters.html' title='Better Alternative for Getter/Setters?'/><author><name>My Story</name><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-5365644000153420081.post-248368214216035109</id><published>2008-07-26T22:53:00.000-07:00</published><updated>2009-07-03T11:00:08.352-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='IDE'/><category scheme='http://www.blogger.com/atom/ns#' term='loop'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='refactoring'/><title type='text'>Write Easy to Read For Loop</title><content type='html'>&lt;script type='text/javascript' src='http://track4.mybloglog.com/js/jsserv.php?mblID=2009070310433923'&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;When it comes to for loops, first thing a programmer thinks is what to name the counter variable. I am talking about old styled for as shown below :&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;for (int i=0; i &lt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;     // really long body.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;What to name the counter variable? If you name just &lt;span style="font-weight: bold;"&gt;i&lt;/span&gt; or &lt;span style="font-weight: bold;"&gt;j&lt;/span&gt; as shown above, it is not readable, but it easy to program. If you name something meaningful e.g. &lt;span style="font-weight: bold;"&gt;someItemOccurenceCount&lt;/span&gt;, it is painful to copy and paste when you need it e.g: &lt;span style="font-weight: bold;"&gt;someArray[someItemOccurenceCount]. &lt;/span&gt;IDE's&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;auto-completion&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;/span&gt;feature is useful, but to invoke every time is a pain.&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;Well with any IDE, you are in luck. You just write the loop with i, j, or k&lt;span style="font-weight: bold;"&gt;, &lt;/span&gt;or any of your favorite alphabet. Once you have finished writing the whole loop, just use refactoring. And look, IDE will change the one letter counter with any meaningful word you might choose.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5365644000153420081-248368214216035109?l=fastcodejava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fastcodejava.blogspot.com/feeds/248368214216035109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5365644000153420081&amp;postID=248368214216035109' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/248368214216035109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/248368214216035109'/><link rel='alternate' type='text/html' href='http://fastcodejava.blogspot.com/2008/07/write-easy-to-read-for-loop.html' title='Write Easy to Read For Loop'/><author><name>My Story</name><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-5365644000153420081.post-8874984961908120155</id><published>2008-07-04T14:33:00.001-07:00</published><updated>2009-07-03T11:01:07.221-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><title type='text'>Fast Code Eclipse Plugin</title><content type='html'>&lt;script type='text/javascript' src='http://track4.mybloglog.com/js/jsserv.php?mblID=2009070310433923'&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Fast Code Eclipse Plugin has been released in beta mode.  It can downloaded from &lt;a href="http://fast-code.sourceforge.net/"&gt;http://fast-code.sourceforge.net/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;It's capabilities are many e.g&lt;/span&gt;&lt;/span&gt;  &lt;ul&gt;&lt;li&gt;Automatically create DAO to Service and Service to Action, e.g. FooDAO to FooService and FooService to FooAction.&lt;/li&gt;&lt;li&gt;Automatically create one DAO to another with different name, e.g. FooDAO (with methods getFoo, saveFoo, etc) to BarDAO (with methods getBar, saveBar, etc).&lt;/li&gt;&lt;li&gt;Also create spring based configurations.&lt;/li&gt;&lt;li&gt;etc.&lt;/li&gt;&lt;/ul&gt;Details documentation can be found at the project homepage above.  Questions, comments, suggestions etc can be sent to fastcodejava  (a t)  g m a i l.&lt;br /&gt;&lt;br /&gt;New bugs or issues can also be posted in the bugs database :  &lt;a href="http://sourceforge.net/tracker/?func=add&amp;amp;group_id=229124&amp;amp;atid=1076630"&gt;http://sourceforge.net/tracker/?func=add&amp;amp;group_id=229124&amp;amp;atid=1076630&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The plugin is not quite complete, but I have released a preliminary version which can be used.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5365644000153420081-8874984961908120155?l=fastcodejava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fastcodejava.blogspot.com/feeds/8874984961908120155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5365644000153420081&amp;postID=8874984961908120155' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/8874984961908120155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5365644000153420081/posts/default/8874984961908120155'/><link rel='alternate' type='text/html' href='http://fastcodejava.blogspot.com/2008/07/fast-code-eclipse-plugin.html' title='Fast Code Eclipse Plugin'/><author><name>My Story</name><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>
