Posted on October 28, 2014

The last few days, I’ve been playing with ember. It’s been clear to me pretty much since I got flare anywhere close to working that do everything server-side is just too slow, and I’d eventually need a lot more javascript. And it seems worthwhile to go with a serious framework, and the sensible choices largely seem to be angular or ember, and my researches indicated that ember was possibly the more mature.

So I’ve been through the todo list tutorial, with yesod serving the site. I was mildly worried that yesod and ember might not play well together, but it seems to be fine. Handlebars for elements Just Work. For attribute handlebars, you need to step briefly outside hamlet, so templates end up looking a bit like this:

{{#if hasCompleted}}
  \<button id="clear-completed" {{action "clearCompleted"}}>
    Clear completed ({{completed}})

Hamlet’s backslash-at-beginning-of-line escape could have been made for exactly this.

So the tutorial all went through without a hitch. However, it persists the data using a local storage adapter, which is obviously for pedagogical purposes only. My next step will be to replace this with an AJAX-based store (backend in yesod / persistent, naturally).

One oddity has struck me. Both yesod and ember use the MVC idea, but in yesod a model is a type (e.g. a database schema), whereas in ember it’s a value (e.g. database rows).

Although I’m pretty happy with how much ember achieves with how little, I think I should just briefly review the various other frameworks TodoMVC just in case there’s anything that appeals more.