akuchling: Sherlock Hemlock (Default)
There are many JS frameworks out there, and I want to learn one. I chose Backbone.js. (Angular is probably more popular, but also facing a Python 3-ish transition, so I let it slide.)

Backbone.js: one of a bunch of MVC-ish frameworks. Others include Angular, Spine, JavaScript MVC, Ember, Knockout.

TodoMVC is a to-do list app built in several different frameworks so you can compare them.

Backbone provides:

Models: represent domain objects.

  Wine = Backbone.Model.extend();   // Creates a model
  w = new Wine({prop1: val1, prop2: val2, ...})
Collections: a bunch of Model objects. Will apparently infer a REST-ish backend automatically.
 WineList = Backbone.Collection.extend({
   Model: Wine,
   url: "http:..."     // URL for the REST back-end
  wines = new WineList([list of objects used to create Wine instances]);
  wines.each(function (w) {...})
  HomeView = Backbone.View.extend();
  view = new HomeView();

Templates: Backbone uses Underscore for templating by default.

Routes: recording app state in the URL, and moving between different states.

  wineApp = new AppRouter();
  wineApp.routes = dict of string to method name


View.events = dict of event name to method name called when event is triggered.

akuchling: Sherlock Hemlock (Default)
I recently used the jqPlot charting library in a project for work, and noticed that one of the documentation files that listed the available options, jqPlotOptions.txt, warned that it was out of date.

I spent about a day going through the jqPlot documentation files cleaning up typos and fixing a few sentences, and filed a pull request.

Then I turned to updating jqPlot options. This is unfortunately fairly difficult because internally the library copies options to instance attributes, but not every attribute is taken from an option. I grepped the code for "opts[.]" and "options[.]", which found a bunch of names, but some seem to be internal only. I filed another pull request with my partial work, but it needs feedback from the jqPlot maintainer to tell if I'm identifying options correctly.

One lesson to take away: always keep your documentation incrementally up to date, instead of just giving up and letting it decay while saying "I'll update it later". Fixing it later is more difficult and probably more error-prone, so over the life of the project delaying documentation updates doesn't save effort. It just lets you be lazy right now.

akuchling: Sherlock Hemlock (Default)
I began setting up the skeleton for Barb's suggested sandbox game, as an HTML5 app that uses jQuery Mobile. I think I'll start out by trying the fake 2D approach, not a serious 3D simulation of every single particle in the sand.


akuchling: Sherlock Hemlock (Default)

September 2016

2526272829 30 


RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 23rd, 2017 03:52 am
Powered by Dreamwidth Studios