J-Fall half day Keynote & Demos

Reginald Hutchinson kicks off with an introduction of Sun’s plans for the web2.0 and web 3.0 (cloud computing).

Smooth talker, says what have you a lot. As expected java fx is the next best thing. I’m curious when it will become final. Rich Internet applications are fun and easy to write with java fx. Riiiight….

Interesting note, December 2nd sun will release java 6 update 10, an important update for swing based desktop java. Sun will rebebrand the javafx stack to platform specific brands (mobile, desktop, tv/topset box) some day next februari.

Chum-Munn Lee takes over with a demo of the latest Netbeans beta with a as of yet undisclosef java fx beta. Creates new fx project.

He creates a “under the sea” demo. Declarative display of an image. Next he makes the image dragable by implementing a few mouse listeners. Looks nice. Now he adds another picture. Adds a fade in/out with keyframes Looks simple enough, but it takes very little code. :) The end result is very rewarding considering the little time he used.

Next he deploys it on a browser. The end result is a java applet started from a jar through a standard javascript library.

Reginald takes over again and provides a few details about the upcomming java fx release. Something is up in 3 to 4 weeks.

Standard details about the java 6 update 10 release.

Simon Ritter takes over and kicks off another demo on an applied manner. He watched some guy (Johny Lee???) YouTube videos and wants to do the same with Java technology.

Wooden board with a Wii-mote and a projector??? Ah, he projects a playing card on the board. If he moves the wooden board, the image on the projector moves to stay on the board. The Wii-mote detects infrared signals sent by the board and based on the Wii-mote input the image is moved.

J-Fall Solving Constraint Satisfaction Problems with Java

Nico van Hanxleden Houwert gives a talk about solving constrain satisfaction problems. Problems like 10 ships need to dock at 5 docking slots. How to plan this considering parameters like ship and dock size. Real life examples can contain millions of examples. Which solution is the best under the set constraint.

It is a problem domain with a logarithmic or quadratic increase in size when parameters increase. Doubling the number of ships and docks can make easily make problems insolvable in a reasonable time constraint.

Lots of talk about a problem he wants to solve. Bit of basic set theory, not much java code.

Java offers frameworks to facilitate solving such problems. ILOG and Cream are examples of java frameworks suitable for constraint satisfaction discovery.

Fun subject. But get a book, read an article: you’ll know more in less time.

J-Fall Pragmatic Java

Allister Smith gives a talk about pragmatic java development. Don’t overuse patterns and other design abstraction.

Python and rails is gaining popularity because it is simpler.

Allister shows an example with a sort of back to basics approach with inline SQL and all in java. While interesting, it still is not as simple as python for example.

Python contains the framework to do the work by default.

He makes a case that the framework code is something you build once. And because YOU build it, you are in control. But if you need too much code, do go for an existing framework.

Allister’s case goes against all the standard practices in java. I’m not convinced, but it is an interesting subject. Are java developers making they’re solutions more complicated then needed.

J-Spring 2008 in review

Eclipse University banner.Last week I presented at J-Spring 2008. It was one of the first times I presented to such a large group of unknowns. The room wasn’t packed, but still quite full. Afterwards I heard the head count was over 70 people attending my session. Good to see that many people interested in ANTLR. I was in the before last round of sessions and not everyone of the 1000 people attending was on the premises anymore. So all in all. I think I did good by at least attracting 10% of those people still there.

My presentation went very smooth. In 45 minutes I crammed 42 slides, 3 short demo’s and a 5 minute Q&A.

I did fumble on one single thing.

ANTLR does allow more than 2 nodes with the same root node in a tree.

It’s all supported in the tree grammar syntax. The grammar I demoed was indeed binary, I thought the question was about that fact, while in hindsight I realised the person was asking if ANTLR support AST’s with more than 2 child nodes on a node.

Really six more reasons to hate Java?

Some guy from Buenos Aires made a write-up bashing some features of Java. Let’s test the validity of his argument. Oh, I came across his post through programming.reddit.com.

Based on his gripes he sounds like a systems programming to me, and if your one of those: What kind of problems is he trying? Perhaps pick another language better suited for the job. He actually states this by saying Java is good for web programming, it sucks for what he’s trying to do.

Let’s start with the first one.

It has no unsigned types
He argues about this being a problem when reading unsigned bytes from input. Well according to my memory the inputstream classes support a read byte method which returns an int in the range of 0 to 255. No problem reading unsigned bytes there. It could hurt some people that you are wasting a few bytes though. Also, it does not matter when working with bytes alone.

