Grails with Vaadin plugin, is it the right choice? - grails

For my organization I am evaluating RICH technologies for our next projects.
We are currently using grails 2.1.0 and very happy with that, especially with groovy and gorm and we would like to stay with that. The idea is to extend grails with some RICH framework/library. Currently I am evaluating: grails plugin for ZK, grails plugin for Vaadin, knockoutjs, angular.js, ember.js.
I already received a feedback from my colleagues who worked with ZK (no grails) and their conclusion was: cool, but forget performances, ZK goes to the server every time you do something at client side.
My question is: is this also true with Vaadin (plugin for Grails) ? How does it react with heavy single page applications? and what about Bambi? can this be an option?
On paper grails + Vaadin is what we need: we want to write groovy/java, not xml and surely not javascript. Is this the right choice?
I know my question is very generic, but I am just at the beginning of the evaluation...
Thank you for your attention!

Vaadin works perfectly with Groovy and Grails. You can get services (actually spring beans) by using Grails.get() method and do localization via Grails.i18n() method. Because all the code is going to be written in Groovy, not Java, it will become less heavy (less lines of code and so on...).
Vaadin doesn't go with ever user action on server. You can influence that by setting setImmediate(false) on whatever component.
When you make complex application in Vaadin, you need to be careful how many components you put on the page. If you expect that there will be thousands of components on single page, then browser renderer will have performance issues with handling it (of course speed of rendering depends on your computer hardware). More hints is here.
I recommend - try to build UI in Vaadin and fake database. Then see the performance and then switch to the real database. Usually people blame Vaadin but the problem is elsewhere e.g. in database, indexing, loading to many items at once...
If you don't want to play with JavaScript, then I suppose knockoutjs, angular.js, ember.js are out of the game.
You need to find out, whether the Vaadin components are what you need. I really suggest to try it out and make Proof of Concept in Vaadin. If not, Vaadin 7 simplifies integration with JavaScript! So, you can easily integrate Vaadin server code with whatever JavaScript library (e.g. highcharts and so on...).
You will need to get your containers lazily loaded (check this)
I think you should start with Vaadin 7 (here is a tutorial)
There will be more performance optimalisations in Vaadin 7 (in versions 7.0.1 or 7.0.2)

Related

Grails UI in 2.3.4

I am coming from the Spring + Hibernate + JSF/primefaces site. What I like in Grails is its scaffolding site, so that basic CRUD apps can be created rather quickly.
However, which libaries do you recommend for a beginner in Grails for creating a UI? It should be created quickly and straightforward and also be feature rich (have a look at the primefaces libary)!
The very basic GSP pages are really powerful, especially when combined with any modern JS library. With them you can assemble a complex rich GUIs in instant (well, almost :) )
There are also numerous grails plugins to include almost any view technology of your choice into your web-app, e.g. http://grails.org/plugin/kickstart-with-bootstrap
I would suggest http://grails.org/plugin/twitter-bootstrap once installed you can use the documentation at http://getbootstrap.com/ as your guide.

grails & backbone.js

ive currently been developing a Java EE project, using regular web services and backbone.js for my front end. (As i like things being loaded/added to the page, without the page refreshing (async, backbone)).
I wanted to find out if anyone has used grails along with backbone and what their experience is?
Grails would be for server side stuff, and backbone for handling the front end.
Or can grails do this itself. IE, with grails, can you dynamically load stuff onto a page without refreshing. For example, a todo list.
Is it difficult to add backbone to grails?
I've used Backbone + Grails, for two projects. And didn't see any problem, absolutelly.
Backbone is client-side only framework, very flexible, developed with idea that it should be compatible with nearly all server-side stuff. It just expecting RESTful/RESTful-like server side API. And also, you can alway use your own server-client transport implementation, see Backbone.sync (but I'm sure, you don't need it for standard Grails app)
Grails, at other hand, it very flexible server-side framework (mostly server-side). By using Grails you can make RESTful api w/o any problem. Basically you just need to respond with JSON, that's enough.
PS you can also use Grails tags for ajax, like remoteLink and plain jQuery, but Backbone is much more powerful (and easy to learn)
It's not that complex. You can try following this tutorial.
It's a Grails 2.x & BackboneJS project, which utilises the resources plugin.
The tutorial link provided by #chanwit is not working but you can use github link of same project.

A fast way to build a nice UI for a grails app?

