Is it possible to integrate Vaadin with Rails??? If so, how? - ruby-on-rails

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.

Related

Is angularJS an alternative to JSF?

I was looking for a webframework to use in an application for a call center. 3 important requirements would probably be
an ability for a quick, localized refresh of the screen
a need to collect information from 3-4 disparate systems
the roadmap/longevity of the framework itself
Was looking at JSF & AngularJS (I have worked on neither). Am I right in considering them as alternatives or are they meant for very different things. How do these measure against the 3 considerations above.
No, angular is clearly not an alternative to JSF. JSF is a server side java application framework (with some ajax features). Angular is a client side javascript framework. It's a bit like comparing JQuery and JSPs.

Client side MVC instead of server side MVC

Instead of using server side MVC like Ruby, Python, PHP to build very complex websites, why should not we split our website into multiple modules, and build each with client side MVC like backboneJS, EmberJS. In this case, we will use PHP / Ruby for creating webservices alone, which will serve data only.
Each module now act as small web app. If we link each other, they will perfectly look like a complex web app.
I visit many websites (like github, groupon, stackoverflow etc...) and they can be built or adopted to this approach. But i am not seeing this kind of approach. Does this approach has any problem on this kind of websites?
Was to long for a comment
I guess the tricky part is indeed the point you mentioned
f we link each other, they will perfectly look like a complex web app.
Because each MVC framework uses a different approach to tackle usual problems you have in modern web-apps, like routing, data binding, application state and rendering DOM elements, so I think you would end up having multiple frameworks doing tasks that overlap substantially, thus forcing you to deactivate or disable some of the built-in functionality of one or the other framework making your frankenstein-app :) very difficult to maintain.
A good example is jQuery-mobile & ember.js, both have a routing system, jQuery uses the DOM to hold state ember.js holds it's state completely in javascript which is much faster. I had a similar problem with a project using jQuery-mobile & ember.js and this forced me to decide for one of the routing systems, I took ember's and deactivated jQuery's wich then let with just a bunch of custom mobile-looking components on the side of jQuery-mobile. Finally I removed jQuery-mobile using ember.js only and CSS for the mobile-looking app.
If not because of a concrete requirement, IMHO your best bet is to have just one very good, flexible and opinionated framework (personally I prefer ember.js) and create the modules you mentioned with your only choice.
Hope it helps.
As of now we can say that most of the applications are forced to put in more effort in its UI/UX and hence the dependancy on server side is becoming very less.
I have personally used backbone for my latest work and this has been great. The speed of the entire application can be noticed from the beginning. Ive been using PHP for the past 3 years and i can definitely vouch that backbone and other MV* frameworks are better.
Combined with CSS frameworks such as bootstrap, backbone can be an extremely organised and elegant applications.
All said, getting your head around models,views,routers,collections can be a headache. This is something which has vast possibilities and its only getting started.
Ive compiled a tutorial based on lots of tutorials present and has published at http://goo.gl/nJumC.
So many video tutorials are also available.
Only per-requisite is that one should have good knowledge of javascript and jquery methods and functions. Beginner knowledge in these will only make your task of learning backbone difficult.
Oh yes. I got my answer.
From google groups:
I think one of the reasons is javascriptless user-agents — i.e. search
engine crawlers and users with NoScript turned on.
I hope, these are real problems why websites still using Server Side MVCs.
When websites don't know target audience, they can't predict how well it will run on client side. So they should rely server to build much of their content.
And think, if stackoverflow was designed using client side MVC's to build much thier content, no one can't reach stackoverflow posts using google search.
From wikipedia under "Search engine optimization" section:
Because of the lack of JavaScript execution on crawlers of all popular
Web search engines, SEO has historically presented a problem for
public facing websites wishing to adopt the SPA model.
I think that is the shift we are heading now; I am not really sure about you but I noticed far more Client Side MVC Web sites. Anyways, you can also take a look at this ....
http://backbonejs.org/#examples
in my view, except the learning curve, it is pretty neat to develop using Client MVC and Web APIs using JSON/REST

Grails with Vaadin plugin, is it the right choice?

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)

Converting a regular MVC site for use in phonegap

I have a site that's done using ASP.NET MVC and jQuery. Is it possible to modify my existing project without too much of rework so that it can be used in phonegap to create iphone/android apps?
Here's an approach: move your logic to an MVC WebAPI (or other REST/webservice) project, then convert the MVC site into a simple html/javascript/css/image site (Mobile site). Then refactor your Mobile site to use Ajax/JS to query the WebAPI/Rest services you created. Once you've separated your code this way, you can then package the Mobile site with Phonegap. I'm not sure how much work that will be for you or your project. If you're using a lot of Html Helpers or Razor markup in your views it may be too involved.
The core point of my suggestion here is to separate your mobile UI layer and the backend processing layer so you can only package the Html5/UI/Javascript layer with Phonegap and leave the backend processing on your web server. I don't think I need to explain this, but obviously the app packaged with Phonegap is not going to have the MVC/.Net framework available on the mobile device to render views or execute controllers, etc. By migrating your UI to be simple Html5 and Javascript you can use Ajax/Jquery/Javascript calls against your backend, which you will probably want to host in ASP.Net MVC WebAPI.
Edit: Guess there was some confusion about my suggestion. I'm not saying this is the only way to do go, but this is what I'm familiar with as it's how our team builds our desktop/web + mobile + phonegap + mvc4 + webapi + kendoui application. This pattern works well for us so maybe it'll work for you too, or at least give you some ideas on how to structure your solution. Good luck!
I'm not sure but you need a server to compile the ASP.NET right? so I don't think that will work for you. I think you need to work with AJAX to do your ASP.NET work and separate your ASP.NET code and your HTML-jQuery because Phonegap wants a index.html file. You can store your ASP.NET files at a server tough
The answer to your question really depends on the type of site you are trying to convert. Are you just trying to put a native framework around HTML and get your app into an app store?
If it is is mostly or entirely informational in nature and you have simply used MVC to build brochure-ware type pages then it should be fairly easy to move. This assumes that there is little to no logic other than page to page navigation.
If your site instead pushes a lot of data around that relies on a back-end server you will need to re-architect it to store data locally or pre-fetch it via a manifest. Next you will need to implement a strategy that allows you to push your local data back to the server.
Does you app need to run in a disconnected state?
Phonegap is one of the options if you want to target multiple mobile platforms & may be most widely used. Since you are using jQuery, jQueryMobile will be a least learning-curve path to use. Effort is mostly on the front-end UI and will depend on how many screens you want to design to provide a sub-set or the full set of functionality you already have on the web UI. Most likely you will have to redesign your screens using the jquery-mobile UI widgets documented here. It is also a good way to show it to your customer the initial screen design with navigation.
jquery mobile is great for learning and designing , but it's slow in the web browser control that phone gap runs in .
you'll need a more lightweight framework for this .
you can use an inappbrowser control to show your site in case it's responsive , but you wont have the device camera and contacts and so ...
take a look at : http://docs.phonegap.com/en/3.0.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser

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.

Resources