Lessons from a Pure JavaScript Project
gga
#2011-10-31
Our team is wrapping up the first release of a pure JavaScript, single page web application. No one on the team has ever built one of these before and it seems they are becoming the new hotness, so I thought it would be useful to attempt to write down some observations and questions. Hopefully, you can learn something and I can be pointed in the direction of doing it better next time.
The application is a mobile web app for a customer who already has a number of native apps for iPhone and Android. All these apps use an existing set of services to access the core data. Our app used JQuery Mobile and Underscore.js as the only libraries. For testing, we used Jasmine and cucumber.
Originally, I wanted to post this as a single post, but it go long. Very long. Looking back on our project, there were four things I’d like to try doing differently.
-
We didn’t use CoffeeScript for what felt like very good reasons at the time. In hindsight, this was a mistake.
-
Writing functional tests for a pure JavaScript application is a different problem requiring different solutions than a typical web application.
-
Your JavaScript application is going to end up as a very sophisticated GUI application, with more complex state and flow management than most typical web applications. Consider your use of models and controllers very seriously.
-
Web applications have long had to deal with the Back and Refresh browser buttons. A single page JavaScript application adds some new wrinkles. But I think that HTML 5 also includes some neat solutions.
As I get my posts written, I’ll update the above with links.