Friday May 19, 2006
Project Semplice - Visual Basic for the Java Platform Yesterday we - that is Tor Norbye, John "Get a blog" Kline and I - presented our project at JavaOne in session TS-3576 under the deceptively unexciting title "Visual Basic and the Java Platform". Well, it actually is "Visual Basic for the Java Platform"!
We are in the early stages of development for a compiler and tools for writing Visual Basic (VB) programs for the Java Platform. That means we will compile VB source code into Java class files that will run on the Java Virtual Machine. Even better, you will be able to import existing VB6 applications into any of the Netbeans family of tools and continue to work on them. Of course I must add a word of caution at this point. If your existing VB6 application contains any calls to the Windows 32 API, we will not be able to emulate all these entry points. We will also not be able to handle any OCX controls that you don't have the sources for. That said, let me show you some of the stuff we demoed yesterday in our session. The slides of the session are also available on the JavaOne website.
Importing and Maintaining an Existing VB6 Application
Our first demo was to import one of the sample applications that comes with VB. We imported the Calculator project, compiled and ran it. Next we made a modification to the Calculator by changing the 'X' character on the button for the multiplication operator to the '*' character. This also required a modification to the source code as well because it checks for 'X' and now needed to check for '*'. We then recompiled and ran the Calculator again and voila, we could use '*' as the multiplication operator!
Creating an new VB Application from Scratch
The next demo was to write a Celsius to Fahrenheit temperature conversion application from scratch. We used the Netbeans GUI builder to create the form and then added an event handler for the conversion button. In the event handler, we take the contents of the Celsius textbox, apply the conversion formula and output the result into the Fahrenheit label. Note that in Basic you do not need to worry about type conversions as you need to in Java. Note also that we are taking advantage of default properties in this example.
Creating an new VB Application that interfaces with a Java Class
An important thing for us is to allow VB programmers access to the all the existing Java Beans and libraries. Therefore, we wrote a VB application that called a Java class for our next example. The application finds all prime numbers in the range from 1 to 8192 using the Sieve algorithm by Eratosthenes. The application has a UI written in VB from which we can call the Java version of the algorithm as well as a VB version of the same algorithm. Note that the runtime of the Java version is slightly faster because the VB version uses non-zero-based arrays, which causes a slight overhead at execution time. We will try to make some improvements here in the future. Disregarding the aforementioned non-zero-based arrays, the performance for VB compiled and Java compiled applications is very similar.
Calling VB Classes from a Java Application
In the previous example, we showed how to call into Java classes from a VB application. In the next example, we will call a VB class from a Java application. We will take the Sieve algorithm again, except this time we are writing a Java UI and call the Java version and the VB version from there. Also this time we are going to deploy the application to the SavaJe Jasper S20 cell phone. Yes, that means that VB is running on a cell phone! Note again that the VB version of the algorithm is slower because of non-zero-based arrays.
A Fractal Application
For our last demo we downloaded a VB application that computes a fractal (similar to the famous Mandelbrot fractal). We also obtained a version of the example that was compiled into native code with the VB6 compiler. As you can see in the screenshot (the upper left corner of the fractal shows a label with the time it took to compute the fractal), the Java version performs significantly better than the natively compiled original. Be aware though that a performance of this magnitude cannot be expected for all applications.
What's next?
We would like to hear from you! Is this a project that you could use, either yourself or in your company? Do you prefer VB6 or VB.Net? Are there any extensions to the VB language you would like to see?
Looking forward to your comments and happy programming!
Technorati Tags: VB, Visual Basic, Java, JavaOne, Project Semplice
Posted by herbertc ( May 19 2006, 01:55:00 PM PDT ) Permalink Comments [64]
Posted by Jesse Wilson on May 20, 2006 at 11:56 AM PDT #
Posted by Rob Abbe on May 20, 2006 at 07:26 PM PDT #
Posted by Ghetto Java on May 21, 2006 at 05:56 PM PDT #
Posted by allanctan on May 22, 2006 at 01:59 AM PDT #
Posted by John Paul Alcala on May 22, 2006 at 02:32 AM PDT #
Posted by Dan on May 22, 2006 at 07:28 AM PDT #
Posted by Willie on May 22, 2006 at 09:09 AM PDT #
I have been working down the code conversion route targeting MS Access migration but your project puts my rather feeble efforts in the shade somewhat!
I particularly like the fact that you will give VB coders a running start in the Java world.
Is this project Open Source? Also any time scale on availabilty?
Posted by Pete Morgan on May 22, 2006 at 10:52 AM PDT #
Posted by sim085 on May 23, 2006 at 10:59 AM PDT #
Posted by HerbertC on May 23, 2006 at 12:20 PM PDT #
Posted by stepan on May 23, 2006 at 01:43 PM PDT #
Posted by Larry Roth on May 23, 2006 at 10:30 PM PDT #
Posted by Vinicius Godoy de Mendonça on May 23, 2006 at 11:21 PM PDT #
Posted by Oprah on May 24, 2006 at 07:37 AM PDT #
Posted by Jonathan Brighes on May 24, 2006 at 09:08 AM PDT #
I'm fascinated. I have been thinking about this WAY too much since I first heard the announcement.
My thoughts on what Semplice could/should do were too long to post here so they are at http://www.spatialmedia.com/pete/semplice_musings.htm
In short, IMHO Semplice should do "VB7 but not VB.NET".
What really fascinates me is the possibility that the core Semplice language might evolve as the (inevitable) cross VM language.
Comments along the lines of "too late" and "not useful without OCX's" are short sited. This is a long (tail) game. Those controls and the code calling them *will* be replaced *by something*, one day. (I do however admit to speculating about the Semplice project living with the 1.1 SDK and thus unofficially supporting COM addicts via the MSJVM :>)
I hope the Semplice project doesn't get lost trying too hard to emulate VB6. Obviously Sun smell an opportunity but I personally figure Microsoft have tilled this ground about as well about as it should be tilled.
Meanwhile, i guess I should get busy again in J# writing classes with COM wrappers so I can call them from VB6. If anyone asks, I am writing "Semplice ready" Basic :)
Posted by Pete F on May 24, 2006 at 08:23 PM PDT #
Posted by Paolo on May 24, 2006 at 11:34 PM PDT #
Posted by .:: a few thoughts on the subject by rob wright ::. on May 25, 2006 at 11:53 AM PDT #
Posted by Anton Fend on May 25, 2006 at 01:00 PM PDT #
Posted by Andre Charland on May 25, 2006 at 04:24 PM PDT #
Posted by Tim Bernards on May 28, 2006 at 05:29 PM PDT #
Posted by Jonathan Neve on May 29, 2006 at 11:46 PM PDT #
While Semplice would have helped me the most if it arrived some two or three years ago, I still think it is a great project. My opinion is that it's best opportunity relies in supporting the old school VB6- niche, rather then competing with VB.NET.
Having virtually started my professional career as a VB developer, I've learned to hate Microsoft's rendition of the BASIC language almost as much as to love Java. Even so I recognize the possibilities here: the new JVM environment will not only breath new life into the VB world, but also, for the ones that'd rather got out, will provide a viable migration path.
I do not fear the absense of win32 calls or support for binary OCX controls. If my experience is any guide, Java's vast API and huge collection of third-party projects will, when not provide perfect replacements, make it trivial to build them ourselves.
Posted by Helio Perroni Filho on May 31, 2006 at 04:51 AM PDT #
My company has a lot of BASIC working code, and it would be interesting to try conversion.
Just a few things would be easier in BASIC.
First time I heard of a BASIC plug in for NetBeans, though.
Posted by JanCarel on June 01, 2006 at 01:31 PM PDT #
Posted by OneNerd on June 02, 2006 at 07:42 PM PDT #
Posted by James Taylor on June 09, 2006 at 09:16 AM PDT #
Posted by John Meyer on August 16, 2006 at 04:29 AM PDT #
Posted by Ivan Jovanovic on August 17, 2006 at 08:53 AM PDT #
Posted by Harri on August 28, 2006 at 06:13 AM PDT #
Posted by Richard Grier on August 29, 2006 at 11:49 AM PDT #
Posted by Frederico Costa Goulart on August 30, 2006 at 05:26 AM PDT #
Posted by Lax on September 02, 2006 at 09:25 PM PDT #
Posted by Technology and Butterflies on September 07, 2006 at 08:12 PM PDT #
Posted by Sveinung on September 12, 2006 at 06:11 PM PDT #
Posted by Dee on September 15, 2006 at 11:42 AM PDT #
Posted by HerbertC on September 16, 2006 at 07:41 AM PDT #
Posted by Nick Hebb on October 03, 2006 at 11:02 AM PDT #
Posted by C_Dayan on October 03, 2006 at 11:56 AM PDT #
Posted by Wayne B on October 03, 2006 at 05:44 PM PDT #
Posted by MP3GMike on October 17, 2006 at 08:55 AM PDT #
Posted by manna on October 19, 2006 at 01:21 AM PDT #
Posted by Cristian Moyano on December 01, 2006 at 09:53 AM PST #
Posted by monideep on December 08, 2006 at 12:38 AM PST #
Posted by Juan on January 08, 2007 at 04:05 AM PST #
Posted by Mike Doty on January 29, 2007 at 07:05 AM PST #
Posted by nyomdasz on January 29, 2007 at 02:44 PM PST #
Posted by Juan on January 30, 2007 at 03:42 AM PST #
Posted by Rik on February 16, 2007 at 03:01 AM PST #
Posted by Raymond on February 27, 2007 at 07:31 PM PST #
Posted by Jack Garvey on March 07, 2007 at 07:46 AM PST #
Posted by Chinnaraj S on March 12, 2007 at 04:02 AM PDT #
Posted by alex on March 20, 2007 at 10:25 AM PDT #
Posted by Premakanth on April 30, 2007 at 04:34 AM PDT #
Posted by chris on May 08, 2007 at 09:32 AM PDT #
Posted by chris on May 08, 2007 at 09:34 AM PDT #
greeting cards
dogs
Posted by Gal on June 04, 2007 at 04:08 PM PDT #
Posted by Damien Jorgensen on June 22, 2007 at 12:36 PM PDT #
Posted by IvanS on July 13, 2007 at 07:49 AM PDT #
Is this project still active? As a VB6 coder considering the leap to either Java or C++, Semplice would be the perfect solution! And there are millions of other VB6 coders out there who are looking for their next programming language and are not sure which way to turn. My personal opinion is that Semplice would make the decision for them...
Posted by phil on August 30, 2007 at 12:52 PM PDT #
Learn Microsoft sharepoint from http://hotsoftwareslist.blogspot.com/2007/10/learn-sharepoint-freely.html
Posted by fastcoder on January 20, 2008 at 11:42 PM PST #
Do you want to Learn Sharepoint ???
Learn Share Point freely
http://hotsoftwareslist.blogspot.com/2007/10/learn-sharepoint-freely.html
Posted by fastcoder on January 20, 2008 at 11:44 PM PST #
The source code will be released some time?
It is just for technical curiosity.
If you did for VB, why not for COBOL or RPG?
Regards.
Posted by Sergio Samayoa on February 10, 2008 at 01:06 PM PST #
hey this defenetly advanced it is too different but is a oppurtunity to develop a new software environment.
Posted by saiprasad_akuthota on March 03, 2008 at 02:25 AM PST #
hi! can you do me a favor? can you make an java cell phone application a simple one that can convert fahrenheit to celsius? please? i need it now. i need this code for me to pass my course. please? i need it badly...
Posted by meg on March 30, 2008 at 07:52 PM PDT #