Tuesday February 28, 2006
Help for Java Keywords in NetBeans IDE
In the Java programming language, there's the concept of "Java Keywords". These are reserved words and the complete list can be found here. For these keywords, I applied the principles discussed in yesterday's blog entry, using short texts from the Java Technology Glossary. As a result, when you press Ctrl-F1 over any of these words, as shown below (here the caret is on the keyword "private")...
...a help topic for that specific keyword pops up:
The help topic is very simple right now (because it comes directly from the Glossary), but it could be a lot more detailed, with little snippets of sample code. The range of keywords covered could also be extended, of course. If the user presses Ctrl-F1 over a word that is not a keyword, the selected word is shown, together with a message (in the example below, the word 'HelpCtx' was under the caret):
If you say "OK", the selected search engine is called up. (As before, there's also a button for sending the current line to the selected search engine, too.) This means that the default browser (specified in the Options window) opens, the URL to the selected search engine (selected in the toolbar, from the drop-down list provided by this plug-in module) is sent to the browser, and the selected word is searched. The browser displays the results.
By the way, Tutorials for NetBeans Plug-in Module and Rich-Client Application Development has been restructured a bit. Also, an icon has been added for indicating whether a tutorial is new. Finally, if you haven't seen Roman's NetBeans Platform presentation on Javalobby yet, you need to do yourself a favor and check it out!
Feb 28 2006, 09:13:16 AM PST Permalink
Send a Word to the Browser (Part 3)
I've worked out something really cool. Say you're new to the Java programming language. You see heaps of code in the editor, with identifiers such as "public" and "private" and so on. You don't know what these terms mean. So you use the plug-in module I blogged about yesterday (or you use Ramón's plug-in module, which is discussed in yesterday's blog too, and which does the same thing as mine). In other words, you select a word and then you click the "Word" button (in my plug-in module) or select the appropriate contextual menu item (in Ramón's plug-in module) and then the browser opens, the selected search engine is found, and a search is done for the selected word. However, a problem then arises—you get way too many responses from the search engine. Some of the responses are garbage and all you want is to know what "public" or "private" means. Wouldn't it be better if, instead of going to a search engine, you'd go to the IDE's internal help system instead?
So, that's what I've been working on today. Instead of going to the Internet, you go to the internal helpsystem (ultimately, once it is finished, if a word is not covered in the internal helpsystem, you will be informed about this, and then you will be asked whether you want to continue your search by going to the selected search engine).
This is the code that makes it all possible (the section I've highlighted is the part that I added to bring the internal helpsystem into the picture):
public static void sendWordToSearchEngine(JTextComponent textComponent) throws BadLocationException, MalformedURLException {
JTextComponent editor = Registry.getMostActiveComponent();
int pos = editor.getCaretPosition();
try {
int a = Utilities.getPreviousWord(editor,pos);
selection = Utilities.getIdentifier(Utilities.getDocument(editor),a);
if (selection == null || selection.equals("")) {
NotifyDescriptor.Message msg = new NotifyDescriptor.Message("Select a word!");
DialogDisplayer.getDefault().notify(msg);
} else {
if (selection.equals("public")) {
HelpFileReferences.getHelpCtx("public");
} else if (selection.equals("private")) {
HelpFileReferences.getHelpCtx("private");
} else {
NotifyDescriptor.Message msg = new NotifyDescriptor.Message
("'" + selection + "' was not found in internal helpsystem.");
DialogDisplayer.getDefault().notify(msg);
//sendToSelectedSearchEngine();
}
}
} catch (BadLocationException ex) {
ErrorManager.getDefault().notify(ex);
}
}
Then, the string (in the above example, only "public" and "private" are catered for) is sent to this method in the HelpFileReferences class:
public static HelpCtx getHelpCtx(String receivedWord) {
String id = receivedWord;
Help help = (Help)Lookup.getDefault().lookup(Help.class);
if (help != null && help.isValidID(id, true).booleanValue()) {
help.showHelp(new HelpCtx(id));
} else {
Toolkit.getDefaultToolkit().beep();
}
return null;
}
Next, I used the JavaHelp Help Set wizard (which is in recent builds and will be available in the upcoming 5.0 Update 1 from the apisupport team) to create a helpset. In the map file, which is one of the files created for me by the JavaHelp Help Set wizard, I added these two map IDs:
<mapID target="public" url="public.html"/> <mapID target="private" url="private.html"/>
And then I created the two HTML files. So now, when the action is invoked (currently via a button in the toolbar) on the words "public" or "private", a help topic dedicated to those specific words appears.
I think that's pretty cool. Does anyone know of content for these topics? Is there anywhere where I can go and just cut and paste explanatory text for typical Java identifiers (also "String", "int", etc). It would be good to cover as much of the standard Java syntax as possible... the only thing is I wouldn't want to write all of that from scratch...
By the way, if you're a NetBeans plug-in module developer (or a rich-client application developer on top of the NetBeans Platform), let me recommend a few brand new tutorials that you might find very interesting:
- NetBeans Palette API Tutorial by Emilian Bold. A tutorial that shows you how to use the Palette API and make a palette available for your TopComponent.
- Creating Indentation Engine Tutorial by Miloslav Metelka.
- Project Version Control Tutorial by Petr Kuzel.
The latter two tutorials I came across by accident this morning—they're linked from the NetBeans Module & Platform Development Work-in-Progress Page. If you have anything to add to that page—please don't hesitate. You don't have to ask anyone's permission. Just go right ahead and educate the rest of the world about whatever cool new thing you've discovered while working on NetBeans plug-in modules (or rich-client applications built on the NetBeans Platform).
Postscript
Here's a much cleaner solution for the code that I outlined above:
public static void sendWordToSearchEngine(JTextComponent textComponent) throws BadLocationException, MalformedURLException {
JTextComponent editor = Registry.getMostActiveComponent();
int pos = editor.getCaretPosition();
try {
int a = Utilities.getPreviousWord(editor,pos);
selection = Utilities.getIdentifier(Utilities.getDocument(editor),a);
if (selection == null || selection.equals("")) {
NotifyDescriptor.Message msg = new NotifyDescriptor.Message("Select a word!");
DialogDisplayer.getDefault().notify(msg);
} else {
getHelpCtx(selection);
}
} catch (BadLocationException ex) {
ErrorManager.getDefault().notify(ex);
}
}
public static HelpCtx getHelpCtx(String receivedWord) {
String id = receivedWord;
String moreLikelyToBeUniqueId = "identifier_" + id;
Help help = (Help)Lookup.getDefault().lookup(Help.class);
if (help != null && help.isValidID(moreLikelyToBeUniqueId, true).booleanValue()) {
help.showHelp(new HelpCtx(moreLikelyToBeUniqueId));
} else {
NotifyDescriptor.Message msg = new NotifyDescriptor.Message
("'" + receivedWord + "' was not found in internal helpsystem.");
DialogDisplayer.getDefault().notify(msg);
}
return null;
}Feb 27 2006, 07:31:17 AM PST Permalink
Send a Word to the Browser (Part 2)
In Send a Word to the Browser (Part 1), I blogged about a plug-in module by Ramón Ramos that lets you send the element under the caret to a search engine (note, though, that Ramón's plug-in module has been signficantly extended since I blogged about it—now you can not only select a search engine from a predefined list, but you can also add additional search engines, via a new category in the Options window).
I was particularly interested in Ramón's plug-in module because, sometime ago, I worked on something very similar, see Further Search Facilities for NetBeans IDE 5.0 for details. In that plug-in module, I was able to select a search egnine from a drop-down list and then send the current line to the selected search engine. At the time, I wanted to also be able to send a word—i.e., not just a line—but didn't know how to do that. In the meantime, I've learnt from Ramón's plug-in module and, as a result, have been able to extend my own (the screenshot below not only shows the user interface added by the plug-in module, but also the code that makes the word selected possible):
I basically used Ramón's code verbatim, just as I found it in his source code. However, the code used here seems pretty different to what is prescribed in the FAQ: How do I get the element under the caret?. I actually wanted to use that code, because it seemed 'prescribed' while I wondered about Ramón's code and didn't really know which was 'better', but the problem was that I would then have ended up with conflicting import statements. The code in the FAQ has this line:
Element el = resource.getElementByOffset(offset);
That line requires org.netbeans.jmi.javamodel.Element, while earlier in the code I had made use of javax.swing.text.Element. Since I couldn't use both of these packages in the same class (and didn't want to create a new one), I used Ramón's solution instead. And it works.
Next, I'm going to take a look at Ramón's addition to the Options window. It's pretty cool—if you don't like the selection of search engines that the plug-in module provides, you can simply add additional ones. Thanks a lot Ramón—your plug-in module provides exactly the kind of source code I've been needing to understand the NetBeans APIs better and to extend my own plug-in module further!
Feb 26 2006, 09:10:30 AM PST Permalink
NetBeans Swiss Army Knife
With all the out-of-the-box development technologies that NetBeans IDE currently provides, it really is the all-in-one Swiss army knife of the Java IDE world:

Feb 24 2006, 06:55:03 AM PST Permalink
UML and NetBeans IDE (Part 2)
Yesterday I looked at how to use NetBeans IDE to create a UML model from an existing application. Today, I went through this tutorial: UML Modeling: Developing Applications. I did this because this time I wanted to start from the other side—without an application. My question going in was: "How much code will the IDE be able to generate for me?" I was quite amazed, really. I had assumed that I would have to build the whole UML model, that I would then have to choose a menu item that says something like: "Generate application" and that then the whole application would be generated from the model. How wrong I was! I started by having to create a Java Project and a UML Project. While creating the UML Project, there was a cool little checkbox that set the magic in motion: "Generate Code". This forced me to select an existing project (again, unfortunately, like yesterday, one that had to be open in the IDE). Then, the first "wow" moment came right near the start of the tutorial—I dragged a "Class" item from the Palette into the Diagram Editor (i.e., the Diagram Editor is in the same spot as where the Source Editor normally is), and then I renamed the class. Take a look at what was then added to my Java Project:
In other words, a "BankAccount" class was created, with a constructor. Then, I added an attribute, balance, to the diagram (by right-clicking in the diagram and choosing "Insert Attribute"), which resulted in the balance field being created, as well as a getter and setter. Then I right-clicked in the diagram again and chose "Insert Operation" and then added the withdraw operation. Doing this—all right inside the diagram, i.e., graphically— resulted in code being generated each step of the way:
Continuing like this, I added an interface (Bank.java), a superclass (Checking.java), and a test class (AccountTest.java). The relationships between these classes were done via the items in the Palette. The package was created the same way, with items in the palette being used to connect all the classes to the package.
Switching from the visual representations to the actual code is easy:
What is called "round trip engineering" is totally cool—changes you make in the code are reflected in the diagram; changes you make in the diagram are reflected in the code. Again, the code is generated whenever you add something to the diagram, how cool is that? So, you can see the effect immediately in the Java project in the Projects window.
And this is what the application looked like right at the end (notice the addition of a main method in AccountTest.java, I added that in the code, not in the diagram, but, as soon as I had made the addition to the code, it was added to the diagram by the IDE):
The whole thing was a really cool experience—working at a higher level, yet seeing code being generated for you on the fly. The only bug I encountered was this one—when the diagram needs to be saved (indicated by the asterisk below), the Save button in the IDE isn't activated (but you can workaround this by right-clicking on the tab and choosing "Save Document" there). Here's the proof—asterisk is visible in the tab, but Save button in the IDE cannot be clicked:
Aside from the above, the UML toolset in the IDE is really cool. Now, I wonder if this stuff can also be used in other areas, such as web applications and plug-in modules...
Feb 23 2006, 01:02:29 AM PST Permalink
UML and NetBeans IDE (Part 1)
Last week, when I was teaching NetBeans to Java instructors in Munich and London, one of the most frequently asked questions was: "What about UML? Does NetBeans provide anything in this area?" My standard answer was: "Currently not, but later this year you shouldn't be surprised to find UML support integrated in NetBeans IDE." All along, I knew that UML support was already in the process of being added. In fact, since yesterday, anyone interested in UML has been able to make full use of UML modeling in NetBeans (go here for the download). There's even a very interesting documentation page available, with an exciting list of tutorials: Preview: NetBeans IDE 5.5 with NetBeans Enterprise Pack 5.5.
Bearing in mind the interest shown in UML modeling last week, I went to the above documentation page and picked out this tutorial: UML Modeling: Reverse Engineering Java Applications. When I first landed on that page, it all looked a bit dry. "No screenshots?" I thought. But then I saw the "Show Me" links. They're great—short little demos of the step-by-step instructions found in each section.
So, anyway, I took the Anagram Game from the NetBeans samples and played around a bit, using the new UML modeling features. Pictures speak better than words, so here are a few pictures...
The first picture shows that in the New Project wizard there's now a new category called "UML" (also, if you look at the screenshot, there are other new categories called "Service Oriented Architecture" and "XML", but let's leave those for another day):
In the New Project wizard, I selected "Java-Platform Model by Reverse-Engineering a Java Project".
In the next picture, you see that I've selected the Anagram Game (you must have the application open in the IDE in order to be able to select it, which I think is a bit odd):
Next, the IDE does all the work in the background. You get prompted to approve one or two things, but that's all.
Here you see the colorful result in the Projects window of reverse-engineering an existing project:
The Projects window was never this exciting! You can expand the nodes and inspect what's going on within them:
Next, select all the nodes that you want to diagramize. Here, I was confused initially, because I selected a node and then assumed that all subnodes would automatically be included. This is not the case. You need to explicitly include each subnode that you want to work with in the next steps:
When you select "Create Diagram from Selected Elements", you get a dialog box that lets you choose the type of diagram you want:
Then a diagram is created (in my case, I chose "Class Diagram"), which you can zoom into, as shown below:
You can also create a dependency diagram...
...and, among many other features, you can select to reverse engineer a selected operation in the class diagram (which then produces another diagram, such as a sequence diagram, that shows the control flow, the sequence of behavior, and the concurrent processes and activations):
Soon, I'd like to play with the UML modeling features from the other side—i.e., start without an application and see how far the UML features go in producing an application from a UML model...
For me, though, there's one big problem: There is now so much to get familiar with in NetBeans IDE, it is becoming a serious problem for me! I still haven't done anything with mobility and the Profiler—but now, with all this new functionality (the SOA stuff looks very cool too, for example), I'm going to have to copy and paste myself at least 20 times if I'm going to be able to keep up with everything that NetBeans IDE is able to provide...
Feb 22 2006, 02:42:28 AM PST Permalink
Good news for NetBeans plug-in developers!
If you're a Swing developer (i.e., Java desktop applications) or a NetBeans plug-in module developer, you're in luck! In a few weeks' time, an update to the cool 5.0 module development support will be made available. For details, see API Support update testing program. If you're a user of the 5.0 rich-client application development functionality or plug-in module development functionality, you can register at the address provided in the above page (or just send an empty e-mail to testing-subscribe@apisupport.netbeans.org). Then, you can report bugs and win yourself a t-shirt.
The release that you will be testing is currently not available yet—if you join the mailing list, you'll get an e-mail announcing the new update. Then you'll be able to install the beta update to the module development functionality via the Update Center wizard. If you want to know what the update module will provide, either install the update module, when it becomes available, and take a look at the "What's New in 5.0 Update 1?" topic, or have a look at it here.
Finally, if you read Origami and NetBeans IDE 5.0 a few weeks ago, you might be wondering where the promised code is. Well, if you go to my Update Center (http://blogs.sun.com/roller/resources/geertjan/updates_geertjan.xml), you'll find a new module available:
Note that this new module is the only one in my update center that will work in 5.0. All the other ones have module dependencies that are not satisfied by the 5.0 release; for this reason, I need to rebuild all the other modules (soon) so that they work for 5.0. However, the code folding module should work for you in 5.0 (I tested this out on a fresh 5.0 installation).
Feb 21 2006, 10:05:00 AM PST Permalink
Send a Word to the Browser (Part 1)
There was good news in my e-mail when I got to work this morning—Ramón Ramos sent me a NetBeans module that lets you, in Java source files, send the word under the cursur to The Java Developers Almanac 1.4. For example, here, where the cursor is over the word "package", I have selected the new menu item "Search Word in Java Alamanac Examplets":
Next, the browser opens, the site is found, a search is done, and the search results are displayed automatically:
Not bad, right? I saw something interesting recently in JBuilder—there, if you press F1 over a word, the built-in helpset pops up with a text explaining the word under the cursor. So, in that case, you don't go to the external browser, but to the internal helpset instead. That's also something pretty cool, especially if you're a relative beginner and you don't know what identifiers such as "public" mean.
Anyway, Ramón, great work! This is a further addition to the many little plug-ins that have popped up since Ludo made his Google Toolbar available (which is also part of Roumen's latest flash demo). Cool how one thing sparks off another like that.
PS: Check out Christopher Atlan's blog!
Feb 20 2006, 02:58:19 AM PST Permalink
47 = Total Number of Retrained Java Instructors
The last session is over and, in total, John and I have now retrained 47 Java instructors from all over the world. In the first session, in Munich, we retrained 4 instructors, 14 in a virtual session from Munich, 9 in the live session near London yesterday, and 20 today in the on-line session. The 20 instructors that we dealt with today logged in from Germany, Sweden, Italy, Russia, Belgium, the Netherlands, Spain, Scotland, England, and South Africa. Not bad. It was actually pretty cool.
The following is a list of questions that I wasn't able to answer or suggestions that I think would be good improvements for NetBeans:
- Local history. There were two instructors today who were quite well versed in IntelliJ. They asked whether it is possible to see the "local history" of a file. For example, they wanted to see what a file looked like two hours ago, without using CVS. Sounds like a useful feature to me. I think I'd think it would be cool if we had it in NetBeans.
- Database support issues. When I demonstrated the "View Table" menu item, which shows the data of the selected table inside the IDE, someone asked: "What happens if I have millions of records in my database? How does the IDE deal with that? Are they all displayed? If so, does that not eat up a lot of resources?" There was also a question about whether it is a good idea to have the Embedded Derby driver and the Net Derby Driver on the same port, as it is now.
- Resource bundles and Russian. One instructor that we had in our course today is based in St. Petersburg. He shared his IDE installation with the class, so that everyone could see it, and then showed us the contents of his Russian resource bundle. It was garbage. It was not Russian at all. What needs to be changed, and where, in order to see the contents of a resource bundle in the IDE in Russian?
- Is there integration for... XDoclet, Axis, Maven, Portlets? These were the 4 "integration" questions that came up today. I gave them the answer that Milos gave in the comments from a recent blog entry (thanks Milos) and at the end of the day I showed them Rudolf Balada's photos of the release party (and now they also all know what Jarda looks like and also who he is).
I haven't yet listed the issues that came up in yesterday's live session, but will do so in the coming days. I will also create issues in Issuezilla where necessary. And I'll send an e-mail to everyone we've met over the past few days, with further links for information and so on. One thing I mentioned today is that I realize that NetBeans is being "foisted" on them, i.e., they have no choice about using NetBeans in their Java courses for Sun Microsystems (and they also had no choice when it came to attending the courses). However, by the end of the one-day course, it was more than abundantly clear that NetBeans is not some kind of "corporate" product (after they saw pictures of the NetBeans team getting drunk in a dingy pub in one of the darker corner's of Prague, their entire impression of NetBeans changed radically). I said, in my final words somewhere, that if you're going to be forced to use something, you might as well be forced to use something as good as NetBeans. And, I referred them to yesterday's entry in my blog, which describes in some detail how helpful an IDE can be when teaching Java.
It's been a good and tiring week, but I've had a chance to do a few non-work things too (for example, I went to London on Wednesday, saw a friend from my university days, and then saw "Measure for Measure" by Shakespeare in the Royal National Theater, which was an unforgettable experience). I genuinely hope I'll get more chances to teach and instruct, though. Presenting NetBeans was fun: the best part of it is that NetBeans presents itself, so long as you don't get in the way, it quickly becomes clear to anyone honestly listening to your presentation that this is indeed a very good product, in terms of quality, as well as in terms of the enthusiasm and responsiveness of the people behind it.
Feb 17 2006, 09:19:17 AM PST Permalink
Interview with an Italian Java Instructor
Today was the third one-day course I gave for the 'Train the Instructors' courses. Java instructors are being trained to use NetBeans IDE to teach Java (instead of command line and text files or alternative IDEs). Today, the session (near London), was attended by 8 instructors. Most of them knew each other, except for Andrea Martano, who had come all the way from Italy to attend the course. He, out of all of them, was the only one who already had experience teaching Java via NetBeans IDE. All the others were pretty sceptical, several of them coming from an Eclipse background. But, at the end of the day, at least partly thanks to Andrea's interventions, I think they left feeling carefully impressed. (Several NetBeans issues came up during the day, but I'll leave them for another blog entry, maybe tomorrow.)
So, in gratitude, and curiosity, I interviewed Andrea after the course was over. Here's the result, some of his answers are truly fascinating.
So, Andrea, tell us a little about yourself.
My name is Andrea Martano. I am from Milan, Italy. I am a partner in a company, Sinapto, working as a contractor for Sun Microsystems. I have worked there since 1999. (But I have a degree in political science and economics...) We are 30 in total. The company is divided in two areas—one develops PHP on Linux, while the other develops Java on Solaris.
But I thought you were a Java instructor?
Well, three of us teach Java and I am one of them. I teach about 15 to 20 weeks per year. The total teaching figure for the company is about 50 to 60 weeks per year.
Why does your company do teaching as well as development?
We like giving courses. We like sharing knowledge. The value is in the knowledge and not in the product itself. We teach all the J2EE courses—SL314, FJ310, SL351, DWS310, DWS385, as well as 00226, which is object oriented analysis and design and SL500, which is design patterns.
What do you like about teaching?
I like to teach people. I like to transfer knowledge. I like to make people look at Java not just as a programming language. One of the goals I always try to have while teaching is to help people take the first steps and giving them the direction and the will to discover, not just Java, but everything in general. This is the most important thing I inherited from my father. Until the day of his death, he always studied new things. And so he left me the passion to learn and the passion to teach.
And, you have recently begun using NetBeans?
No, not recently! I've been using it in my courses since version 3.6, mainly as a text editor, to give some help to students new to Java. For example, those students have great difficulty with method names or find it difficult to switch from another programming language to Java without ever having been exposed to Java syntax before. For example, code completion and the red square with the white X for errors, plus its message, is really useful. As a result, they don't always ask me whenever they have a problem, but use the IDE to solve it for them. When they have problems with missing semi-colons and mispellings, the IDE helps them to work out the problem. As a Java instructor, this saves me time and helps to keep the course on track.
What do you think about the lightbulb (that offers hints and suggestions when the IDE detects compilation errors while you are typing) in 5.0?
I think it is a great idea. It is a further help. Now there is not just the error warning and the error message that you get when you hover over the red box with the white X, but an additional solution to problems.
But shouldn't students find this out themselves?
Maybe the first time, they just apply the solution given by the IDE, without understanding it. But after they repeat the mistake, they understand the error, so they learn by trial and error. I believe that forcing students to use plain notepad is too hard. They get tired very fast. They think Java is too difficult. I try to focus students on the fact that Java is not just a programming language, and, if they face difficulties coming from incorrect Java syntax, to point their attention to the whole Java environment. You cannot think of Java as only a language—it is a system of knowledge, it is a platform, it as an environment, it is a different way to think about how an application can be built. You learn the syntax by using it, so it is not important to learn the entire syntax within the first five days. The most important thing is that you get them to switch to object orientation. And that you can give them a general view of the whole thing.
So, how have students found working with the NetBeans editor?
Basically, NetBeans is not so different from any other editor. Students take about half an hour or less to start using it.
So, then, why use NetBeans? Why not some other IDE or non-IDE editor?
Because it is a 100 percent Java editor, as opposed to Eclipse that has a native library for the user interface. NetBeans lets me import the code, which was produced outside the editor, in an absolutely easy way. NetBeans lets me use my Ant file. I felt comfortable immediately using NetBeans.
Even 3.6?
3.6 was very heavy to run. It was slow to start up, but the future of the IDE was already clear at that time. So we insisted on using it to develop our products and while giving courses.
So, if I come to your class, and I have a different IDE on my laptop, what happens?
I have very little experience with, for example, Eclipse. In Eclipse, I don't feel comfortable with the concept of workspaces. To students coming with Eclipse or wanting to use Eclipse, I say: if you want to use it, use it, but I can't help you if you have a problem caused by the IDE itself.
I have experienced users coming with Eclipse and discovering NetBeans. And they finished the course satisfied, both with the course and with their new IDE, especially since we started using version 4.1.
Why 4.1?
Because it is much faster. It is bundled with the Sun Java System Application Server. I can show them how to add Ant targets to deploy to an external Tomcat server, incorporating a specific context.xml. Maybe we have on the same computer, both the web server and the database, but when we deploy the database is on one host and the server on another, so then we use context.xml to configure the application.
What do you think about NetBeans 5?
We shall adopt NetBeans 5. Both in course teaching and within the company for our development.
Why?
It is faster than 4.1. It lets us deploy to a wider range of application servers. The new hint features are a great innovation. And it is good to help new developers with Java Blueprints—to help them start building an application in the correct way and prevent them from taking wrong development decisions or their own way of building an application, without a standard or design best practise. This is especially true for developers new to Java web applications; maybe they come from .Net or PHP applications. And they have a different approach, they build many pages, and mix control and view. They don't know the concept of model. There are so many reasons. I have noticed it from passing from PHP or ASP or .Net to Java bring with them the habits they developed with those technologies, many of those are not suitable or not good in Java web applications. And the BluePrints help them to start in the right way. Having them as a template is really a good thing, because they can have the whole application ready very quickly, and look at the code, and look how things are put together.
What would you like to see in NB that isn't there? What are you missing?
Myself as a developer, nothing. I can't think of anything else I need from it. But, considering what one of my partners says—a module to develop HTML interfaces, conforming to the W3C accessibility standard. Maybe a UML drawing tool integrated. These are the first things that come to mind. One other good thing—NetBeans should have a project management system, mapping the Agile process to develop an application.
Any final words, Andrea?
We are really very satisified with NetBeans. For example, I taught in Bari in the south of Italy once, and they were using JBuilder, and I went to teach them with NetBeans to build web applications. I remembered that in NetBeans I can add static resource directories very easily for images and HTML files, and so on, with a lot of freedom, compared to JBuilder. I showed the students NetBeans, and they were impressed that you can access the file system and create folders for static resources in such an easy way.
Thanks a lot Andrea and have fun with NetBeans IDE 5.0!
Oh, I definitely will.
Feb 16 2006, 10:16:23 AM PST Permalink
Two Down, Two To Go!
Well, that was quite something. My first live session teaching through Elluminate. The whole thing finished 10 minutes ago, so everything is still fresh on my mind as I'm typing this. It all started quite badly—John Cosby, my fellow presenter, had microphone problems and, though being able to hear everything, couldn't say anything because his microphone failed to work. Time for the course to start came round,
and there were about 15 people logged in! (Compare that to the 4 that came to the "live" course that we did yesterday and you see that on-line training vs. live training can have dramatically different attendance figures—the same was true for the same course that Gregg and Alan have been teaching in the States).
So I kicked off the training while John phoned the Elluminate people to solve his problem. Meantime, I had been dumb enough to remove my own privileges, so that I was unable to load my presentation into Elluminate. (Sivia, who is our Elluminate contact person, said that she had never heard of someone having a "greyed out Load > WhiteBoard menu item", which tells me that no moderator has ever removed his/her own priviliges before. Does that make me the dumbest Elluminate moderator on earth? Discuss.)
Anyway, once we were both up and running (instead of down and desperate), things went quite smoothly. It's a very enjoyable experience for everyone concerned, once you get into it. The students (i.e., all Java instructors) on the course were in Sweden, Spain, Italy, Belgium, and Germany (judging from their e-mail addresses). I got the feeling that gradually, thoughout the day, they started digging NetBeans IDE more and more (or maybe it was just that I relaxed more and more). We got more done than yesterday, despite the big delay at the start. (But that was also because I left out the code completion section because I hadn't reconfigured Elluminate in time to override its keyboard shortcut key definition which is mapped to some functionality within Elluminate, so that there is a clash between them causing code completion to fail in the IDE when it is loaded in Elluminate. Gregg had the same problem—and solved it by working out the whole thing with the keyboard shortcut, which was excellent sleuthing; unfortunately I haven't benefited from it yet.)
There were some interesting questions that came up though:
- Expansion key for code templates. Wouldn't it be GREAT if you could set your own expansion key for expanding abbreviations to code templates (instead of being forced to select one of the four that the IDE provides)? So, what if I want the expansion key to be "p-9-Enter" (which would be awkward, but is just an example). People like being given a choice, even if they never make use of it. In a course, it sounds good when the instructor can say: "And, instead of SPACE, you can choose any combination of keys that you want." Currently, you can't say that.
- Setting the IDE's fontsize on Mac. One of the little exercises that the students get is that they're told to change the IDE's fontsize in the etc/netbeans.conf file. They're told to put --fontsize 13 there. But, apparently, based on feedback from users on the course (at least one, possibly two), this didn't work for them and the suspicion was that this is Mac-related. I didn't know the answer, but I wonder if it is true and if so if that can be fixed somehow.
- Downloadable ZIP files for source code in quick starts. It was pretty cool to see people using a quick starts that I maintain and update myself—the Quick Start Guide for Web Applications. But, someone working on the Quick Start Guide for Enterprise Applications asked that we provide downloadable ZIP files of the applications that you build in the quick start. That way, when there are problems, you'd be able to inspect the code.
- Documentation error in the Help. In a topic called "Setting Code Completion Shortcuts", the user is told to find the actions for code completion in the "Edit" folder in the KeyMaps. That should be the "Other" folder instead. (When he remapped his keyboard shortcut for code completion, he solved his code completion problem. That's something that could be added to the "Configuring and Troubleshooting" section of this course.)
- Hippie completion and the Help. What is popularly known as "hippie completion" (originally from Emacs) is called "word matching" in the IDE's Help. I think, therefore, that someone typing in "hippie" in the Help will assume that the IDE doesn't support hippie completion. Therefore, I think there should be some indication somewhere that "word matching" is also known as "hippie completion" (and there should be an index marker for hippie completion for the same reason.
- Default window position option. I demonstrated how easily you can redesign the layout of the IDE by drag-and-dropping, for example, the Files window so that it appears next to the Projects window (which is handy if you want to work with your build.xml file in a standard project). (By the way, this drag and dropping of windows, as well as a little demo of the "left sliding side" was very highly appreciated by several of the participants. I think that that the flexibility of the windowing system is a great feature that people really take to.) However, wouldn't it be cool if there was an option or checkbox that you could select, to return all the windows back to the default position? I'd definitely find that a useful thing.
- Is there integration with... In a presentation like this, there are always people asking: "Is there integration with XYZ?" It's interesting to see what people ask for. Today the following three were asked about: Subversion, Maven, and Jikes. In all cases, I indicated that I didn't know for sure (which is true), but that there definitely is work being done on integration of Subversion.
And those were the only notes I made today, so those were the only genuine sticking points. All in all a good experience, despite the confusion at the start (which is inevitable with a product of this nature). There were a lot of smileys and clapping hand symbols at the end of the day, so I think the participants had a pretty good time. At some point I felt a bit like a DJ, announcing the next slide like it was a new track being put in the CD player... That was funny.
And now we're just hanging out, recovering from the day, before jetting of to London. The plane leaves at 21.10 and the taxi should be arriving 10 minutes from now. It's been an interesting time in Munich, even though we didn't get a chance to see any of it...
Feb 14 2006, 08:52:14 AM PST Permalink
One Down, Three To Go!
Well, my first day of teaching the 'Train the Instructors' course for Java developers who are switching to NetBeans in their Java training material is now over. And, I guess, all in all, it was pretty good. I was really nervous about it, this morning, but now that the first one is over, I think the remainder will just be repetitions of today (with variations obviously).
The class consisted of 4 students (i.e., instructors unfamiliar with NetBeans who will start teaching their Java classes via NetBeans soon). Their names were Jens, Jorge, Thomas, and Andreas. They were all pretty advanced Java developers (that's obvious, I guess, because they're Java instructors after all). But it quickly became clear to me what the main problem is that they have with switching to NetBeans—the point is not that they don't like NetBeans (not knowing it at all means that they couldn't either like or dislike it), but that they dislike the idea of teaching using an IDE (any IDE) at all! Makes sense when you think about it—do you really want your students generating heaps of code via wizards or do you want them to create everything themselves, manually, line by line, without any help from code completion, editor hints, and other user interface gadgets? And do you really want the student to be confused with advanced tools like the HTTP Monitor when all they should be learning is how to code and deploy a servlet?
Sure, in production environments, an IDE is great. But when you're learning how to structure your folders and files so that the result complies with the J2EE specification, do you really want to let your students use a template to generate the entire structure without giving it a second's thought? One of the instructors told me that several of his students come from companies where their every question is answered with: "Look, I don't know how it works, but it just works if you follow these steps." And the reason why these people from these companies go to Java courses is that they want to learn exactly how and why something works. Sure, the "official response" to this situation, from the NetBeans perspective, is to reply: "You can use the templates and then look at the code. That's how you'll learn about it and at least you'll know it is right, because the IDE generated everything." But, that's not an answer that works with these instructors—they really understand, based on years of experience, the need that their students have of struggling. Sure, it may be boilerplate code, but if you don't even understand the boilerplate code, because you've never had to put it together yourself, on your own, with nothing more than a simple text editor, then how are you going to learn about the non-boilerplate code?
I suggest that at a future rewrite of their courses, the first two labs should not use NetBeans IDE at all. Only once the students have done a lot of work in manually setting things up, in manually coding line by painful line of EJB code, only once they really understand why one thing works and another doesn't, only at THAT point should the instructor say: "Now that you understand how this works, let's find out how you can do it much more quickly." And then THAT'S where NetBeans IDE comes in.
Another suggestion I made was that they rewrite the file templates and then bundle the rewritten file templates in a plug-in module that all their students would install at the start of the course. The templates could have names like: "Servlet without ProcessRequest Method" or maybe "Beginner's Servlet" (with very little code, so that the student would be forced to fill in the rest), "Medium-Level Servlet", and "Advanced Servlet" (each with increasing levels of new code, so that the students would have to add less and less themselves because they would understand more and more and would not need new understanding but more productivity).
Anyway, the training itself went quite well, and they were pretty appreciative. (Especially, also, because I brought in some quick demonstrations of plug-in module development and rich-client Swing application development, even though that wasn't officially on the menu, because these issues don't come up in their courses at all!) I followed Gregg's course template quite closely—introductury presentation ("what is NetBeans?", "what is its history?", "what platforms does it support?", "what are its significant features?") followed by a quick tour of the IDE (which ended up being quite long because I wanted to make sure that this part, probably the most important part of the one day course, would really sink in), followed by a detailed tour of the editor (sorry Gregg, I left out hippie completion, not enough time). By then it was 2.00 PM (also because of my quick plug-in module demonstration right before lunch)! John (my fellow-presenter, who is a great and very supportive guy from London) got a bit concerned about the time. So then they worked through the NetBeans IDE 5.0 Quick Start Guide. They also did the NetBeans IDE 5.0 Quick Start Guide for Web Applications and another one by Alan Petersen about Struts. I kind of quickly breezed through (well, not exactly "breezed", but it was quite focused timewise) a presentation of the differences between Eclipse and NetBeans. They did some more quick start guides, I think, or some other tutorial based on the courses that they are going to teach. I finished off with a presentation on "Configuring and Troubleshooting", which was followed by walking them through a long list of links to useful on-line resources.
John and I ended up at a restaurant afterwards, with Thomas, and I think, all in all, we thought things went quite well. Of course, some things didn't go so great. Especially the code completion caused a few uncomfortable problems—when I added two new fields, for example, the getters and setters were not immediately offered in the code completion dialog box (even though I didn't put them in the main method). One cool thing I did was this: in the part where I showed the editor hint/suggestion functionality, after walking them through the first one (reference to a non-existing method), I asked them in each case if they could guess what the editor hint was going to say, before clicking on the lightbulb. That made it a bit like a game, and they got most of them right (missing import statement, uncasted return value, implement abstract methods, uninitialized variable).
Tomorrow will be the first of our on-line sessions. John is more nervous about it than I am (he's taken on the introductions tasks—he sets things up, then gets me to go through a presentation, then follows on by giving them quick starts to do). So, tomorrow he's going to be the one explaining how Elluminate works, how to raise your hand, use the microphone, etc. But, I think it'll be quite fun. Especially now that the first one is over. Hurray!
Feb 13 2006, 10:58:14 AM PST Permalink
Are you in/near Munich or London? (Part 2)
In Are you in/near Munich or London? (Part 1), I announced (to the world at large) that I was going to be in Munich and London this week. I invited anyone near these places to drop me a line if they wanted to meet up. So, after exchanging a few messages (first in my blog and then later via e-mail), a meeting was set up at Munich airport—Georg and Peter were waiting for me when I had passed through customs (where I paused for a second to consider whether having 30 NetBeans IDE 5.0 CDs in my luggage was a factoid that needed to be declared or not). Anyway, since neither Georg nor Peter knew each other and since they only knew me from my blog, there were a few logistical problems to be overcome—but my NetBeans "Stand Out from the Crowd" t-shirt did the trick and we ended up spending several hours chatting in a cafe at the airport.
Now, the cool thing about Georg and Peter is that... they've been using NetBeans since it was called Forte. That's a really long time, pre-3.5, in other words. So these two are people who know what they're talking about when it comes to NetBeans. No misunderstandings what NetBeans is about, no confusions, no accusations about "missing features" that actually turn out to exist after all. Georg works purely in the web development area, while Peter is purely a Swing developer. How cool was that? We could talk about pretty much the whole length and breadth of the product. If you want to know how familiar these two are with NetBeans, get a load of this: Georg reads NetBeans CVS commit messages on a regular basis, to see what's really going on with NetBeans. (So, here's yet another reason for me to write useful commit messages...)
So, I took notes throughout our conversation. Here's a list of their needs and wants:
- Reporting tool. How often has that phrase been heard lately? A lot. And I told them that. I told them that this is very high on the radar (which is obviously 100% different to promising anything, which as a humble technical writer I'm not in a position to do anyway). Georg said what he's really looking for is a feature in the IDE that generates a JSP skeleton and some action classes to display data. (We later looked a bit at the Database Explorer and then talked about how nice it would be if you could drag and drop a table entry into a JSP page and then have a table with rows and so on generated for you.) In this context, BIRT was mentioned obviously.
- Project management. If the NetBeans developers I met in Egypt (Mohamed, Ahmed, etc.) are reading this, maybe you should consider this for your thesis—a plug-in module for project management. For example, the manager could assign a task, the developer could then see a task list, the manager would be able to see the developer's progress and the time worked on the project. Yes, a lot like MS Project, but then inside the IDE. It could maybe be some kind of extension or add-on to the Collaboration module? Anyway, Peter said that that would be really useful in his environment.
- Scripting editors. They're happy to hear work is being done in various quarters on a JavaScript Editor for the IDE. Groovy was also mentioned, of course. (In this context, Georg mentioned "living in the IDE" and referred to Emacs.)
- Wizards for creating Ant targets. Georg mentioned that newcomers to Ant would find wizards useful, in the same way that newcomers to JSP files find the JSP wizard useful. I think that's a great idea.
- RSS FeedReader. Instead of as a rich-client application, Georg said he'd like to see it as a plug-in module (and then I dropped a hint about the Welcome Screen redesign).
- Update Centers. Peter asked about private update centers. Georg said he'd seen www.nbextras.org and thinks it is a great idea. I told Peter the basic infrastructure of private update centers. He asked whether it was possible to set one up without having access to the Internet (he rarely uses it from work, ditto his colleagues). I said "of course" and told him he could put the autoupdate descriptor and the NBM files on a server of his choosing, which could be internally within a company. (And then I mentioned that, given the fact that we now have www.nbextras.org, that his use case would probably increasingly become the typical one for use within a company, while distribution across the world would be done via www.nbextras.org.) And then... I demonstrated how NetBeans IDE 5.0 Update 1 (which is a plug-in module that is curently under development, that will provide various enhancement to the 5.0 module development toolset and that will be made available around the end of the month) generates the autoupdate descriptor for you! I also demonstrated the Update Center wizard, which automatically registers the URL to an update center in the user's Update Center wizard. Georg mentioned that it would be cool if you could immediately deploy the NBMs and the autoupdate descriptor to the server via Tomcat, but that's not something I knew enough about to give an answer to. The quality of plug-in modules on www.nbextras.org was also discussed—there should be some kind of standard naming conventions there, we all thought.
- SQL Editor. Georg mentioned that in the previous version of the SQL editor (which wasn't really an editor at all), it was possible to see the request history. You could see what requests had previously been sent to the database. This is no longer supported. (Why, Andrei, why?) And, there was an odd thing that Peter showed me—if you do "View Table" and then change the width of a column to make it more readable, the column width jumps back to the original width when the next query is returned. He'd like the modified table width to persist across query calls. Also, Georg pointed out that it would be nice if you could copy an SQL query and then paste it inside a Java source file in the IDE, and then have the IDE generate line endings and quotation marks automatically.
- Installation of Mobility and Profiler. I think it was Georg who mentioned that he found the installation of these two add-ons as pretty counter-intuitive. I agree. What exactly is going on there? Sure, they're both very large, but why aren't they in the default IDE (why do they need to be downloaded and installed separately)? I think this is more a question of the relationship between these two and the IDE is not very clear. "What's the story here?", is what they were basically asking.
- Collaboration Server. Peter asked how a collaboration server is set up. I didn't know but hope someone else reading this does! (If not I'll try to find out some other way.)
- Tutorial Cemetery. There were some funny ideas for the docs department which I thought were really great: firstly, a "tutorial cemetery". Specifically in the plug-in module area, more and more templates are being created by the module development (a.k.a. apisupport) team. As a consequence, more and more tutorials are either going to become obsolete or much (much) shorter. To illustrate this growing list of templates for plug-in module developers, how cool would it be to create a "tutorial cemetery", i.e., a list of tutorials that you no longer need? Secondly, they suggested a document called (something like): "Favorite Boilerplate Code That I Don't Have To Write Anymore". Cool, right? In that document, there'd be the stuff that you find in the JSP template, servlet template, Actions API template, and so on. It would, again, underline the strength of the IDE and its usefulness in requiring you to only provide non-boilerplate code.
- Wizard wizard. Georg had recently started looking at the Wizard wizard, which kickstarts your work with the Wizard API. Do you know what the first thing he said was? He said he wanted a wizard to create the files for new steps (this is something I've brought up to the apisupport team myself, but will now do with even more vigor). He also asked for some documentation on this wizard and the Wizard API. I told him that unfortunately no tutorial exists yet (because I don't understand enough of it yet), but that I have several blog entries that discuss the API and the Wizard wizard (and, in fact, I've seen these blog entries being referred to in mailing lists as some kind of reference material). So, Georg, if you're reading this, here's the list of blog entries that I've thus far dedicated to this matter:
- How Wizards Work (Part 1): Introduction
- How Wizards Work (Part 2): Different Types
- How Wizards Work (Part 3): Your First Wizard
- How Wizards Work (Part 4): Your Own Iterator
You'll see that the above blog entries are very simple and provide introductory topics only, but given your experience, I wouldn't be surprised if you end up working the rest out for yourself. Of course, though, more documentation (a full-blown tutorial) on this is needed. However, as I told him, various people have internally been wondering about this API and what exactly its future is in its current form.
- NetBeans Training. There seemed to be general consensus that NetBeans trainings would be a good thing (in Peter's case, he mentioned that new colleagues in his department follow some sort of internal NetBeans training—how cool would it be if the NetBeans team were to provide those trainings? Especially now that Gregg has put together such excellent beginner materials for the 'Train the Instructors' training sessions?) Also, rich-client application trainings were mentioned (and I told them about Tim sending a great-looking training document that is, at least the interesting bits, mostly in Portuguese). I did a cool demo for Georg and Peter—I created an application skeleton (i.e., module suite project), excluded IDE modules, showed that the splash screen could be changed (as well as other branding matters), and then generated a ZIP and a JNLP application. (For the ZIP, wouldn't it be nice if somehow the JDK used by the IDE could be specified in the .conf file? Currently, it is really hard to track why the generated executable doesn't work, initially.) I also showed the layer.xml browser and how you can delete menus from the NetBeans Platform. So, yes, I basically showed them the principles outlined in Jarda's great NetBeans IDE 5.0 HTML Editor Tutorial.
- Copy Project and CVS. Georg mentioned that you lose the link to CVS when you copy a project, because the CVS folders are not included in the copy.
- Proxy server settings. Peter mentioned that there's no way to exclude localhost (and anything else) from the proxy server setting in the IDE. Even when you use the system settings, the excluded servers are not recognized by the IDE.
- Spaces, again. Another problem involving spaces: when you create a project, the project name is also the name of the project folder. But the project name cannot contain spaces, while Georg's project folders do contain spaces. (So his workaround is to create the folder externally and then import it using the 'New Web Application from Existing Sources' template.)
- Sang and Sandip are famous! Georg praised Sang's JavaPassion site to the skies and Peter had never heard of it. So, my guess is, he's going to give it a look. Sandip was also mentioned spontaneously by them—especially the 'Copy Up/Down' plug-in module was something Peter was happy about, but he was also aware of the 'Java Type Hierarchy' plug-in module. Peter really likes Sandip's magnifier tool too (he said that he had "always missed that").
- The future of NetBeans. We talked a bit about future releases of NetBeans. (I had sent them a link to Gregg's great blog entry on this matter beforehand.) Of course, we talked about how cool UML support and JSF editor support is in one or two other products provided for free by Sun!
Of course, many other things were discussed, but I didn't note down everything. Also, I may have misinterpreted some of the comments (so, Peter and Georg, feel free to fill in details or expand on any of the above points). At the end of our discussion, I gave them each a brand new NetBeans IDE 5.0 CD, a "Are You Still Working in the Dark?" t-shirt, and a copy of the NetBeans IDE 4.1 Field Guide (signed by Patrick himself!), even though they each already had a copy of the book (how cool is that), but more in gratitude for the time spent and the information gleaned.
By the way, on Wednesday I'll be in London without anything to do... is there anyone out there who'd like to meet for a chat?
Feb 12 2006, 04:24:33 AM PST Permalink
NetBeans Elluminated...
While I'm blogging, I'm also in an on-line NetBeans training course done by Gregg Sporar in a web-started application called Elluminate. Since I'll be using the same technology in Munich and London next week, I'm attending as an observer (and, let me tell you, Gregg sounds just as persuasive on-line as he does in real life). I hope I'll live up to his high standards next week... In the meantime I could spend several paragraphs describing how cool Elluminate is and how fun learning can be (especially when you're learning about something as cool as NetBeans). Or, I could just give you a screenshot...

Feb 10 2006, 06:51:26 AM PST Permalink
Easy Access to CVS Annotations
In Command Line CVS or NetBeans Internal CVS?, I showed you how my traditional command-line CVS tasks can all be done in NetBeans IDE. But, now I'm getting a bit further and discovering the additional things the IDE can do for me in this area. My favorite so far is this one—CVS annotations.
First, choose "Show Annotations" on a file:
Then, the IDE shows you the versioning history of the file (i.e., the version and the committer). Plus, when you hover on an annotation, the IDE shows the commit message relating to the current annotation (as well as the commit date):
That's pretty handy. Plus, it is further motivation for me to come up with more meaningful commit messages...
Feb 09 2006, 03:54:24 AM PST Permalink


