All | BASIC | Personal | Sun
« My JavaOne Top 10... | Main | Project Semplice -... »
20060519 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: , , , ,

Posted by herbertc ( May 19 2006, 01:55:00 PM PDT ) Permalink Comments [64]

Trackback URL: http://blogs.sun.com/herbertc/entry/project_semplice_visual_basic_for
Comments:

This is definitely something I could see being used at the company I work for. We are traditionally a VB/VBA development company that has recently made the switch to Java for the majority of current and future projects. Given that not all our development team is well versed in Java programming, utilizing their present VB skills would be wonderful. In terms of VB version, I would have to say VB6 would be the most beneficial to our company, with our use of VBA.

Posted by Jesse Wilson on May 20, 2006 at 11:56 AM PDT #

Very cool. We have a huge investment in VB6 code. I can't wait to give this a try.

Posted by Rob Abbe on May 20, 2006 at 07:26 PM PDT #

I'm not an advocate of VB*, in fact, I can't stand it. But I think this is pretty damn cool.

Posted by Ghetto Java on May 21, 2006 at 05:56 PM PDT #

I think this application is late. This should have been done before, when client-server is more evident in the enterprise. Unless this application can webify the VB codes, I don't see much future use. Today, we are seeing Google Desktop and Ajax come into market which has potential to replace desktop applications.

Posted by allanctan on May 22, 2006 at 01:59 AM PDT #

Giving VB developers the chance to code in VB and compile it as a Java program can help many old school developers migrate into Java. However, VB and VBA are inherently procedural. Converting the VB code into something object oriented brings alot of questions, such as performance and maintainability. Let's wait and see how this develops...

Posted by John Paul Alcala on May 22, 2006 at 02:32 AM PDT #

This is cool stuff, but I can't help but feel it's 5 years to late. A lot of the VB6 crowd have moved to c# and vb.net already. Also this doesn't appear to be teaching people the Java language. The fact you can use it to develop mobile phone apps is the killer for me. I can't wait to get started on writing simple phone apps. It would be good to see demos screencasts that connect to databases, most of the VB apps I wrote were all about connecting and updating a database. If they can handle that without locking the UI thread it'd be cool. But for me it's about phones. A webservice control where you do little more than give it the WSDL would be great... but for the phones. Man that'd be cool.

Posted by Dan on May 22, 2006 at 07:28 AM PDT #

Do you have plans to support VB.Net?

Posted by Willie on May 22, 2006 at 09:09 AM PDT #

I've been a firm believer in the concept of VB to Java migration for some time.
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 #

hmmm ... in the article you said that you will be able to run the VB code into the Java Virtual Machine .. is it asummed that the code I compiled is still multi-platform?

Posted by sim085 on May 23, 2006 at 10:59 AM PDT #

sim085, yes, it is in good Java tradition, compile once, run anywhere.

Posted by HerbertC on May 23, 2006 at 12:20 PM PDT #

VB6 is always welcome back. Is not to late, there still is thousands of vb6 developers. Look at TIOBE TPC Index (world-wide availability of skilled engineers, courses and third party vendors) .. so many resources for NET developes ? incredibly.

Posted by stepan on May 23, 2006 at 01:43 PM PDT #

Cool demo! I love transitional projects as they give a low effort way for developers to dabble in another language/environment. Java definetly has a lot of advantages over VB, but VB is sure neat for banging out a quick departmental app. It will be interesting to see if VB programmers use this technology to migrate to Java or at least harness some of the power of Java..

Posted by Larry Roth on May 23, 2006 at 10:30 PM PDT #

Several visual basic applications contains calls to WIN32 API and a huge number of OCX components. So, I think this VB6 JVM compiler will not be so useful when migrating legacy code. But, I still think this is a good for transition companies, where VB6 programmers are very common. This is true even if these companies uses .net today, most part of them will have developers who migrated from previous VB6 versions. We could use their skill and in palallel give them a java course.

Posted by Vinicius Godoy de Mendonça on May 23, 2006 at 11:21 PM PDT #

Visual Basic for Java, we young'uns say your name. Say your name.

Posted by Oprah on May 24, 2006 at 07:37 AM PDT #

No Windows 32 API calls or third-party OCX controls? That means this project will be very useful for converting demos such as Calculator, but not very useful for anything else. How many real VB applications don't use Windows calls? Don't take me wrong, this is a good first step. But you will need a Java library to (automatically) replace the most common Windows API calls before this project can be used seriously in the *Real World*

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 #

Definitely interesting. How can we try this marvel?

