A new programming language named Xtend has been recently launched by the Eclipse Foundation. This language is intended to address the shortcomings of Eclipse Java but without replacing it. The purpose of Xtend is to add more features and make Java more convenient and readable for the developers and encourage them not to find other alternatives to the Eclipse Java. In certain situations where Java fails to deliver suitable solutions, Xtend can be used to offer right kind of solutions.
Xtend can be taken as a set of plugins for already installed Java Development Tools (JDT). The features of Xtend easily comply with readable Java code and it supports several important features of Eclipse Java IDE such as content assistance, rename factoring and syntax coloring etc.
Xtend maintains static typing of Eclipse Java, but also creates “type inference”. This way the program reduces the amount of redundancy in the Java code. Thus, the concerns and issues related to the Java file’s technical redundancy can be addressed to a large extent using Xtend.
There are several important features that Xtend can add to the Eclipse Java programming. These features include Switch expression, Template expressions and several Extension methods. In the Eclipse environment, Xtend’s library exists as a thin layer over the JDK. This interacts with the Java code in the same manner it interacts with the Xtend code.” Using Java you can call the Xtend code.
Now, here are some basic tips for using Xtend:
1. Addition of new files to the project
If you want to add new class to the Eclipse Java project using Xtend, you can go to File->New->Class. The New Class Dialog box will open before you. Using this dialog, you can also select a few specific properties for the class. You can fill in the particular info for your class and click on Finish and the features of your class will be defined.
2. Building of new project
In order to compile the.java files into.class files, you can go to Project->Build All. After that, you can Build Projects and can compile those.java files only that haven’t been compiled so far.
3. Running your program
For running your program, it’s essential that your code has been compiled without errors. Thereafter you can click Run->Run… or click on the button that appears like the ‘Play’ button of common audio/video programs. Then select the Java Application and then click on New. Then you will get an opportunity to select the class’s main() to be used as a starting point of your program. Eclipse Java will automatically and effectively filter out those classes that are without a main(). You can also have an opportunity to specify any arguments that you wish to pass to main(). Thereafter you are ready to hit the Run button and the project will start running.
4. Debugging your program
Debugging is an important aspect of developing, modifying and deploying your apps. In order to debug your program, you can click on Run->Debug…. A dialog box will pop up which is very similar to the one that you used while running the program. Now when you will click on Debug, your program will start running. You can stop the debugging process any time you wish by clicking Run->Terminate. If the debugging is completed, you cannot terminate the program from running.