Clone wiki

timesheets / design

Design requirements

  • Define the code as modules to integrate it in applications. Use AMD modules, a spec to manage dependencies, and it's gaining wide acceptance in open-source, and used in companies like IBM.
  • Despite the code is split in modules, developers could opt to download a non-module version. We'll use a tool like Almond.js, it compiles all the dependencies to a single file to use it without an AMD loader.
  • Decouple the parsing of timing data and the time scheduling logic. That is, parsing XML/HTML should be in a separate module. This will allow to not load the parsing module when not needed.
  • The timesheet engine consumes light JS objects with the timing data, instead of DOM nodes (XML/HTML nodes) holding the timing data. eg. This allows to create a visual editor to design content, and the editor produces JS objects (faster, less memory) instead of XML nodes, so we won't need to load the Timesheets parsing module.
  • Make possible to "pre-parse" the timesheets in the server for deployment, so that the browser does not have to parse the XML, and app loading will be faster, and more responsive for users. Additionaly, we avoid to load the XML parsing module.
  • Allow to load timesheets on demand, ie. not only at the start of the application. This way, initially it only loads the most used parts in the application, and will load other parts at the time they are requested.
  • Timesheets can be loaded within a scope, ie. they are applied to a specific HTML view, instead of loading them for the whole HTML document. This is a requirement of building SPIs out of composing small views.
  • Allow dynamic re-evaluation of the Timesheets. For dynamic applications that load data on user demand (data-based apps), new HTML nodes are added/removed to/from the document, and the timesheet engine needs to re-calculate the time info- not only of the new nodes added/removed, it also affects the timing/synchronization of other nodes.
  • The code should not include fallbacks for ancient browsers. Those things should be loaded at application level. Since the engine is to be integrated in an application, it assumes any fallback has already been loaded (eg. Array.indexOf, XHR, animationFrame, etc ), so the code is designed for modern browsers. [Nevertheless, I do provide fallbacks for older browsers, but I put them in separate package, not included as part of the Timesheets engine modules.]