Posted by Paolo on May 24, 2006 at 11:34 PM PDT #

[Trackback] The news is everywhere now, but there was a sneak-peek by Tor Norbye on the Java Posse about the annoucement at JavaOne. HerbertC’s Blog has the most details. Joe reveals in a later podcast that Herbert is the “compiler guy” in the p...

Posted by .:: a few thoughts on the subject by rob wright ::. on May 25, 2006 at 11:53 AM PDT #

I think this is a great opportunity for java. For a vb6 developer it is not easy to migrate to vb.net either. So this developers might change it to java. Years ago one reason why the microsoft developement tools where so attractiv, was that compared to other tools they where very cheap. In the meantime it is the other way around. A univeral subscription to MSDN ist now more then 4000 EUR per Developer. Netbeans and Eclipse are as good as Visual Studio (I think even better), and they are free.

Posted by Anton Fend on May 25, 2006 at 01:00 PM PDT #

Hey Herb. This seems great for the Java world! I've been involved in countless projects converting VB apps...generally a number of options .net, php and portal type apps (like sharepoint) are looked at. Java has always seemed the furthest off in terms of team skills...so this is great! Semplice and JSC are going to really help lower the bar to Java adoption...and from where I sit this is greatly needed! Anton your comment is true about cost...we just need to keep focused on usability and helping developers who are new this arena!

Posted by Andre Charland on May 25, 2006 at 04:24 PM PDT #

The OO nature of VB.NET code should make it easier to convert to Java bytecode, so I think a focus on VB6 should be the primary goal. However, I'm not rulling VB.NET at all. Once the VB6 emulation is done well, focusing on VB.NET should be eaiser. Mix and matching Java and VB and the resulting code runs on the Java VM which runs on almost all platforms. This is brilliant. I can't wait to test it.

Posted by Tim Bernards on May 28, 2006 at 05:29 PM PDT #

This looks great! I would love to see the same thing done for the Borland Delphi compiler and IDE. I love the idea of being able to use a non-java language compiled into bytecode, as it should make porting applications much easier. I assume you're also emulating the standard libraries that are commonly used in VB, so that existing applications and skills can be reused...?

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 #

I can't wait for the source to be released.
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 #

Certainly a good start and good idea. More thoughs at my blog: . onenerd.blogspot.com/2006/06/run-vb6-code-in-java-did-i-read-that.html .

Posted by OneNerd on June 02, 2006 at 07:42 PM PDT #

Given there are business rules management systems out there that have a better syntax than VB (in terms of letting less technical folks understand what is going on) and that deploy as both .NET and Java objects not sure this has a role except for those converting from VB to Java. Most folks used VB becuase it was supposed to be easier for non-technical people but frankly it ends up just as bad or worse. Using a business rules approach, and a business rules management system, would give you cross-platform and business user involvement and real agility though live updates.

Posted by James Taylor on June 09, 2006 at 09:16 AM PDT #

Is there any updates on this project? How soon might we see it?

Posted by John Meyer on August 16, 2006 at 04:29 AM PDT #

This looks like stealing Microsoft oriented programmers :) Well, I don't believe that this project will make great success or victory for Java platform lovers, but it is an interesting view of the world to mix these competitive programming concepts :)

Posted by Ivan Jovanovic on August 17, 2006 at 08:53 AM PDT #

This is cool, if I could transform a couple of my existing VB6 applications to Java platform this way. It would be even better if it could generate Java source code from the VB6 source code... but anyhow, this way I could make the source code transformation later if I needed to.

Posted by Harri on August 28, 2006 at 06:13 AM PDT #

I think this might be very useful. It certainly is interesting. I'm going to forward the link to this blog to several others.

Posted by Richard Grier on August 29, 2006 at 11:49 AM PDT #

I think this is just the perfect moment for this implementation. Today companies that are based on VB6 platform are making the decision to migrate to Java or .NET. If I were Microsoft, I would pay more attention on this project.

Posted by Frederico Costa Goulart on August 30, 2006 at 05:26 AM PDT #

Support OCX, Make win32 called as easy as 123 and SWT ( We need native controls which will make us feel like home - VB6 )

Posted by Lax on September 02, 2006 at 09:25 PM PDT #

[Trackback] Desi scriam mai demult despre comunitatea Java lucruri nu tocmai placute, in ultimul timp circula vesti care mai de care mai incredibile, vesti care au potentialul de a schimba fata platformei Java si a comunitatii. JAVA va fi open-source cu primele co...

