Geertjan is a DZone Zone Leader and has posted 467 posts at DZone. You can read more from them at their website. View Full User Profile

Interview: Caoyuan Deng on the NetBeans Scala Plugin

12.08.2010
| 11863 views |
  • submit to reddit
Caoyuan Deng (pictured right) is a developer living in Vancouver, B.C. Canada. He's a member of the NetBeans Dream Team. During the recent year, he's been developing AIOTrade, a trading platform, for a Chinese financial company.
 
He's also the developer behind the Scala plugin for NetBeans IDE. In the interview below, Caoyuan talks about the Scala plugin, how it came about, and where it is going!

Hi Caoyuan, how did you get started creating the Scala plugin for NetBeans?

The development of the Scala plugin for NetBeans can be described in four phases:

  • The first phase was in late 2007. I had decided to give Scala a try for my trading platform project, AIOTrade, which is based on the NetBeans Platform. The NetBeans IDE support for Scala was weak at that time, so I began to write the minimal features for it from scratch, before beginning my actual Scala coding. I wrote a LL(k) parser and a simple typer, and got it to a point where it had basic syntax highlighting and code completion.

  • The second phase was in the first half of 2008. I rewrote the lexer and parser based on PEGs (Parsing Expression Grammar) using RATS! (which is a Java PEGs parser generator) and ended up with better syntax and typing features.

  • The third phase was in the second half of 2008. I hacked Scala's native compiler and integrated it into the NetBeans GSF Language Framework. The plugin then got as close as possible to getting the same compilation error messages and syntax highlighting features as Scala itself. The development of the Scala plugin during this phase also gained the gold award in the NetBeans Innovators Grant Contest.

  • The fourth phase was in the beginning of August 2009. Thanks to the new interactive Scala compiler by Martin Odersky, creator of Scala, and Miles Sabin, author of the Scala plugin for Eclipse, I was now able to share the same compiler with other IDE plugin developers. I fixed some bugs in the interactive compiler, moved the Scala plugin for NetBeans to it and that's the plugin released for the NetBeans 6.8 and 6.9 releases. There is an article describing this implementation at http://wiki.netbeans.org/ScalaImpl.

What do you think about Scala, the current state of the language, and why did you like it in the first place?

Scala is the language that I had been looking for, for years. It is based on common programming patterns for concurrent, parallel, and distributed computing. Beyond its concise, elegant, and type-safe approach, it also smoothly integrates features of object-oriented and functional languages with the best interoperability between it and Java.

The first thing that I liked about it is the integrality in its design, such as its function object, extractor, type system and the relation between operator and method call. Every perception was carefully designed throughout, in theory and in practice.

It's very important that the asynchronous message based Actor model for parallel, concurrent, and distributed computing looks elegant and natural in Scala, which all comes from the integrality of its language design.

Current state of the plugin -- what has recently changed/improved?

I'm so busy improving the AIOTrade project, which had been rewritten in Scala since the beginning of the year, which has been my main motivation in creating and improving the Scala plugin for NetBeans. So far, the Scala plugin can usually work compatibly with multiple versions of Scala (from the development cycle of Scala 2.8.0 onwards), with basic refactoring features and a much better debugger.
 
Some screenshots. Firstly, Scala projects in the IDE:

 
Next, find usages support:

 

Finally, the debugger:


Future plans -- where's the plugin going, what would you like to add?

I'll keep improving it, especially the debugger, refactoring and auto-completion features.
 
I may try to move on to support SSP (Scala Server Pages, which is a Scala version of JSP), as well as SBT (Simple Build Tool for Scala), and other similar features.

How can developers contribute?

I've received a lot passionate messages from developers that would like to contribute to this project. I have answered some questions, such as where is the code based, how to build it, etc.
 
But there is an issue that may slow down the contributions, which is that the code is within the NetBeans official "contrib" trunk, and not everyone has the access rights for this. And so I'm thinking about moving the project to an open repository, such as "github", etc.

Anything else you'd like to share about anything at all relating to this plugin that might be interesting to readers?

I love NetBeans and Scala, which is why I working on writing this plugin for NetBeans in Scala. And, as a result, I am writing AIOTrade as a NetBeans Platform based project, in Scala. Actually, the architecture of AIOTrade is based heavily on the message and actor model, including the event listener, the parallel indicator computing, and the distribution nodes computing architecture.
 
I'd like to see more Scala with NetBeans Platform projects and experiences. For example, I know about the Kojo project, which is a Scala application on top of the NetBeans Platform:
 

 
In fact, I've accepted patches and bug reports from Lalit Pant, Kojo's creator. Kojo is a very good project that shows how the NetBeans Platform is suitable for rapid application development and the sharing of modules and pre-existing code. I'd like to see more examples of this combination, i.e., Scala and the NetBeans Platform!


Published at DZone with permission of its author, Geertjan Wielenga.

Comments

Henry Story replied on Wed, 2011/01/12 - 11:31am

For some reason I found the need to download the latest Netbeans 7.0 beta again today. But I can't find the Scala plugins anymore in the plugins section and I added the plugin repository here to the list http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz I downloaded the netbeans beta and it does not have anything either http://updates.netbeans.org/netbeans/updates/dev/uc/final/main/catalog.xml.gz building netbeans from source just seems impossible. I tried hg clone http://hg.netbeans.org/main and it gets stuck at that point for hours. Can't tell if it's progressing really. So where should one get the latest stable plugins? The one on the sourceforge site seem a bit out of date, having last been updated in July 2010. Given that the code is now in Netbeans repo I have a feeling I should get it from there http://sourceforge.net/projects/erlybird/files/nb-scala/

Henry Story replied on Wed, 2011/01/12 - 2:17pm

I ended up finding succeeding in compiling Netbeans and scala from source, as described here http://wiki.netbeans.org/Scala69 (though it took a very long time to download) Then I started netbeans from source as explained here http://wiki.netbeans.org/WorkingWithNetBeansSources It seems to work on today's build....

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.