Saturday, February 5, 2011

What exactly are we up to?

First thing first. We have to agree on a couple of points:
  • I will be using Netbeans for this - you could use Eclipse if you want.
  • We will be using MySQL
  • We are going to make a web application using Vaadin
So to start off by setting up our environment. What we are going to need are:
Download it, copy it off someone whatever. The sooner you get the stuff into your dev machine the sooner we can talk about what exactly are we up to?

Figure 1.0 Installing the Netbeans Vaadin plugin

Have it? Installed it? Good.

What we are going to build/make/develop is a facility-reservation system. So what exactly will our "FRS" application be doing? Here are our requirements:
  • All reservations must be submitted and processed online
  • Must have AAA type security
  • Granular user permission system
  • Resolve scheduling conflicts
  • Track histories like facility usage, request status, room schedules, etc.
  • Have a basic set of reports (exportable to PDF)
Figure 1.1 FRS Flow Chart
Our FRS web application is not that complicated. Take a look at the flowchart. A request is made. The request data is quite simple. It contains the facility being requested, when its to be used, how long its to be used and for what purpose. The request is of course submitted by a user authenticated by the web application. Anonymous users can't submit make a reservation request. The request is then evaluated by someone with higher privileges say an administrator. The request is then either disapproved, approved or rescheduled (or  reallocated). The request once approved does not end the cycle. It only ends when the request is carried out. This is done by a different role or class of user.

We will talk about the database design later in this series.

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?

Wednesday, January 26, 2011

Swing-like Chuyness (My Vaadin course of beginners)

It's that time of the year again where I had to teach yet another batch of students. This time I don't think I'll be doing Tapestry5 again - You don't repeat the same gag, to do the next one. So, what is the next gag? This time around it's Vaadin. I wanted to learn how to use Vaadin ever since a former student of mine showed it to me. So, I plan to build something using Vaadin and take my students along for the ride. 

Like my Tapestry course, I will walk you through a complete web application development from design to deployment using the Vaadin framework. I think you should read "walk you through" like "we will be winging it". Making good lesson plans isn't really one of my strong points.

The course will look like something this:

  1. Vaadin is what exactly? 
  2. What exactly are we up to?
  3. Springing DAO: Spring + Hibernate
  4. Breaking Tradition: GUI programming for webapps
  5. Tweaking out! 
  6. Coming back alive: Deploying for WAR
This isn't exactly set in stone, more like something I just pulled out of my ass. So if there's something missing, we will deal with it when we get to that bridge. We will make up the requirements and specification as we move along.