10th Nov, 2008

Click, Click…

Photography is something which I want to do for many years, probably, right from my high school. Initially, we had some basic analog and digital cameras. Whenever, I get to use my uncle’s and my friend Karthick’s SLR cams, I do envy of them.

After coming to Chicago and with part time job, I planned to buy a camera – definitely a DSLR. Apart from photography interest (which I have been putting behind), I had so many reasons – My Birthday, Summer, Canada trip and other road trips. I did lot of research on which model I should go for with budget in mind. I zeroed in Canon rebel EOS XTI over other models and manufactures. Well, to be honest, each and every manufacture has same model features in different name and different price. I got XTI over XSI because of its negible feature difference. XTI would be perfect for me as I am just getting my hands on the DSLR. Bigger ones later!

I bought XTI on a mother’s day deal J - XTI with default and 75-300mm lenses.

Practice makes a man perfect! – During all the trips, I had been clicking lot of pictures. I guess mostly it’s been nature. Another best in North America is the horizon color. Any sun rise and sunset is beautiful. The lighting is a key factor in photography.

I had been referring Flickr for ideas and tips & tricks. When you see lots of amazing photos in Flickr every day, you would be tempt to switch on your creative side and have a photogenic vision gear on all the time. Whatever you see, you would say … well in this angle, with this setting, it would be good shot.

Canada trip was a feast for me. First week, I spent with my close friend Karthick who is using SLR for very long. So, we get to try lot of stuffs and of course, I learnt few tricks from him. That’s when I realized, I should buy tripod and other accessories. After reaching Montreal, the first thing I did was to bug my cousin to go to nearby mall and I bought a tripod. Photography is expensive hobby. I am tempted to buy a lot of accessories. I guess I will once I get into full time job.

You can check out my Flickr and leave your valuable suggestions/comments/criticisms about my pictures.

PS: I will post a blog on my Canada trip. At least, before I do another trip to Canada this winter. :P

First step to enter any country: Get the Visa! Lots of work involved. But getting a tourist visa … comparatively easier.

I applied for the Canadian visa through postal as Canadian tourist visa is not issued @ Chicago and the nearest place is Detroit. Well, many do stop by Detroit or Buffalo and get the visa on the way to Canada. I wanted a smooth journey. So I decided to take a risk of couriering my passport to Detroit Visa office. Risky … because you would be totally messed up if you loose your passport in America.