Posted by Technology and Butterflies on September 07, 2006 at 08:12 PM PDT #

First, I think it would be a good idea to make this project free software to make people start implementing the Win32 API and the OCX components as a library. I would prefer if you focused on VB6 since the Mono project probably will make a VB.net compiler that you later can modify (using a .net -> java compiler or directly)

Posted by Sveinung on September 12, 2006 at 06:11 PM PDT #

is this available as an Eclipse plugin... ??

Posted by Dee on September 15, 2006 at 11:42 AM PDT #

Our initial plans are for Netbeans support.

Posted by HerbertC on September 16, 2006 at 07:41 AM PDT #

This is fantastic. Love it or hate it, I still can't fathom how MS turned its back on millions of VB6 developers. It';s nice to see someone picking up the ball.

Posted by Nick Hebb on October 03, 2006 at 11:02 AM PDT #

A wonderful idea and, I know, a lot of work behind the scene! Keep doing this impressive work!

Posted by C_Dayan on October 03, 2006 at 11:56 AM PDT #

I would like to see Static Methods of Classes for the VB6 language.

Posted by Wayne B on October 03, 2006 at 05:44 PM PDT #

It's pretty cool... but how can I get it?... please... a can't wait!!!

Posted by MP3GMike on October 17, 2006 at 08:55 AM PDT #

I m Satisfied with this

Posted by manna on October 19, 2006 at 01:21 AM PDT #

i can“t wait...when will be available?

Posted by Cristian Moyano on December 01, 2006 at 09:53 AM PST #

great

Posted by monideep on December 08, 2006 at 12:38 AM PST #

Great idea :-) I am VB programmer from 1992. Can I help this project? Regards from Spain. :-)

Posted by Juan on January 08, 2007 at 04:05 AM PST #

Is this project still in development?

Posted by Mike Doty on January 29, 2007 at 07:05 AM PST #

When? How? Count me in. Let me know. nyomdasz@yahoo.com

Posted by nyomdasz on January 29, 2007 at 02:44 PM PST #

Thank you, Herbert. You can avoid the suicide of millions of VB users. Please, say to us that still there is hope. :-)

Posted by Juan on January 30, 2007 at 03:42 AM PST #

Simply WONDERFUL!!!!!!!!! We have lots of VB6 code. At least, it should be a good way to gradually switch to Java platform!

Posted by Rik on February 16, 2007 at 03:01 AM PST #

I'm a VB6 developer since 1997 and Microsoft is very expensive and lack on their support especially when they released the VB.Net they encourage C++ and C# language which is very difficult and takes a lot of time to develop. For us VB6 coding is still the best. When can we download this NetBeans plug-in? How can we help with this project?

Posted by Raymond on February 27, 2007 at 07:31 PM PST #

I am very excited about this project. Please finish it quickly. VB6 is my favorite language.

Posted by Jack Garvey on March 07, 2007 at 07:46 AM PST #

When is this available. I am eagar to execute VB style syntax java code using JVM

Posted by Chinnaraj S on March 12, 2007 at 04:02 AM PDT #

On personal opinion, I find this very helpful. Guys, I have also posted some more relevant info further on this, not sure if you find it useful: http://www.bidmaxhost.com/forum/

Posted by alex on March 20, 2007 at 10:25 AM PDT #

i got more usefull details by visiting your web site thank you very much

Posted by Premakanth on April 30, 2007 at 04:34 AM PDT #

tell me how to make a laser program for visual basics tell me how to make the character that u control die or dissaperar when the invadersget too close to you

Posted by chris on May 08, 2007 at 09:32 AM PDT #

ps its vb6.0

Posted by chris on May 08, 2007 at 09:34 AM PDT #

Good to know about union of Microsoft's VB and Sun's Java after their dispute of releasing .NET. I prefer to work with Classic VB. Who's product is NetBeans?

greeting cards
dogs

Posted by Gal on June 04, 2007 at 04:08 PM PDT #

I am not sure how useful this is going to be. There are plently of tools out there to convert old VB code into something else. Seems more logical to convert it into VB.NET, at least you'd be able to use the old COM stuff

Posted by Damien Jorgensen on June 22, 2007 at 12:36 PM PDT #

It's a great idea. I have a lot of middleware DLL which works with DB. Now I can get all of them and place it to the server without any problem (some additional code needed). And now I can use it from AJAX apps (for example, using GWT). Thanks a lot.

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 #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed

HerbertC's Blog






Calendar

RSS Feeds

Search

Links

Navigation

Referers