The shit does start when you actually have to convert bytes to another type, then you need to start thinking about how to deal the signed-ness of bytes in Java. So in my opinion, always having signed types (except for the 16 bit char) can get nasty when doing systems programming. Not to mention the problems this might cause when having to take into account if you should work big- or little- endian. For networks this is no problem, TCP/IP makes sure everything is “network order” which is big-endian and hey Java is also big-endian. Fortunatly the new IO classes can handle byte ordering easily, just have a look at the API docs. Look for ByteOrder and the order methods on the various buffer types. (It really is straight forward stuff, make a buffer, set it’s byte order, start getting and/or putting.)

So yeah, unsigned types can be a pain if you’re doing things the old way (ie. java.io). The new way (java.nio) however makes handling byte orders dead simple, and unsigned bytes can be handled as well as well. The example he gives can still be a pain though, because you easily forget a bit shift, an addition, or a proper read/write of a single byte. I do wonder though if there isn’t a neat way around this.

You can’t inherit constructors
Yeah you can’t. It’s a choice. By requiring explicit constructors calling nothing but super constructors you prevent people from instantiating your class without circumventing the classes initialisation logic. For simple constructors it can look stupid though.

You can’t declare destructors
That’s because you don’t control your objects garbage collection either. You mark an object eligible for collection by dropping references to it, at the same time you could call some cleaning logic. A dispose method is a common pattern.

He states that he had to write stupid finally blocks in his wrapper class. WTF man, add better exception handling. Catch those, handle all you want and be done with it.

You don’t have a sane way of controlling the terminal
He starts yapping on about String security and finally gets to his actual gripe. You can’t hide a password typed on the console. Well, ehm, know your stuff, it helps: http://java.sun.com/javase/6/docs/api/java/io/Console.html

No, you can’t leave stdin/stdout/stderr fscking alone!
What about the get*Stream methods? Ok, your code does have to handle input on those. So you have to do some extra work instead of dumping stuff on the standard console.

No, you can’t handle signals
And then he says you can, because it’s undocumented in some sun package. Well, there’s a reason it’s in the sun package, you shouldn’t use it except when you really really know what your doing.

Conclusion
Lot’s of stuff claiming that Java is garbage, but in the end it comes down to a few misunderstandings, differences of opinion and missing some features in the JDK6 release. And above all, Java is NOT the obvious choice for systems programming. Better leave that to shell scripts, C code, python, Perl, Ruby or some other language.

I hope this post doesn’t qualify me as a Java Zealot. Because there are things I don’t like about Java. Maybe I’ll report about those some other day. :)

ANTLR J-Spring session approved

I recently got word from the NL-JUG that they have granted me a presentation slot based on my session proposal regarding ANTLR.

I think it will be a tricky session to pull of properly. I’ll have to make a guess about how much my audience will know about grammar definition, parsers and compilers. But hey, that challenge is part of the reason I made my session proposal.

More details will follow.

Looking into integrating ANTLR v3 with javax.script

I’ve been looking into integrating ANTLR v3 with javax.script. It should all be pretty simple, but I have not implemented a simple mock-up yet to test my conclusions.

Then I remembered a ex-colleague of mine who wrote a Dutch article about integrating a JavaCC generated language with javax.script.

Dutch article about JavaCC and javax.script

Technically that does not look that hard at all.

The hardest thing I’m running into right now is outlining a subject as a little case study. I am also wondering about what problems might arise when trying to integrate a generated parser within the confines of an application. I can think up a number of ways to connect a parser to an application’s in memory model. Should I try to detail logic in my parser grammar or should I unlock my memory model with a bit of dedicated API for the parser as to keep inline Java action blocks to a minimum.

Interesting course offer by InfoSupport

One in the shameless plug department.

My employer InfoSupport will be offering a very interesting course from the 21st till the 24th of April.

It’ll be a very nice course presented by one of our top trainers. If there are seats remaining I, I’ll sign up for this one. But I’m guessing that the available seats will fill up rather quick. So hurry ad head on over to Java Spring Class 2008 and sign up.

Some cutting and pasting from the above link:

*snip*

Course outline
Get your hands on JSF, AJAX, EJB 3.0 and Web Beans.
This course provides you with a fair knowledge of Java Server Faces technology and also shows how to combine this technology with AJAX. The ins and outs of EJB 3 Simplified Components and the new persistence API are presented to you. The latest developments on Web Beans, a JSR based upon the JBoss SEAM application framework, are also treated. This specification enables the usage of EJB 3 components as JSF managed beans. All topics are put into practice in multiple hands-on exercises.

This course also looks ahead and presents you the plans for the future.

Course content

  • Java Server Faces and Ajax
  • Session Beans 3.0
  • What is new in Session Beans 3.1
  • Java Persistence API 1.0
  • What is new in Java Persistence API 2.0
  • Tips and tricks for EJB 3.0
  • SEAM
  • Web Beans