The documents sent through the postal are:

  • Passport
  • DD of $75[single entry]/$150[Multiple entry]
  • Bank statement to show that you have sufficient balance for your trip
  • Current status in America [well, i sent my i20 copy, an enrollment letter from my univ]
  • Invitation Letter [Honestly, I don't know how important it is. But I got the letter from my cousin after been signed by Registrar]

I sent through Fedex overnight as I wanted the package to be delivered next day morning. They took 5 working days to process visa and I received after 2 days with all the documents been sent in the package.

Now, all set to enjoy the vacation with ma bro, ma cousin and ma friends!!! hooo hooooo! … Canada .. here I come!!!!

3rd Aug, 2008

Ma Birthday Road Trip!!

For this year birthday, I thought i would spend my time with ma UG friends. But as it was a road trip, I had to get my Driver’s License first. With help of ma friend Rajesh Batchu [ma ex roomie], I practised on the roads of Chicago and took the road test at 95th street. Surprisely, I got the license sooner than I expected as I wasn’t driving cars back at home. Targeted Places: Atlanta, Columbus-Georgia, Greenville, Smoky mountain.

Day 1 [Thursday]: Reached Atlanta airport, Hired G6 and drove to Columbus. The drive was roughly 2 hrs. Nice road with decent traffic. Anita [one of ma close friend in college] had really yummy dinner ready for me.

Day 2 [Friday]: Ball Game Day. Friday afternoon, trip with Anita in the Columbus downtown … & abt downtown … hmmmm .. well … actually … no comments! Friday evening, Anita and I went to Atlanta to return the car. At airport, our goody goody friend was waiting for us so patiently. Man .. this guy has lotz of patience. That’s for sure! We went to base ball game @ Turner’s Field - Atlanta Brave Vs Philadelphia. Pretty close game that Atlanta lost in the extra innings. After that, our eyes fest with lengthy beautiful firework show. Back to Columbus to Anita’s place that night.

Atlanta Braves Vs Philadelphia @ Turner Field, Atlanta

Day 3 [Saturday]: Voice Chat with karthick … ma another close friend .. he is in Canada. The moto was to make jealous and I guess we did. Target for the day was Little Grand Canyon. But before going there, we had a hop at few malls. Little Grand Canyon was an hour drive from Columbus. Did a small trail long .. grrrr!!! all thanks to Arun with great sense of direction … After the trail, while we heading back to home, we lucky spotted a lake. We stopped there for the sun set. It was a beautiful evening.

Little Grand Canyon, Georgia Sunset @ a Lake near Little Grand Canyon

Day 4 [Sunday]: Hot day @ Atlanta Downtown. Went to Underground, few parks, CNN building, World of Coco cola and lunch at chennai chettinad. After filling lunch, we went back to Columbus. Thanks to Arun for being generous in dropping us back to home and had to drive back to greenville [4 hrs drive].

Atlanta Downtown

Day 5 [Monday]: Trip to Walmart! … ya .. even i had same reaction. but i just want to go for walk and so near most was walmart! :P

Day 6 [Tuesday-Wednesday]: Anita got awesome yummy choco cake. It was a nice bday celebration. Go to be with very good friends!

ma bday  cake!

Day 7 [Wednesday]: took greyhound to Greenville with a hop @ Atlanta. To Arun’s place. He was pretty gud guy that he came to bus stop to pick me up. That evening we tried to go to a hang out spot. Pool, dance floor and bar. The funny part was that for 3 days continuously we went there but it was closed for the 3 days. So for all the three days… we went for the movies. If we would have gone for 2 more days, the workers @ the movie theatre would be calling us with our name! First time premier show of ma life - Hulk. During the day, I was trying to solve the cube

d one thing which i did durin days @ Greenville, SC - Solve d cube!!

Day 8 [Thursday]: Arun was busy with his work, went out for lunch in a thai restaurant.

Day 9 [Friday]: for dinner, we went to a chinese restaurant with Arun’s colleagues.

Day 10 [Saturday]: Road trip to Smoky Mountain. Lots of trail. By mistake, instead of going for easy trail, we went into the hardest trail and we got exhausted real badly. Then we took a scenic drive. The drive was indeed beautiful but problem was that, we were running low of time, water, food and we need a place to halt. Finally, we found a small town. We had yummy dinner at steak house and peaceful sleep.

Cullasaja Falls, North Carolina Bridal Veins Falls, NC

Day 11 [Sunday]: Drive back to Greenville to get ma lauggage and drive back to Atlanta for Kamal Hassan’s Movie Dasavatharam. We have been fight against with heavy traffic that we narrowly escaped the speed ticket! Sunday night after the movie, Arun dropped at airport. I have to do overnight stay as I got flight next day morning. I had a second thought of visiting Ravikanth.. another old undergrad friend who came to Atlanta recently.

Day 12 [Monday]: I got into deep sleep for few minutes that a gurl woke me up to sit beside me as all the other places have been occupied. Thought i would be having a boring night @ airport, but in turn, it turned out to be an interesting one. She became a good friend of mine and I learned something about Romania and its culture. Yup .. she was telling about interesting Dracula stories. Took the delayed flight and came back to Chicago.

Next Trip to Canada for two weeks. A week with Karthick and a week with ma fav cousin and ma twin bro!!!!

Hey people, I am blogging now after a long time! Now, as everyone knows, I am at Chicago to purse my long time planned goal – Masters in Computers. After some 3 years of corporate life, I am taking a break. Now back to life with books and classrooms!!! Lots of good things have been happening in my life for the last 4 months and I didn’t express my feelings over them to the world.

So this post is going to be a quick recap of what is happening in my life recently!!

First thing, my long awaiting process of getting my graduate college admission and my student visa to US. Probably, many don’t know that I was planning to get into Canadian Graduate School. I, somehow, felt Canada would be right for me and was doing lot of research over it. But again, I had open mind over the country as the education gained and the future is the most important factors for any student. From January of this year, I started getting admission offers from both American and Canadian graduate schools. Later, when it came to finalizing the school, I opted for Illinois Institute of Technology at Chicago with my future and education in mind. Funny part would be shuffling of the cards played by God among my very close friend Karthick and myself. I made my decision over American School where in I was planning for Canadian and vice versa to my friend Karthick :) … That’s destiny, my friend!

