Thursday, January 30, 2014

Open Dolphin and Java FX

I came across the Open Dolphin library in one of the Java One presentations. It was really amazing how people at Canoo were able to put things together that we already know and were able build a great library out of it. The first thought that came to my mind after watching the video was, how this can change the way we develop Enterprise Applications, especially the Rich Client ones.

I was recently involved in developing a Rich Client for one of our clients in Switzerland. We used Swing, JDAF and Spring for the client. The development was very rapid and whenever a less experienced developer made some errors like not following the threading model or skipped the JDAF's way of doing things, there would be a lot of mess and we had to clean it up. We did not have a magic tool that would take care of the threading or that would take care of the remoting, while developers can concentrate on the business logic. I wish we had Open Dolphin when we started the project in 2011.

Open Dolphin uses the concept of Shared Presentation Model to keep data between the client and server synced. And with help of binding, the views always reflect whats in the presentation model. So you now have the power to control the view components from the server. All you have to do is change the value in presentation model to which the view component was bounded to. This may sound simple enough, but gives you a great level of seperation, better testing and whole new way of developing Client-Server applications. There are even more to what Open Dolphin can do. Check out the demos section to know them all.



Most of the demos or the examples available on the internet use GroovyFX for client and Grails for the server side. There are some demos available in Java, but they may not be simple enough to understand just the basic setup. So I created a Chat Demo that uses JavaFX for client and Java Servlet based server implementation of Open Dolphin. The purpose of the demo is to show just the bare minimum setup of Open Dolphin in Client and Server. I have always been a fan of Dolphin's long polling. So I decided to write this Chat application using that.

Source Code for demo: https://github.com/raghsr/Chatter