Over a million developers have joined DZone.

Interview: Caoyuan Deng on the NetBeans Scala Plugin

· Java Zone

Bitbucket is for the code that takes us to Mars, decodes the human genome, or drives your next car. What will your code do? Get started with Bitbucket today, it's free.

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!

Bitbucket is the Git solution for professional teams who code with a purpose, not just as a hobby. Get started today, it's free.


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}