After finalizing the destination of next two years of my life, the most important thing for me, rather I would say for any international student, is Visa. Doing your homework on finalizing the school is not everything. Even, you have to put lot of effort on Visa too. Again, you have lot of online resources which could help you through all the steps right from required documents, booking visa date till how to present yourself in the visa interview. My mom and dad came down to Chennai from Patna to spend last few days with me before I travel to US for a long term. My parents pretty well knew that I won’t return home till I complete my education. So my mom and grandma cooked all the yummy foods for me! Folks!!! Seriously, really yummy foods. These are the best days. You can demand a lot and every required mouth watering dishes would be presented right in front of you ;)

Once I got my visa, I had to resign my job. I miss my friends at my work place. They were too good with me. Love you folks!!!

I was on a Tamil Nadu tour to visit all my loved ones. I covered all of my relatives’ places in Chennai on my road trip with my mom. Later, I traveled with my mom and my twin bro to other places in Tamil Nadu. Again, I took advantage of awesome welcome by my aunties and uncles.

Most awaiting day has come! My dad, mom, bro and other closed ones came to airport with me on my travel day to Chicago. Interesting thing was that my friend Srinivasan from my office … ok, I got to say my ex office… was on his on-site trip to Boston. So I made him to travel to paris with me and from Paris we would be catching our respective flights. Aaaah! Guess everyone had a good sleep during the long flying hours. Paris climate was really good and it reminded my UK trip though. At Paris airport, few of my body spray and shoe spray were been disposed. My bad! I didn’t know that I am not supposed to be carrying a liquid of more than certain quantity in hand bag. After another long journey, I was at Chicago airport. Good for me, I landed safely. My dad’s friend’s son, Arun came to receive me at O’hare – Chicago Airport and from there, I caught a taxi to my on-campus apartment. I reached US! To be frank, I wasn’t that excited. Donna why! But I wasn’t. Yup, it was strange feeling though. Probably, my UK trip would have been one of the reasons. I am sure, US has stocked a lot of interesting things for me!

Send off by my family @ Chennai Airport Srinivasan, ma excollegue and a good friend who accompany till paris.

My graduate student life at an American University has begun. Orientation, new friends from various countries, highly qualified professors, good neighborhood, Michigan Lake, Chicago downtown… everything were interesting. Got to accept, there has been lot of activities going on in the campus. Best thing I did after I came here was that I got into Facebook, an online social network. All the activities in the Campus would be posted at my university network in the Facebook.

Regular activities for me for the first semester would be attending classes, exams, assignments, projects, lab meeting, cooking food on Mondays, making friends, online movies and lately got habituated to animes!!! That too, I will watch only in Japanese. Definitely, I would create another post on my anime world later.

Another interesting thing is that I have to do cooking for every Monday – Veg & NonVeg [depends]. I never cooked meat before and so, I started doing my experiments. I have been testing my results over my roomies! Surprisingly, they have been giving positive feedbacks.

When you talk about the weather in Chicago, first two words – wind and snow! If it is a windy day, we could see few thin people floating in the sky. If it is snow, you can’t see anything except white. Two headlines in the news channel – “Snow Storm today!” and “because of heavy snow, there are n number of road accidents!”

But seriously, one has to admire the first snow fall!!! It was really an awesome feeling. It was exactly on Thanks Giving day when I saw first flurries of my life. Wooow!!! They were really gorgeous. After few days, the most awaiting guest made its pleasant visit!! It snowed in the Chicago. When I got up in the morning, all I could see was white, white and white. Everything was turned into white. Everything is pure and divine. I was able to see few of the students came out with joy and started their snow fights! I heard that it would snow till February. So it is going to be simply great winter for me.

Yet another new experience for me would be witnessing hailstorm. It happened well before the flurries on the thanks giving day. Again, as usual, it happened when I was at my room. Suddenly, I realized that it was hailstorm. I was too excited and opened the window. I felt the ice dashing over my hand. It was bit painful but worth to feel the fresh ices straight from the sky. It was simply gorgeous. Right after the two minutes of hungama, two beautiful rainbows gave its presence. Astonishing!!!

Hmmm I had two guests here in Chicago. One was my ex-colleague, Sindha and other was my uncle Ganesh. I met Sindha at O’hare and had a good office talk. Well Ganesh uncle came to my university with his friends. We were on the lake shore drive and had peep over Chicago from the Sear’s tower – 97th floor.

Dr. T.N. Ganesh Sindha

