ParsaLabs | Blog

A publication about the web and more.


| Comments

I have always had strong opinion on this topic and recently was thinking of writing up a blog post to not only organise my own thoughts, but also to share with you why I believe using this approach leads to better code, and happier development experience.

Fortunately, David Heinemeier Hansson, the creator of Rails Framework, just wrote an awesome article on this matter on 37signals’ blog.

Read it here: Server-generated JavaScript Responses.

I particularly acknowledge the point David made about “easy-to-follow execution flow”. Using this approach, you follow the same conventional MVC flow, just that instead of spitting out HTML, you return Javascript. In my experience, this results in a much more maintainable code, and is less distracting to the developer (you are not making a major context switch). Whereas, premature usage of client side MVC, means that you end up with an MVC on the backend, and an MVC on the front (therefore, complexity = MVC2). And the more complexity is introduced, the harder it gets to kill bugs, maintain code, etc.

So, embrace this approach, folks! :)