Monday, 10 December 2012

StatelessPrime announcement

Introduction

For many years now, I'm developing web applications with JavaServer Faces.  And although I'm extremely satisfied with the framework, I realized during the last few years that the technology has his limits.
Some state is kept in the session memory for the user and this limits the usability in high volume websites.  However, other features makes it the best choice for administrative applications.
Over the years, I followed the trends within JSF to reduce the memory consumption.  There was a big effort done with the release of JSF 2.0 where there was the introduction of partial state saving mechanism. And for Apache MyFaces and the Mojarra implementations, you have a 'stateless' version.
But for those that still think that JSF is not an option (because of his bad history) I had an idea of using JavaScript and PrimeUI on the client side and JAX RS that provides the JSON data.
How this idea emerged can be read in this blog post.

Forming the stack

But after one day I realized that I will never create something useful with JavaScript on the client side. My knowledge of the language is so minimal and I don't want to start with DOM manipulation.  If you have done so many years of declarative definitions in JSF, it feels like the stone age.
I searched a bit on the internet about JavaScript libraries.  I heard already that there where many of time but the search returned an overwhelming list. By accident I stumbled on AngularJS, and for me, it resembles the way of working with JSF.
You start with some kind of template, HTML with some additional attributes on the tags or even new tags.  The 'link' with the model data is made by some kind of EL and the DOM manipulation is done automatically based on the model data.  With this data linking, it create a list with the data in a tabular form by just some specifying some html and giving it a collection of data.
And even with my limited skills in JavaScript, I could made an example very easily that shows data which were produced by a JAX-RS method returning JSON data.
Another interesting features is the ability to define some directives yourself.  That allows me to create an integration for the PrimeUI widgets.
And although I didn't do any comparison between AngularJS and the other MV* JavaScript frameworks or other frameworks to create 'stateless' Web applications, my choice was made.

JSF back in the picture

After that I played a bit more with the combination AngularJS and JAX-RS, the resemblance between the JSF way of working and AngularJS became stronger and stronger. So I decided to create a component library and JSF renderers that can generate the files for the AngularJS way of working based on the JSF views.
This will become of course a tremendous amount of work to support everything and implement all options, but a first prototype was ready after a few weeks.
So at that time, I found it useful enough for me, as a kind of side project to learn more about the Stateless web development, to start the StatelessPrime project and blog.

StatelessPrime project goals

So this is the, non restrictive, list of goals that I want to tackle the next months with the StatelessPrime project.
  • Learn some JavaScript
        At least, I should come at a point where I no longer 'fear' using it.  However, I don't need to become an expert.
  • Know and use the features of AngularJS
  • Integrate PrimeUI with AngularJS
        By creating directives specific for PrimUI using PrimeUI can become as easy as additng the StatelessPrime AngularJS javaScript file.
  • Integrate AngularJS with JAX-RS functionality
        There are a few config that you need to make
  • Generate AngularJS/PrimeUI/JAX-RS application based on 'standard' JavaServer faces applications
        You need a specific component library to have this trick.  With renderers you can run this kind of application as any other JSF application.  With the 'Compiler' you can create the HTML5 (with AngularJS tags and directives), JavaScript and Java files containing the JAX-RS part files.
  • Create Maven plugin
  • Keep a blog
        Write down my adventures, lessons learned etc in a blog

Deliverables

As you can see in the list of goals, there are 2 groups of things that I like to cover.  Therefor, the project is also divided in 2 parts.
  • StatelessPrime AngularJS
        Here I will explore the combination AngularJS and PrimeUI with JAX-RS on the backend.
  • StatelessPrime JSF
        Here you can find the thnings related to the component library, renderers, Maven plugin and the compiler to generate an AngularJS/PrimeUI/JAX-RS application from JSF/CDI
On each blog post I will mention the part which wioll be covered.  This allows the people to decide if they are really interested in it or not.

Disclaimer

As I already said before, this project became a kind of hobby of someone who is not very familiar with JavaScript.  So don't expect production quality code, perfect architecture, etc... But constructive criticism and comments are of course very appreciated because I want to learn something.

2 comments:

  1. I liked the idea, and great job.
    will follow you to see whats next.

    ReplyDelete
  2. Hi Rudy,
    I really like your idea! To understand it better I would like to ask what are for you the limits of JavaServerFaces (eg Scalabilty).
    I'm an enthusiast Primefaces developer (3.5) with a sufficient knowledge of JavaScript, and I'm I also looking for the best way to 'restify' my architecture. Now I'm using JSF+EJB+JPA under JBoss7. What do you think about ExtJS?

    I will follow your project.

    ReplyDelete