After coming here to this university only, I came to know that there are almost 10 - 12 people during their masters from my undergrad college. One of them is Pandian and he was my batch mates in my undergrad. Oh ya, I forgot to mention about my childhood friend. Even my very good old child friend, Ankita, is doing her masters in this university only.

Parties!! … I was on a Mid Night cruise at navy’s pier organized by my university. Good one. Gambling, dance floor, food and it was one full masti!

Midnight Cruise

I spent last weekend with my undergrad friends Pandian, Arun and Bhuvana. Arun was here from South Carolina on his few days trip to Chicago. Saturday, we have been to Ice Skating, Millennium Park and dinner at an Indian restaurant Hema’s kitchen. Sunday, we were at Museum of Science and Industry and National Treasure II. Then on Monday, we had a trip to Aquarium. Ice Skating was the best of the weekend. Indeed an awesome experience!!! I have done roller skating before but Ice Skating bet it.

Chicago Bean @ Millennium Park Ice Skating @ Millennium Park

Hmmmm … what else??? I believe I covered almost all. Now, I am trying my level best to spend my winter break wisely. Trying to do some learning work done before my next semester starts which would be January 22nd 2008. Love you mom, dad and bro and miss you a lot!!!!! Hugs to all of my friends at India!

13th May, 2007

Faster than light!

Today, I slept by 5am and got up by noon. It was good sleep with lot of interesting dreams floating in my mind. After some television and my heavy lunch, I was lying on my bed for a while and left my mind for free thinking. I observed that my wall clock was showing the time wrongly. It was 10:30 am in my clock. Probably its battery would have been dying out. Well, it made me to think that I have wasted my time and it is 2 pm. It would be really great if the clock was right and it is actually 10:30 am. Probably for which, I guess I have to travel against the time to regain the time.

Hmmm … interesting thought though, lemme continue my imagination and proceed further. What should I have to do in order to get it done? Simple! Catch a flight and fly towards west. But dude! It takes more time in traveling. A super fast flight would be the ideal solution for this problem. Ok! Let us do some serious thinking here. Whether we can gain time more than 24 hours and use it wisely. Yup! It is possible. How about we begin our day at east most part of the earth and complete our 24 hours and then from there, we will use our super fast flight to travel to west most of the earth and complete the day there. ;) isn’t amazing! I would say Wooooow for having approximately 48 hours in a day!

Time Vs Human

 

Just think, if we can make it happen, then for sure, everyone can double their productivity and Earth would be growing twice its current pace. It would be very interesting if it happens that way. We can find people working in different country and stays in different country. Probably, the west & east would be financial & industrial hubs and center of the earth would be residential. On the lighter part - person staying in Singapore would say “Honey, I am back. Got caught in traffic in Europe!” Yup, each one would own a private super fast flight just like car of our current era. We would be having highly advanced technology facilities and pollution free world. Oh ya! Earth would have facilities in different planets to accommodate the growing population. I guess, for vacation, people would be making trips to Pluto and various other planets and these trips should take a day or two to make it.

You might be thinking about terrorism and cooperation between the countries. I would say, by then, every individual would be named as a citizen of earth and group under human race. There would be one democracy. Every country would be working together without any mental variance. There wouldn’t be one currency and one language. It doesn’t mean people would forget their culture. They would be preserving their culture as how it’s been happening nowadays. What would be the occupation of the citizens by then? It should be pretty much the same. The only difference would be the scope of their work. It would be more advance and high tech.

Who knows whether my imagination would come true or not! But somewhere deep in my heart, it says YES! Let’s keep growing and improve humanity.

12th May, 2007

Cricket 2007!!!

Batsman

