JS has gained a lot in the last 3 years, owing to these developments:
- the only language that's universally implemented in browsers
- new virtual machine (V8) that's 20-100x faster than older implementationshttp://www.infoq.com/presentations/Performance-V8-Dart
- server-side and cloud deployments (node.js)
- a huge amount of libraries for web development.
E.g. see this list of popular libraries that Google is hosting on its distributed server network, to increase speed
ResearchSpace currently uses the following popular libraries
- jQuery (used by Exhibit)
- Dojo (used by RForms)
If we decide (or you force us ) to use JS as the basis of RS, here's a library that could become our foundational framework.
(This below is compiled from a discussion between me and Krum Georgiev)
AngularJS is a web app framework by Google that seems very well put together.
Clean model/view separation (separation of concerns through a variation of MVC); very clean markup (declarative templates with data-binding); dependency injection, keep model & view automatically in sync; define application "routes" (URL mappings) and support deep (bookmarkable) links; attach to specific pieces of your page (doesn't want to own the page); define your own tags in html ("directives") and create components easily (providing a HTML compiler for creating your own DSL in HTML: "what HTML would have been, had it been designed for building web-apps.")
That doesn't mean we won't use other JS libraries like jQuery, Dojo, Prototype, Underscore, Backplane, etc. AngularJS doesn't try to be the only framwork, and plays well with other frameworks.
AngularJS maybe allows you to create a web app completely within the browser, and relegate the role of the backend to manipulating and serving data, but not creating UI.
All submits in AJAX, and no normal submits needed anymore
4 nice examples. One shows how to store data in the cloud in a few lines (see Wire up a Backend, mongolab.js)
Comprehensive tutorial, builds a mobile phone store
Shows unit testing with Jasmine and Testaculous. It's in BDD-style (think RSpec and Cucumber): very easy to write and natural to read
Shows end-to-end (e2e) testing in exactly the same BDD style and using similar syntax.
- docs.angularjs.org: APIs, modules etc
Gallery of applications built with AngularJS
The DoubleClick Digital Marketing Manager and other DoubleClick Digital Marketing Platform applications are used by thousands of marketers and agencies worldwide. Google bought DoubleClick, and this is the platform that drives their advertising busienss
Uses HTML5 Canvas for the tag-graph. Says they'll show the source if someone's interested
Olympics 2012 real time live data (in Italian)
Downsides: quite steep learning curve; novel and untried. Although the tutorial is very clear on how you use it, the backend workings of it sound like black magic: some of the "wiring" is accomplished through naming convention, as in Rails.
Discussion on the angular.js forum "When is GWT appropriate, when is AngularJS appropriate?"https://groups.google.com/forum/#!topic/angular/9P4RD3IbQwk
The most significant post is by Adam Bender:
- Mature, well tested, highly engineered solution for producing pure client side applications.
- Lot of examples/documentation/support available
- Highly efficient/performant, both in terms of app delivery size and runtime performance (they now even benefit from the closure compiler)
- Written using staticly-typed, well tooled language. In my case this is important as our app is safety critical (people can die if it screws up) so the idea that we have the compiler checking for a class of errors means one less set of tests I have to write.
- Great Development environment that makes you productive even though you have a compile step in your build
- The ability to use Google Guava library. Don't underestimate the power of having robust utility libraries to do things like argument assertions, collection traversal, exotic data structures etc. There really is nothing better than Guava when it comes to this kind of stuff. Of course because Guava is used by the GWT dev team it means that you dont have to worry about it surviving the JRE emulation - it will just work!
- The single greatest thing about GWT for me was the programming model of Activities and Places - more commonly known as Model, View, Presenter (MVP). This programming model is a perfect fit for web application in particular where you may want to reuse logic to power different shaped views (read phone, tablet, laptop etc.). GWT really embraced this pattern to great effect
- It's still Java. No matter how you slice it, and how ironic it is, Java just isn't web-ui friendly. Java is not a good choice for anything programming problem that involves a lot of click handlers, or one-off listeners. Anonymous Inner Classes are just not the right way to do it!
- Even with the speed ups you have to avoid compiling as much as possible. On my laptop (late-model quad core mac book pro) compile times range into the 2 - 3 minutes time frame. It is twice as slow on a dual core machine. That really is a long time to wait between making changes and seeing a result. Even though the GWT team have done a great job making compilation less necessary during day-to-day development it's still manages to suck time out of my dev cycle. Also, like taxes and my waist - compile times only seem to grow with time.
- GWT applications cant support dynamic module loading easily. Think of a portal like iGoogle where you want to include many modules, perhaps only determining which ones at run time. GWT will fight you every step of the way because GWT, due to the extreme optimization it does, likes everything in the world to be known at compile time. This means that you can't link code up in the browser which means you lose out on what I think is one of the greatest features of the web.
- Related to that last point, GWT is not very modular in and of itself. While there is the ability to do code splitting to improve load times, you still end up sucking down a lot of GWT library stuff for even the simplest hello world app. Now this may or may not matter to you, but if you have mobile dev in mind, every byte counts!
- Angular is "of the web" It embraces core web technologies and make it easy to write your app using standards.
- Angular - owing if I recall correctly to it's Flex influence - has a fantastic programming model with binding, DI, promises, and Dumb views. Some might call it a MVVM approach, but it still seems like MVP to me and so just like I loved it with GWT I also love it with Angular.
- Integration with 3rd party libraries is a snap thanks to the public exposure of $apply and $digest. You can actually improve other libraries by extending binding capability directly to them using core Angular methods.
- Angular is nice a modular framework and works to build small apps all the way up to multi 10s of thousands lines apps - don't know about anything bigger than that cause I havent worked with it but I think it should work.
- Angular has a healthy and vibrant community where any question you have can be answered pretty quickly.
- Part of being a young project means the docs and examples out there aren't quite polished down which can be quite annoying. However, this problem is getting better by the day and as far as I am concerned Angular has exceptional docs given it's limited exposure to public consumption.
- Angular has been knocked for its dirty-checking for binding approach. While I cant comment on the alternatives to much I think for the most part this is a non-issue for most apps but you'd have to evaluate your applications binding needs. This is something that we should keep in mind - dirty-checking can cause major performance problems if there is more information. For example 2000 pieces of information to a human on a single page. Anything more than that is really bad UI, and humans can't process this anyway.
For more information check this link: http://stackoverflow.com/questions/9682092/databinding-in-angularjs
If you have only Java developers - use GWT. If you would prefer to have a compiler help catch some, but by no means all human errors - use GWT. If you need to rely on extensive examples or documentation, for now GWT is better but that will change. If it is going to be a very large, long lived application - something static typing an the Java tooling ecosystem may help with then GWT is your option.
Personally, having discovered Angular I don't think I would ever recommend GWT as a place to start for a web app. While GWT represents a truly amazing engineering success, I think it is an idea whose time has come and gone. I look forward to a future building AngularJS apps and solving problems for customers in a way that not only makes them happy, but keeps me from wanting to know my finger tips off!
Google is working on a new web language: http://www.dartlang.org.
It is a competition to JS that allows safer and more scalable programming. It has native implementations (Chrome, maybe Mozilla, node.js) but also a translator (dart2js) to JS to allow deployment on more devices.
The native implementation already outperforms V8 by 20-30% (see slide 39).
But it doesn't yet have enough libraries.