How DukeScript works:
The key idea behind the DukeScript UI is created by using HTML/CSS and used particular libraries like Knockout and create data models in Javawith their values automatically bound to HTML elements. This means that Java code doesn’t work directly with HTML via the DOM, instead generate models using annotation and bind them to HTML by specific ids for both the HTML elements and the model properties. According to Tulach, the API also works withControls.js, and support for other frameworks can be added (Angular.js, etc.).
Environment Specification for DukeScript:
To run the Java code on the desktop, DukeScript leverages the Hotspot Virtual Machine (VM). For Google Android devices the Dalvik VM is used, and the DukeScript application is packaged and deployed with the DlvkBrwsr plugin. Apple iOS devices used RoboVM and iBrwsr. The Bck2Brwsr VM allows Java to run in plugin-less browsers.
Scope of DukeScript:
Create DukeScript Application using Maven:
There are many ways to start developing HTML for Java application; Mavenand NetBeans wizards are mostly used. Here we are going to create a simple DukeScript application using Maven. Step1: Create the Maven project, execute following command on the command prompt, before execution make sure at least JDK7 is installed on the machine. mvn archetype:generate -DarchetypeGroupId=org.apidesign.html -DarchetypeArtifactId=knockout4j-archetype -DarchetypeVersion=0.7.5
Step2: Set the required details of groupId, artifactId, version and package details during Maven build process. Its download whole the internet dependency.
The generated application is built around two Java sources (uses the Model annotation to auto-generate another Data.java class during compilation) and one HTML file (uses the Knockout syntax to data-bind the HTML elements to the generated Data model). Main.java, DataModel.java and Index.html are the dummy files which are auto generated by the Maven. Step3: Run the application by executing the command “mvn process-classes exec:java” on the command prompt. It opens the browser and loads the index.html page. Now environment and resources are available which are required to execute the DukeScript application. Now it’s the time to modify the code and play with new technology.
API is part of NetBeans.org project and it works with the NetBeans IDE. On the other hand, the API uses nothing specific to NetBeans, it builds on standard Java6 APIs and works fine in any IDE. NetBeans wizard provides an easy way to set up the application.
Features of Duke Script
- HTML5 & CSS3 - DukeScript supports the latest in browser based UI Technologies.
- Responsive Design- Use DukeScript with frameworks like Bootstrap for responsive layouts
- Stable & Slick- Use Rock Solid Java technologies for your business logic, and the latest in UI technologies for a clickable design.
- JSON- DukeScript naturally supports JSON for talking to Restful Web Services.
- AppStore Ready-DukeScript is your easy path to monetize your mobile apps.
- 5-star Support- Professional Training, Consulting and Support is available for all your DukeScript needs.
Limitation and Future Improvement:
Bck2Brwsr currently has some limitations. It does not use reflection and the “goal of this project is not to execute any existing Java library. It is expected that libraries for the new, limited environment need to be specially designed.” There are a number of improvements that would be implemented in the future as follows:
- Use Closure compiler to generate more compact code
- Access to multipage via sammy.js or crossroads.js
- Method and field overriding with various modifiers
- More reflection support
- No private method/field/constructor/class access
- Probably no field access
- May need constructor access
- Performance benchmark Sci2000
- Investigate generating asm.js friendly code
- Generate Java wrappers for all HTML5 elements dynamically