Hey People, with end of the world cup, I have removed the match tracker from my homepage. Hope, everyone had good fun during the World Cup 2007. Well, it was kinda disappointing for me as Indian Cricket Team walked away from the Caribbean without the trophy :( … Anyways that’s the Cricket all about - winning and loosing is part of the enjoyment. Now with more crickets coming up, I know that you, all cricket fans, would be really excited and looking forward to it. Oh ya … India won the ODI series against Bangladesh … yup the same team who took away Indian cricket team all by shock in the World Cup.

Well well, there is gonna be an African Vs Asia cricket tournament held this June. Watching best of Indian, Pakistan, Srilankan & Bangladeshi players in Asian XI team would be feast to the cricket fans. And the best part is that it’s gonna held in Chennai, India (atleast that’s what I heard)… probably I gotta get my tickets booked. Then comes the India tour to Ireland & Northern Ireland … gosh!!! If it was last year, I will be in one of the Ireland stadium and cheering for the Indian Team. Not to forget about the 20-20 world cup planned for this September. Let’s hope, India does some magic over here.

Indian Cricket Team,
we would really like to have you as the world’s top ranked cricket team. All the best for 2007! Lets forget the past … future is in our hand!

Post from the tracker in the homepage:
:: ICC Cricket World Cup - West Indies 2007::.
Sixteen Team fighting for a gorgeous cup @ Caribbean. Sixers, boundaries, dives, catches, square drive, off break, leg spins, googly …. damn, I love this game!!!

Skateboarding, Snowboarding, Sandboarding … Hmmm whats up with Footboarding! Oh ya, I am writing this for all the people, who didn’t visit India or some of the countries where footboarding is very usual. Of course, don’t carry on with this statement. You can’t find footboarding in all over India.

In one of the discussion with my friends @ UK, we were discussing about the Indian Traffics. I almost forgot to tell an existing activity … Foot Boarding. If you ask any of the College student or ex-college student the question … What is fun thing you can think when it comes to Bus? Everyone would say in chorus, all about the foot boarding. It is as equally fun as the risk involved in it. Ok, enough of suspense; lets know what exactly it is and how to master it.

Usually, most of the regular buses don’t have any doors at passenger entry & exit. The youth usually hang over at the foot steps of the bus. Sometimes, people have to do because of the over crowd in the bus. Generally, you can find almost 6 to 7 foot boarders on each doors in a very crowded buses, literally, standing on the thumb finger of one of their legs and one arm holding part of the bus (Sometimes, you have to manage with just fingers of your one hand). Along with fun & heroism, comes a great responsibility – withstanding the weights of the people standing in the stair case while the bus is turning. The real experts – the gods of foot boarding … you can find them hanging over the windows of the bus with their legs hanging over in the air. You can see them hanging as long they want and if they feel boring and can’t able to place a finger of their legs in the foot board, they always opt for climbing over the window. :) Oh ya, I have seen many experts do that. Of course, you would get scolding for doing that from the public.

Now, it is time to get expertise on foot boarding. To be a good foot boarder, you gotta be a person with good arm strength & running stamina. It’s all about getting into a running bus and getting down from a running bus safely. When the bus starts from the bus stop, you should start running along with bus. After reaching few distances, try to hold a bus comfortably and then jump into the bus. The experts would try to place the tip of legs very firmly. Anyways, you would find people giving you space to keep your foot and if you slipping off, they would tend to pull you in with scolding. Well, scolding is part of the learning. So, no worries! Amateur should try with slow speed and empty buses. They can try get into the bus or get down from the bus when the bus is moving very slowing. With experience, they can try with high speed and crowded buses.

So, to state,

“Experience is directly proportional to Speed of the bus & Crowd in the foot board.”

Some simple tips which you gotta keep in mind, while getting down from the bus, run along with bus till you can control your speed and slow down. Don’t keep your legs stiff as it would hurt you. Be very careful when you try the front door as they are very risky when compare to back door. Another fact you got to calculate is the height of the first foot board from the ground level. There can be some bus with high and some with low foot boards. If it’s high foot board, you gotta build some air while you jump into the bus.

You might be thinking that why one should try these if there is so much of risk involved. Answer is simple - Fun, Heroism, Grab very quick attention of crowd and of course Gurls ;) Com’on every college goer would like to grab attention of girls.

Behind the scene, the credits go to the bus driver. He has to drive very carefully as he has to keep the foot boarders in mind while driving closely to some other vehicles.

However, Governments are playing their roles by instructing how dangerous it is to indulge in these activities. They have been introducing more buses on the busy tracks and also they are introducing closed buses.

As said before, be careful. Safety First, Fun Next. If you can’t expertise, enjoy by watching others do the tricks!!

I was on a week off and was wondering how to set up a radio station within a network or to host in the internet. It would be really kool to have our own radio stations with our name on it. Wooow!!! That’s impressive. So first thought that was running in my mind was “How about creating streaming software? Well, it can be a very primitive Radio Station … and hmm … I can do it with Java or Flash”. But later I made up my mind to try out for existing tools first instead of creating one.

Well, the typical network radio station works as below:

