Test Version: GWT 2.0 and above

Use of “main” method

Each Java class can include a “main” method to perform class execution. This feature is especially useful for experimenting, testing and debugging the pertaining code within the class without resorting to using helper class. Generally it is more efficient and productive to test a particular class (if one already pinpoint the problematic class) rather than to test a whole application that has more overheads and which takes longer time to run. By including a “main” method in class, other developers can also quickly experiment with different API of the code within the class without creating additional testing helper classes. In addition, it is easier to build a reliable application if the classes that make up the application are reliable themselves. Apart from this, the use of “main” method will also encourage one to design the class to be “simplified” so that it can easily test from “main” method.

public static void main(String[] args) // Java’s main method

That to say that the “main” method is not a replacement for unit testing, and vice versa. Their intent and usage are different. Unit testing is more formal whereas the “main” method is less formal. Many test cases are included in unit testing and is run periodically to ensure that nothing break the code and create bug from modified code as in the case of time-consuming build process. Unit testing is usually automated and does not involve GUI interaction since the unit testing can be invoked in command-line prior to software development process like build process or check perform by version control system after code check-in.

On the other hand, the “main” method does not subject to such intense test and is not run unless one modify that class and want to have a quick test ensure correct behaviour and result. Developers are free to change whatever in the “main” method of the class during development as long as the “main” method of the class is not used to start up the application, and not call by other classes (It is bad practice to reference and use “main” method from other class.).


Continue Reading »

Software Requirements:
– Windows OS => WinXP, WinVista, Win7
– Eclipse v3.5
– JProfiler v5
– YourKit v8


A profiler is a very powerful tool to help pinpoint performance and memory issues. It offers a variety of ways to which a developer can help track down classes that lead to dismal performance, inefficiency and memory leak issues. This includes taking and comparing snapshot at certain point in time, watching how CPU time and memory is consumed in realtime in a visual chart and marking interested classes for analysis.
There are many profilers in the markets , both open-source (eg VisualVM that bundled with Java SDK) and commerical offerings. However, this document will show the steps to configure two of the best commerical Java profilers in the market, YourKit and JProfiler, to profile GWT client application in Eclipse in the Windows environment.
Even though both profilers are just as effective and powerful, both use different approach to profile the application.

Still, the following steps will work with any IDE (eg Intellij ) since it is just a matter of adding adding additional profiler’s agent as argument to the JVM. All IDEs allow argument to be passed to the JVM that run the project application.

Yourkit and JProfiler offer a 15 and 10 days evaluation trial respectively.

Continue Reading »

Here is the books I read for February.

imageClosing the Innovation Gap: Reigniting the Spark of Creativity in a Global Economy

Available in National Library

This book presents a well-research study of how innovation has become increasingly important to organizations and nations, and how to build, sustain and leverage on the innovation ecosystem for competitive advantages and business.

imageStart-up Nation: The Story of Israel’s Economic Miracle

Available in National Library

How is that nation that is surrounded by hostile countries and constantly plagued with threat of war and terrorism is been respected and recognized worldwide as a powerhouse for extraordinary source of innovation ? What is it about Israel that attracts Intel to put the company’s future and trust since the 1960s into the hands of Israel chip designers to develop innovative CPU like Pentium, Centrino and the next generation of supercomputer chip ?  Why is that most developed nations with greater wealth, economic stability and excellent infrastructure fail to replicate the culture of innovation and start-up culture of Israel ? All these answers can be found in this extremely well-written book on Israel’s start-up history and culture. By critically looking at past events that shape Israel, the authors uncover the root of innovation of Israel that closely linked to military.

This book uses the story-telling style that effectively captivates the reader with factual dramas and interesting insights. The lessons learnt are well-supported with example and research, and summarized at end of each chapter.

A great deal of material also covers Singapore’s obstacles towards a innovative nation and explains hindrance like rigidity, lack of core value and sense of purpose, inability to attract R&D centres, obsessive focus on GDP, materialism and wealth-building, lack of freedom of speech that discourages questioning mind.


Final variable is used to define constant value and reference, and can only define once. In most cases, declaring a final variable is just a matter of assigning to a primitive value or a object reference directly.  However, in some cases, declaring a final class/instance variable may be more involving especially it get assigned from method that throws Exception (eg API for database access, web access), or it may involve multiple statements. In such cases, the code may become cluttered with class helper method and dummy temporary variable that help define final variable, making the code look less elegant and harder to maintain. The following common ways of declaring a final variable in those situations might look familiar to many.

Continue Reading »


I know exactly what you thinking because it is exactly what I’m thinking when I first see this surreal picture. A picture that is so skillfully doctored to show a large plane landing near to the coastline as short to the start-point of runaway. To created such a illusion with perfectly matched details to thwart even the meticulous critics will require very highly-skilled artist and countless hours of work. Just look at those shadow, lighting and other amazing details that fit so well with the environment, not to even mention that no airline in the world is so sane to put the public in such a dangerous area.

Continue Reading »


I always thought that there is ought to be better way to develop JavaFX application, with kind of similar and gratifying experience as developing Java Swing application. Traditionally in developing desktop application, one normally develop and test using class file to save time, and only uses JAR file for deployment (or if running in mobile emulator or device). However with the advent of RIA platform, the trend is to use a application container file (eg jar, swf) as default way of development since it facilitates seamless running in several modes without hassle (eg as Applet, webstart, and mobile device). Unfortunately, this is rather inefficient if one is developing desktop application, or experimenting with ideas. Unnecessary waiting time only disrupts the creativity and programming flow. Saving a few seconds for every run will accumulate into significant saving of time. Besides, it is rather counter-productive to use container file as the only mode of development if the technology can support alternative efficient way.

Continue Reading »

Here is the books I read for January.

image BlackBerry Planet: The Story of Research in Motion and the Little Device that Took the World by Storm

Available in National Library

This book chronicles the history and rise of BlackBerry devices and the company RIM. RIM shows that the secret to the company’s success is to develop core competency, sustainable innovation and entrepreneurial culture.  A substantial part of the book also highlights on how BlackBerry is used as a effective and indispensable tool in Obama campaigning for president-ship.

image After the Software Wars

Free download at http://www.lulu.com/content/4964815 

This is must read for those who want to get excellent insight into the changing world of Information Technology. A wide range of interesting topics are covered, including Linux, open-source movement, DRM, Google and Java. Basically, all the important things you ever want to know about computer world is covered in this book. Do not miss it especially when it’s free.

image  Programming Clojure

Available in National Library

Functional programming and concurrency are all the rage now as multi-core CPU becomes commodity and trend of the future. Clojure, a derivative of the venerable LISP language running under the powerful Java Virtual Machine, has caught the computing world by storm due to its elegance and uniqueness, combined with unmatched performance. By merging the flexibility and power of LISP with Java, Clojure provides a attractive language for those Java veterans who want to take their skill to another level. And for that, one will need Programming Clojure, the only book currently available for the language. This book provides a great reference and tutorial for those who want to come to speed in learning and using Clojure.

image  iPhone User Interface Design Projects

How does one create a world class attractive iPhone application that is easy-to-use ? What is the thought process in designing and building iPhone application ? What better way to learn about building iPhone application than by learning through actual experience of those who been there.  This book is for those who will want to get valuable insight in creating beautiful GUI for iPhone.

image  Beginning Java Google App Engine

Google App Engine is a disruptive cloud platform not only because of its power. scalability, reliability and ease of use, but also because one can deploy and use application for free compare to other cloud vendors like Amazon. This book will provides a excellent introduction to those Java developers using Google App Engine and explain the concept and technology behind the engine.