Java to JavaScript journey

Being a Java guy, I started off spending time understanding what are good web frameworks for someone with strong Java background. In the beginning of my journey, I hated Javascript as I hate seeing famous “undefined” errors in browser, but that somewhat changed in the end. For most of my learning, I wanted to stick with current bestpractices/tools like Bootstrap, HTML5, Responsive Webdesign (RWD), Single Page Application (SPA), Model View View Model (MVVM)

Let me start with Java world:

In Java world, there are 2 competing frameworks where you can pretty much do all the best practices of web development like HTML5, Bootstrap, RWD, SPA. Vaadin (www.vaadin.com), ZKOSS (www.zkoss.org). Both take different approaches. Vaadin is built heavily on GWT (http://www.gwtproject.org/) and it is 100% java code including frontend markup. Vaadin 7 the latest edition has a poor support for CSS. I liked ZKOSS a lot.

  • It has a nice blend of markup and Java support,
  • it has good support for CSS (SCSS),
  • it has Bootstrap theme out of the box,
  • it encourages SPA a lot and
  • it has a decent MVVM support, but you have to pay for it, I would rate Knockout.js much better than this.

I ended up building a decent excel based application on Heroku. As I proceeded to do complex things, I realized that in Java we end up with lot of boilerplate coding. I stumbled up on http://projectlombok.org/ to reduce some boilerplate, but still lot of boilerplate… this forced me to think if this is the reason people move towards modern programming languages like Scala, Groovy, and my latest favorite Clojure.

Clojure in particular is interesting because it is JVM based, follows Lisp way of working, you can write efficient code and avoid boilerplate, and has ClojureScript for web development. I did spend close to 1month exploring if it is good for web development.. the good thing is I learnt a new language. The big disadvantage is it has a huge learning curve, and it is not for weak hearted, you need to be good in emacs and some good frameworks like http://hoplon.io/ only work in UNIX platforms.

Javascript world:

In essence, I realized that if you want to be good web development person you cannot avoid Javascript, love it or hate it, embrace it. Again my journey started with understanding Ember.js. It is a good framework, but poor documentation and heavyweight. One of my friend pointed me to Knockout.js (it has a strong MVVM support), I loved it. I was also looking for a SPA, I stumbled upon, http://durandaljs.com/ , according to me this is the right direction for SPA.

If you want a good IDE for Javascript, NetBeans IDE is one of the best. I am spoilt by STS IDE, features like intellisense, code formatting, running the app from within the IDE are a must. Luckily NetBeans supports all of these and more, it is tightly integrated with Chrome browser and has a plugin within Chrome for running and debugging frontend (much better than firebugs etc..).

Finally for server side, there were 2 candidates I was exploring, Node.Js and Grails. Again I have this love / hate relationship with Javascript I am still not sold on Nodejs . I am settling with Grails because it has strong STS IDE support. I am trying to rewrite my “excel on the web” application, I deployed on Heroku with durandaljs, Knockoutjs on the client side and Grails/ Groovy on the serverside, with strong JSON contracts. I will share some of these learning

Conclusion:

As I mentioned earlier, embrace Javascript, there is lot of matured frameworks in JS (Ember.js, Angular.js, Backbone.js, Knockout.js are popular ones). If you have a good IDE you can actually be productive. Also on the server side there are alternatives to Java like Groovy, Node.js. My preference is Groovy because I come from Spring background and I love STS IDE.

Advertisements

7 thoughts on “Java to JavaScript journey

  1. Anonymous

    “In Java world, there are 2 competing frameworks …” – no, there are much more than just two frameworks. This statement looks like you are promoting ZKoss (which is hardly known by anyone) by putting it on one line with Vaadin (which is well-known and popular) and ignoring all other frameworks.

    Reply
    1. Krishna Post author

      Hello,

      I know there are lot of web frameworks in Java like Spring MVC, Play, Struts, JSF. But in this blog I was only evaluating Ajax based Rich Internet Applications(RIA), hence I came up with only ZKoss and Vaadin. My individual preference was ZKoss, I agree..

      Is there any other Ajax based RIA frameworks in Java, please enlighten me, I will explore that as well. This is for my learnings.

      Thanks
      Krishna

      Reply
      1. Johnny Storm

        Um, you meant to link to zkoss.org, NOT zkoss.com, the second one which leads to an empty domain.

  2. Anonymous Coward

    Try qooxdoo. I like it more than anything else. It allows programming in a very spring-like way. Very natural for Java programmers, IMO.

    Styling is nothing like CSS – it uses something called themes – essentially, JSON files specifying styling. So you can’t reuse any CSS knowledge you may have. OTOH, you don’t have to manually deal with browser differences and bugs – it knows how to translate the theme files to pixel-perfect similar visual aspect in any browser (I have used it in quite a few projects, and it does indeed look the same in every supported browser).

    What I look for, when starting to build a single page app, is a rich set of well integrated widgets. jQueryUI is poor, but Dijit is quite nice, ext also has many widgets but isn’t truly free. However, qooxdoo provides a much richer lib than anything else – and is completely free. I don’t want to build my own, tree, splitter, multi-column dropdown listbox, combo-box, tab control, data grid and whatnot, I want them provided to me as library components.

    This, plus all the support you want for building your own MV{C|P} (I prefer MVP) on the client side (bi-di data binding, events, properties much like .Net properties but richer, model interfaces for most widgets, virtual widget support – i.e. only render the visible portion of a large data table or tree as DOM elements), plus support for consuming REST and RPC services, logging, native profiling, built-in unit test runner, support for mocks, assertions, accompanying minifier, selenium support, debug logging, you name it, are all features which make anything else look like toys, IMO.

    And it also has a widgets package specifically for mobile.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s