There are three roles in setting up a Radio Station: Server, Source & Listeners.
Servers: The ones who receive the audio streams from the Source and broadcast them to the Listeners.
Sources: The ones who create the audio streams and push them to the Server. RJ & DJ play their creative role out here.
Listener: The ones who register to the server for the audio streams. Musiz Lovers freaks out here.After knowing about architecture, let’s start our dig for radio tools. Based on my quick search, I found two free radio station servers – Icecast and SHOUTcast . They are very popular and highly voted. They provide support for various players like Winamp, Real player, VLC, Windows media player and others. As far as I read, I understood that if it is Linux, vote for Icecast and if it’s for Windows, go for SHOUTcast. However, I would suggest you to go through the respective websites to know more.
With Windows in mind, I have gone for SHOUTcast. So going forward, I would be talking about SHOUTcast and how to set up the server and source. To talk about the SHOUTcast, it is the product developed by the Nullsoft Inc., the maker of the famous player, Winamp. The site www.shoutcast.com provides very detailed information on its product and is well documented.

Software Required:

  1. SHOUTcast Distributed Network Audio Server (DNAS)- www.shoutcast.com/download/serve.phtml
  2. SHOUTcast source
  3. Winamp player

Setting up Radio Server:

  1. Install the server
  2. The installation package comes with both GUI & Console interface. For ease usage, let’s go for GUI.
  3. Once server is been setup, one can edit the server configuration by clicking “Edit Config” and I guess others are self explanatory.

The “Edit Config” button pops up the config file for the server. Just make sure that your port for this server doesn’t clash with other in your machine J. The server also provides restriction over the number of listeners. Just play with other config values. Read the “readme.txt”. It was really informative.That’s it. You got your server running. Top of it, the server also provides the web interface of its server.

Setting up Source (DJ! Hit d Musiz): This is the interesting part … again its simple. We gonna seek the help of Winamp. All one have to do is setup the Source plug-in to winamp. Got some screen shot for you. Well if you see, you have option for giving the server name, port & the source password (you could find it in the Config file of the server). On the other end, you could a fancy name for your station, your station URL, Genre and many more.The Encoder section provides you the facility to define the bandwidth. CPU usage of the DNAS is very low and I guess one can broadcast 24kbps on a single 300 MHz processor to over 600 listeners.

Moving forward, the input section provides the interesting feature – Switching between the inputs; Yup, from winamp (i.e. music) to sound card input. You can switch to sound card and you can host your program. Just make sure have a good mic with you and enjoy talking. Just a quick note… I was facing an issue while shifting the input mode when my music is being played. So the work around is to pause the current song and then you do the shifting of the input mode. However, other tools also hold plug-in for it to be a source to the SHOUTcast servers. There are some fancy & professional RJ tools out in the market which can help you to tune your RJ skills.


Setting up a listener: Last but not the least, if you are the listener who wants to have good time hearing to mind blowing music eing played @ your favorite stations, all you have to do is to play the play list been offered @ these servers. If you could scroll up to the web interface screen shot, the internal web interface provides a link “Listen”. It provides a “.pls” file and the listener has to play it to tune into the station.

That’s all what I got for you all DJs, RJs & Musiz Lovers! Watch out for more interesting stuffs lining up.

Folks, I received a forward mail with the below article from one of my friends & I found it to be really useful. Go through the below article and refresh your Java Basics.

10 Commandments for Java Developers
By Aleksey Shevchenko
June 12, 2006

There are many standards and best practices for Java Developers out there. This article outlines ten most basic rules that every developer must adhere to and the disastrous outcomes that can follow if these rules are not followed.

1. Add comments to your code. – Everybody knows this, but somehow forgets to follow it. How many times have you “forgotten” to add comments? It is true that the comments do not literally contribute to the functionality of a program. But time and time again you return to the code that you wrote two weeks ago and, for the life of you, you cannot remember what it does! You are lucky if this uncommented code is actually yours. In those cases something may spark your memory. Unfortunately most of the time it is somebody else’s, and many times the person is no longer with the company! There is a saying that goes “one hand washes the other.” So let’s be considerate to one another (and ourselves) and add comments to your code.

2. Do not complicate things. – I have done it before and I am sure all of you have. Developers tend to come up with complicated solutions for the simplest problems. We introduce EJBs into applications that have five users. We implement frameworks that an application just does not need. We add property files, object-oriented solutions, and threads to application that do not require such things. Why do we do it? Some of us just do not know any better, but some of us do it on purpose to learn something new, to make it interesting for ourselves. For those who do not know any better, I recommend reaching out to the more experienced programmers for advice. And to those of us that are willing to complicate the design of an application for personal gains, I suggest being more professional.