I'm starting a fairly complex grails app but am a bit slow hand-coding nice user interface pages directly in CSS/HTML. Several people have recommended IntelliJ for the grails app development, and I plan to use mostly grails scaffolding for the admin portion of the site.
Can you recommend an approach or tools for building a nice UI fairly fast?
Thanks
P.S. Eventually I plan to build "skinnier" mobile version as well.
One approach might be to continue to use the grails sitemesh main.gsp and just concentrate on your functionality using the scaffold-ed pages as examples. Once you are ready to tackle the style aspect you can deviate from the grails main.gsp template and create your own tailored for your look and feel.
If your complexity includes a fairly custom UI, I don't think your going to get a free lunch. You'll have to break down and code the UI.
I'm currently using jQuery UI coupled with jqGrid to get some fairly sophisticated grid / tree behavior in my UI with not too much html coding. I'm also using the jQuery UI Layout Plugin to manage pane layout and make my app look/feel more like an app rather than a page. Grails plays real nice with the ajax needs of jqGrid.

Is it possible to integrate Vaadin with Rails??? If so, how?

As i see Vaadin is a Java based UI framework. But it has some really nice set of widgets and a very good layout engine. Is it possible to integrate Rails and Vaadin? JSON perhaps??
It sounds like that'd take a lot of work creating an interface between them which will likely only slow things down. By the time you had everything working the way you wanted you could've finished what you wanted in Rails or Vaadin separately.
If you did make an interface, JSON is the way to go. Lightweight and almost everything supports it with little overhead.
is there any alternative to javascript based frameworks?? other than the usual ones (jquery, prototype, sproutcore
Just pointing out, that all rich UI frameworks that run in the browser are JavaScript in the end (not including any plugins like Flash), even Vaadin, which is built on top of GWT on the client side.
I guess you'll have to consider integrating with the Rails backend either on the server side (e.g. with a Vaadin Java servlet) or on the client side with a custom data exchange over HTTP (using JSON) and using some client side framework like GWT, SproutCore, Cappuccino etc.

How to get started with GRAILS on an existing Java EE app?

I'm new to grails. I'd like to give it a whirl by implementing a new feature or two into an existing Java EE application. The current Java EE app is a fairly standard Spring MVC/Hibernate app running on Tomcat. Looking through the documentation, it looks like I should be able to leverage all of the current business logic that's written in Java.
I've only been able to find tutorials on creating new grails applications. Does anyone know of a tutorial for integrating with an existing Java EE app? If not a tutorial, any recommendations or suggestions on where to start?
Whether or not those features go live would depend on my experience with Grails and if I think it's worthwhile using it going forward. The goal would to either:
Decide Grails isn't for me (and not deploy grails).
Decide it is for me, and all future development on this app would be in Grails with a full eventual port over.
I'm afraid I don't know of any such tutorials, but my immediate thought would be that porting an application while also combined with learning Grails could be a big uphill.
I haven't done this sort of thing before, so these are just musings on how I might approach doing this..
Since GSPs are not analogous to JSPs and since Controllers in Java are statically typed, whereas Grails controllers have magic methods wired onto them, I would probably want to re-write those again in Grails from scratch since their transferability isn't obvious - the logic should transfer but the boilerplate of the old code isn't altogether necessary for the most part.
Maybe take a simple story/feature, keep the existing Services it uses and get them wired in via Spring in Grails. Then try making one for one copies of what you have in Java with corresponding Controller/GSP and Domains. That should give you some feel of what stuff you need to get off the ground for the port.
Your biggest struggle, from people who I have heard of doing this, might well be trying to re-use your existing hibernate stuff in Grails.
Just my tuppence, not so much a whole answer...
Insert Grails into an Spring app is not easily achievable, you can try to insert the old Spring app into a Grails app, and continue from that point.
Here you've some info 'bout using the hibernate mappings and java classes.
You also have to have to add the beans of the Sprint app to the Grails app. You can insert them into the ApplicationContext directly or use the resources.xml or resources.groovy.
It depends on how you've written the Java EE app. You cannot drop it into the Grails runtime and expect it to work with no tweaking, especially the 'controller' part of your app (since grails uses its own conventions for that). The UI, if its jsp, may be a bit better, since you can probably rename them to gsp, and have it work. tag libs works straight away, and normal java classes work straight away obviously. Hibernate objects may need tweaking - though i suppose it may just be easier to redo those using grails.
-my 2cents

Resources