Tuesday, July 31, 2007

Be Inspired!

Its been a month since I last posted on my blog. I recently watched a replay webcast on Sun's JavaOne Conference. On Sun's general session James Gosling walks on different cool implementation of Java on real world application. From Java-powered submarines, to mission critical applications in financial markets, virtual offices, to a dancing robots. It was really fascinating to see such innovations and what's more inspiring is that they was implemented using Java. Yep, Java is really Everywhere. Its coming out of our offices and into the real world. So Be Inspired!

Thursday, June 28, 2007

How Immutable Are You?

Things are subject to change. Your weight, perspective and even someone's else impression. Good things can turn to be "not-so-good" at an instant. But things are different when it comes to Java String. Thay are "Immutable". Object created by string cannot be changed. If not needed they will simply be garbage collected. I will give you an example:

String impression = "good";
String impression = "not so ".concat(impression);

The output will be the "not so good". But what happened to "good"? The said object are lost but the real impression was never CHANGED. :)

Thursday, June 21, 2007

Defensive Coding

Defense is a method of protecting. In sports like basketball, defense is an act of protecting your opponent to hit the goal. The same is true with programming. Defensive coding is an act of preventing an error to arise or we can say bug-free. Though I believe that there is no really a bug-free application, defensive coding can minimize or even prevent a much more disaster.

So how do we do this in java? There are many ways to implement this. One for example is declaring the right modifier for the right method or class variable.

public int insertValue(){} and public synchronized int insertValue(){} really is different. Both will compile and run. But things will be different when tested in a real environment. Having a synchronized modifier prevent the method on using resources at the same time.

My team manage to learn this new skill. Hope everyone appreciate this.