3. Keep in Mind – “Less is more” is not always better. – Code efficiency is a great thing, but in many situations writing less lines of code does not improve the efficiency of that code. Let me give you a “simple” example:

if(newStatusCode.equals(”SD”) && (sellOffDate == null ||
todayDate.compareTo(sellOffDate)<0 || (lastUsedDate != null &&
todayDate.compareTo(lastUsedDate)>0)) ||
(newStatusCode.equals(”OBS”) && (OBSDate == null ||
todayDate.compareTo(OBSDate)<0))){
newStatusCode = “NYP”;
}

How easy is it to figure out what this “if” condition is doing? Now imagine that whoever wrote this code, did not follow rule number 1 – Add comments to your code.

Wouldn’t it be much easier if we could separate this condition into two separate if statements? Now, consider this revised code:

if(newStatusCode.equals(”SD”) && (sellOffDate == null ||
todayDate.compareTo(sellOffDate)<0 || (lastUsedDate != null &&
todayDate.compareTo(lastUsedDate)>0))){
newStatusCode = “NYP”;
}else
if(newStatusCode.equals(”OBS”) && (OBSDate == null ||
todayDate.compareTo(OBSDate)<0))
{
newStatusCode = “NYP”;
}

Isn’t it much more readable? Yes, we have repeating statements. Yes, we have one extra “IF” and two extra curly braces, but the code is much more readable and understandable!

4. No hard coding please. – Developers often forget or omit this rule on purpose because we are, as usual, crunched for time. But maybe if we had followed this rule, we would not have ended up in the situation that we are in. How long does it take to write one extra line of code that defines a static final variable?

Here is an example:

public class A {
public static final String S_CONSTANT_ABC = “ABC”;

public boolean methodA(String sParam1) {
if (A.S_CONSTANT_ABC.equalsIgnoreCase(sParam1)) {
return true;
}
return false;
}
}

Now every time we need to compare literal “ABC” with some variable, we can reference A.S_CONSTANT_ABC instead of remembering what the actual code is. It is also much easier to modify this constant in one place rather then looking for it though out all of the code.

5. Do not invent your own frameworks. – There are literally thousands of frameworks out there and most of them are open-source. Many of these frameworks are superb solutions that have been used in thousands of applications. We need to keep up to date with the new frameworks, at least superficially. One of the best and most obvious examples of a superb widely used framework is Struts. This open source web framework is a perfect candidate to be used in web-based applications. Please do not come up with your own version of Struts, you will die trying. But you must remember rule number 3 – Do not complicate things. If the application that you are developing has 3 screens – please, do not use Struts, there isn’t much “controlling” required for such an application.

6. Say no to Print lines and String Concatenations. – I know that for debugging purposes, developers like to add System.out.println everywhere we see fit. And we say to ourselves that we will delete these later. But we often forget to delete these lines of code or we do not want to delete them. We use System.out.println to test, why would we be touching the code after we have tested it? We might remove a line of code that we actually need! Just so that you do not underestimate the damage of System.out.println, consider the following code:

public class BadCode {

public static void calculationWithPrint() {
double someValue = 0D;
for (int i = 0; i < 10000; i++) {
System.out.println(someValue = someValue + i);
}
}

public static void calculationWithOutPrint() {
double someValue = 0D;
for (int i = 0; i < 10000; i++) {
someValue = someValue + i;
}
}

public static void main(String [] n) {
BadCode.calculationWithPrint();
BadCode.calculationWithOutPrint();
}

}

In the figure below, you can observe that method calculationWithOutPrint() takes 0.001204 seconds to run. In comparison, it takes a staggering 10.52 seconds to run the calculationWithPrint() method.

(If you would like to know how to produce a table like this, please read my article entitled “Java Profiling with WSAD” Java Profiling with WSAD )The best way to avoid such CPU waste is to introduce a wrapper method that looks something like this:

public class BadCode {

public static final int DEBUG_MODE = 1;

public static final int PRODUCTION_MODE = 2;

public static void calculationWithPrint( int logMode ){
double someValue = 0D;
for (int i = 0; i < 10000; i++) {
someValue = someValue + i;
myPrintMethod(logMode, someValue);
}
}

public static void myPrintMethod(int logMode, double value) {
if (logMode > BadCode.DEBUG_MODE) { return; }
System.out.println(value);
}

public static void main(String [] n) {
BadCode.calculationWithPrint(BadCode.PRODUCTION_MODE);
}

}

