Archive for the ‘Java’ Category

Will JavaScript 2 be the Future of the Web?

Sunday, May 14th, 2006

In “Brendan Eich: JavaScript 2 and the Future of the Web”, it says:

We were lucky enough to have Brendan Eich, creator of JavaScript, give a keynote at The Ajax Experience.

We have placed the presentation online so everyone can read up on some of the thoughts and discussion on JavaScript 2 and more.

Here we got to hear from the mouth of someone deep into the ECMA process about what we are going to see in JavaScript 2 and importantly why:

So I begin to think that: will the time interval 2006-2010 (4 years) be somewhat too long?

Are there useful tools to speed migration?
* A JS2 to JS offline translator, for example
* Write your web app using JS2 exclusively
* Run the translator over all of your JS2 code
* Serve the translated files to old browsers

The project Java2Script, which I am working on, is providing a Java to JavaScript convertor. To develop web applications, it recommends the way of writing JavaScript in Java Syntax (Actually writing Java totally by IDE and then converting Java to JavaScript).
But some comments sound

“Don’t turn it into Java!�?

These comments do bewilder me and make me think further.
From the above Brendan’s presentation, we can see a lot of syntax improvements, which are popular in Java, C++, Python or Ruby. Maybe we could call them syntax sugars. Sugars won’t be enough. Robust IDEs are needed to help writing or managing those scripts.
So I am thinking: Will JavaScript 2 be on a way of being another language if it is not adopted widely and quickly by Browsers and IDEs while JavaScript 1 keeps being popular? If such things happen, a maybe JS2 to JS converter will always be used. Then JavaScript 2 will be similar to other languages like Java, Python, as those languages also can be converted into JavaScript by convertors. Then a question: why wait 2~4 years or longer for JavaScript 2 syntax sugars? Why not having the syntax sugars of Python, Ruby, Java or C++ right now by convertors?

PS: It seems that I am being affected by Java2Script too deep to make such comments on JavaScript 2.

Java2Script 1.0.0 M1 with support of Java 5.0

Friday, March 17th, 2006

Bugs and Fixes

When running j2sui.jar an error message box about “Failed to load Main-Class manifest attribute from …” popups. And this is a bug when packing j2sui.jar. I realized this bug until these days. And another fixed packed are here:

http://prdownloads.sourceforge.net/j2s/j2s-1.0.0-m1-eclipse-3.1-fixed.zip?download

or make downloads from the updated download page .

News: Java2Script 1.0.0 M1 with support of Java 5.0 (March 18, 2006)

New and Noteworthy
==============
Java2Script Core
—————-

  • Java 5.0 features, includes generic, enums, static imports, enhanced loops, are supported
  • Split a small (less than 8K) Object Oriented JavaScript core libraries (See: J2S Clazz)
  • Optimization on speed of loading J2S application and size of generated JavaScript codes

Java2Script SWT
—————

  • Support resizing of Shell
  • More widgets supported: Slider, Spinner, ToolBar, MessageBox
  • Modal dialog

Object Oriented Programming in JavaScript by Java2Script

Thursday, March 9th, 2006

Summary

It’s well-known that JavaScript is a prototype based or object based scripting language not a complete Object Oriented Programming (OOP) language as Java, which is a well-known and most-succeeded OOP language. As AJAX applications boosting, lots of JavaScript inheritance systems are developing to make codes more readable, more manageable and more developer-friendly. However, polymorphism and super method calling, which are two most important features for OOP, are not implemented or not fully implemented. In this article, a new library will be introduced for JavaScript to simulate a complete Object Oriented Programming. And a new Eclipse JDT plugin, named “Java2Script Pacemaker”, will also be introduced to help developers in converting Java codes into Object Oriented JavaScript codes directly.

For more, please read the OOP in JavaScript by J2S(Draft) .

Simple RSS Reader by J2S SWT and AJAX

Wednesday, February 15th, 2006

News: Feb 16, 2006
J2S provides two more tutorials:

Here, take a look at the RSS Reader
http://idwhiz.vicp.net/examples/net.sf.j2s.examples.RSSReader.html.
May need patience for the loading…

Asynchronous Programming

Saturday, February 4th, 2006

Just keep the comment back from Youngpup’s Managing complexity in asynchronous GUIs - Words
Comment URL:http://youngpup.net/2006/20060128022344/comments#c2089

I also thinking about asynchronous programming these days not only for JavaScript but also for Java.

These days, I dedicated in open source project Java2Script Pacemaker at Sourceforge.net. It will provide tookit to transform existed Java codes into JavaScript codes, including the possible UI widgets (Eclipse’ SWT). But one problem must to be solved is blocking and threads. AJAX, the essential part is “A” which is asynchronous programming. But what about asynchronous programming is brought into the Java’s object-oriented programming?

Already, Java programmer can use system native semaphoro or thread to implement blocking. For example, Java programmer will open a dialog and wait for response result:


1
2
3
4
5
6
Dialog dialog = new Dialog(…);
int result = dialog.open();
if (result == OK) {
String name = dialog.getUserName();
….
}

But in the asynchronous programming, it would be something like this:


1
2
3
4
5
6
7
8
9
10
11
final Dialog dialog = new Dialog(…);
dialog.register(new Runnable() {
public void run() {
int result = dialog.open();
if (result == OK) {
String name = dialog.getUserName();
….
}
}
}
// return here!

Once the Java codes is asynchronous-oriented, I think the Java codes can be exported into JavaScript codes directly by Java2Script Pacemaker.

But in fact, asynchronous programming or refactoring existed synchronous programmed libraries into asynchronous-oriented libraries will require times.