Thursday, January 27, 2011

Vaadin is what exactly?

If you talk to a Finn, he will tell about Vaadin being a mythical creature in Finnish folklore, the goddess and divine ancestor of the mountain reindeer. They even got a song about it.

Interesting, but not the Vaadin we should be thinking about.

Now if you go to Wikipedia, it defines Vaadin as:
"Vaadin is an open source web application framework for rich Internet applications. In contrast to Javascript libraries and browser-plugin based solutions it features a server-side architecture, which means that the majority of the logic runs on the servers."
Technically correct, but it doesn't exactly tell you what to expect when programming or developing a web application using Vaadin. You read that right. Vaadin is for creating web applications - Rich Internet Applications if you want to be an ass about it. The key thing with Vaadin is that it allows you to make these web app without writing a line of HTML or CSS. Ok, you can write HTML and CSS, but only if you really, really want to. Take a look at its design.

General Architecture of Vaadin

The architecture of Vaadin allows you write Java code as if you were creating a AWT, Swing or SWT application. You heard me! You don't have to write a line of HTML, CSS or even JavaScript. Because HTML, JavaScript and the other browser crap is hidden away, you won't be wrong in thinking that the web browser as a thin-client terminal or platform. Still not buying? Well, let's move on to an example. In the long tradition of hello worlds (if you don't get it, then you suck as a programmer), here a Vaadin "Hello world":

 import com.vaadin.ui.Window;  
 import com.vaadin.ui.Label;  
 public class HelloWorld extends com.vaadin.Application {  
   @Override  
   public void init() {  
     Window main = new Window("Hello World");  
     setMainWindow(main);  
     main.addComponent(new Label("Hello World!"));  
   }      
 }  

That's it. No HTML template, no JavaScript. Here is the screen shot of web app after it has been compiled and deployed.


That shouldn't be that hard to figure out. I just wrote Java code, a very short one and made a working web application. Can you spell chuyness?