String concatenation is another CPU waster. Consider example below:

public static void concatenateStrings( String startingString ) {
for (int i = 0; i < 20; i++) {
startingString = startingString + startingString;
}
}

public static void concatenateStringsUsingStringBuffer( String startingString ) {
StringBuffer sb = new StringBuffer();
sb.append(startingString);
for (int i = 0; i < 20; i++) {
sb.append(sb.toString());
}
}

In the following figure you can see that the method that uses StringBuffer takes .01 seconds to execute where as the methods that use string concatenation takes .08 seconds to execute. The choice is obvious.

7. Pay attention to the GUI. – No matter how absurd it sounds; I repeatedly observe that GUI is as important to the business clients as functionality and performance. The GUI is an essential part of a successful application. Very often IT management tends to overlook the importance of GUI. Many organizations save money by not hiring web designers who have experience in design of “user-friendly” applications. Java developers have to rely on their own HTML skills and their limited knowledge in this area. I have seen too many applications that are “computer friendly” rather then “user friendly”. Very rarely I have seen developers that are proficient in both software development and GUI development. If you are this unlucky Java developer who has been assigned to create an application interface, you should follow these three rules:

1. Do not reinvent the wheel. Look for existing applications that have similar interface requirements.

2. Create a prototype first. This is a very important step. The clients like to see what they are going to get. It is better for you also because you are going to get their input before you go all out and create an application interface that will leave the clients cold.

3. Put the user’s hat on. In other words, inspect the application requirements from the user’s perspective. For example, a summary screen can be created with paging and without. As a software developer, it might be temping for you to omit paging from the application because it is so much less complicated. But, from the client’s perspective, it might not be the best solution because the summary results can hold hundreds of rows of data.

8. Always Prepare Document Requirements. – Every business requirement must be documented. This could be true in some fairy tale, but it is far from that in the real world. No matter how time-pressed your development is, no matter how tight the deadlines, you must always make sure that every business requirement is documented.

9. Unit-test. Unit-test. Unit-test. – I am not going to go into any details as to what is the best way to unit-test your code. I am just going to say that that it must be done. This is the most basic rule of programming. This is one rule that, above all, cannot be omitted. It would be great if your fellow developer could create and execute a test plan for your code, but if that is not possible, you must do it yourself. When creating a unit test plan, follow these basic rules:

1. Write the unit test before writing code for class it tests.

2. Capture code comments in unit tests.

3. Test all the public methods that perform an “interesting” function (that is, not getters and setters, unless they do their getting and setting in some unique way).

10. Remember – quality, not quantity. - Do not stay late (when you do not have to). I understand that sometimes production problems, urgent deadlines, and unexpected events might prevent us from leaving work on time. But, managers do not appreciate and reward their employees because they stay late on regular basis, they appreciate them because they do quality work. If you follow the rules that I outline above, you will find yourself producing less buggy and more maintainable code. That is the most important part of your job.

Conclusion
In this article I covered ten critical rules for Java Programmers. It is not merely important to know these rules, it is also important to follow them. Hopefully, these rules will help all of us become better programmers and professionals.

About the Author
Aleksey Shevchenko has been working with object-oriented languages for over seven years. He is now implementing enterprise IT solutions for Wall Street and the manufacturing and publishing industries.

 

I got few best practice sites on Java Swing for you folks. Few weeks back, I posted the below links to my team for their references.

  1. Wiki for Java Swing:
    http://swingwiki.org/
  2. The below site holds best practices for Java as a whole which includes Swing too.
    http://www.javapractices.com/index.cjp
  3. Audio – eLearning Presentation
    “Professional Swing: Creating Polished Apps, Part 1/2″ by Ben Galbraith
    “Professional Swing: Creating Polished Apps, Part 2/2″ by Ben Galbraith
  4. JFC architecture
    http://java.sun.com/products/jfc/tsc/articles/architecture/index.html
  5. Look and Feel:
    http://www.javootoo.com
  6. If you still want to learn more then do check out the External Link in the below page.
    http://en.wikipedia.org/wiki/Swing_(Java)
  7. For queries related to Java 1.4, refer our rescuer
    http://javaalmanac.com
  8. I just found the link but need to go through further to comment on it.
    http://www.onjava.com/topics/java/Java_Design

Categories