Tuesday, October 25, 2011

Mon 24th October

A bit of a late start today. Slept in a bit due to being fairly sore from riding yesterday, spent a bit of time giving the olds’ cats some company.

I was hoping to get the score sheet fairly well finished today, but grappling a bit with some design issues. I want to keep navigation across the sheet as decoupled as possible from the model itself, but the navigation obviously needs to be able to identify individual balls. I could

  • handle the visible selection and deselection of balls part of the model (have a property on each ball to indicate if selected and bind a css class to this) and raise events to do this from the navigation module,
  • use jQuery to do the visible selection and deselection. This means the navigation module needs some way of identifying the HTML element for each ball, such as through the ID of the element (this would mean the template for each ball needs the context of what over, batter, inning and team it belongs to).

Either way, handling a click event on each ball element needs some way of identifying the individual ball. Ho-kay! Rethink required.

Did a bit of research into templating engines, which led to another potential JavaScript framework. It appears jQuery templates are being discontinued, with the responsibility of a templating solution being handed to the jQueryUI team. A likely candidate to supersede jQuery templates is JsRender, according to http://www.borismoore.com/2011/10/jquery-templates-and-jsviews-roadmap.html. Should be a fairly straightforward port to use them if they do become the “official” templating engine, supported by both jQuery and knockout.

This led to looking at JsViews as a potential JavaScript framework. I didn’t do much research into alternate frameworks, mainly because knockout seemed to be such a good fit for the project. While they could certainly do the job, judging by the ToDo sample application (http://borismoore.github.com/jsviews/demos/step-by-step/10_todos.html), knockout would appear to be a much more elegant solution, particularly with its dependentObservables and mapping plugin.

No comments:

Post a Comment