Programming tip #2 - Use a scrapbook page
If you are a java/j2ee developer who works on a eclipse IDE then you must already be using scrapbook effectively. If not, then it is high time you started using it. A scrapbook page helps you test a piece of code without the pain of writing an entire program. Say you want to test displaying “Hello World” on the console using java. Traditionally you would write something like below.
public class HelloWorld {
public static void main(String[] args) {
System.out.println(”Hello World”);
}
}
But when you open a scrapbook page in eclipse, you just have to write the below statement,
System.out.println("Hello World");
To create a scrapbook page, once you are in eclipse, select one of the folders in your project and right click. Then select New->Other. From the window that opens, select Java->Java Run/Debug->Scrapbook Page. Once the page is created write the above statement. Highlight the statement and click the run button, voila “Hello World” gets printed in the console view. What happens behind is whatever is needed to execute the above statement is automatically added. Ofcourse the main purpose of the scrapbook page is to test a small piece of code, api and/or logic, so that you can save time typing in a complete program.










