Monday, January 6, 2014

Developing first-class web applications (Part I)


I recently discovered Lineman, a fantastic productivity tool that takes the pain away from front-end web application development.

Traditionally, at least for Java developers, the front-end part of a web application is just an obnoxious detail, an unpleasant experience that needs to be survived. The effect of this is that backend developers hate front-end code.

I believe this is not so much because of the language (usually JavaScript) but because of the lack of structure and other problems arising from not having a clean separation between the front and back end assets:


  • To be able to work on the front end you have to check out the whole backend project
  • The Javascript code is completely dependent on the backend running in order to run itself.
  • The Javascript code has no unit tests since it's not first-class.
  • The Javascript code is probably coupled in some way with the backend code so we can't easily make changes to the front-end without having to change something on the backend (or viceversa).
  • The front-end application is forced into a very particular structure that suits the backend application.
The downside of this is that client-side code is not given the same amount of care and attention that is given to server-side code. Typically, client-side code that is part of a server-side application is a big ball of mud without real structure and usually without tests. It is hard to understand or to change. 

Lineman allows you to build fat-client web apps and completely decouple the front-end from the back-end. In addition it builds assets, mocks servers and runs tests on every file change. It also comes with an API proxy that allows you to pair your client app with a server-side app whenever the development mock server is not enough. Yes, you can work with front-end code and not miss the server-side tools a single bit :)

Liberating client-side assets from the opinions of a server-side framework works wonders. You can now develop the front end in a much more agile way. It is much easier to give it the proper structure and write tests when the front-end project becomes first-class.

As an introduction to Lineman I recommend watching the following video with Justin Searls.



In the next post I will post the details of a small application that I built with Lineman using continuous delivery on Cloudbees.




No comments:

Post a Comment