Archive | Java

29 September 2009 ~ 1 Comment

Executors in Action – Part 1 – The Life cycle

From the Javadoc … interface provides a way of decoupling task submission from the mechanics of how each task will be run, including details of thread use, scheduling, etc. An Executor is normally used instead of explicitly creating threads. Indeed, Executors provide a more robust and easy mechanism for decoupling of submitting a task, from [...]

Continue Reading

02 August 2009 ~ 31 Comments

If-else vs switch – Which is better?

“Use switch instead of if-else, its more readable and has better performance.” I have to admit that this was one of my favorite code review comment. Until one fine day, while hacking Apache Sanselan’s image format decoding function, I tried optimizing the code based on the same comments and while benchmark there was hardly any [...]

Continue Reading