FacSal is a salary management and reporting application. My role on FacSal encompassed all aspects of the design, architecture, development, and deployment of the application.
One of the more interesting aspects of FacSal is the way in which it handles data. To provide convenient caching and querying of data, I leveraged the Breeze rich data management library. This allowed me to fetch data once and track subsequent changes rather than repeating requests to the server.
On the server, I used the Entity Framework object-relational mapper that Breeze extensively models itself after. This simplified querying, as Breeze supports the LINQ-like syntax employed by Entity Framework. Additionally, Breeze is able to interpret many of the validation annotations of Entity Framework, thereby generating client-side property validation for free.
To improve the initial responsiveness of the application, I cached the data model Breeze fetches each time the application starts within clients’ local storage. Avoiding the performance penalty of fetching this relatively large resource improved start time on subsequent visits. To avoid stale data models, I created a configurable flag to allow for model expiration in the event the model had changed. Further reducing the number of HTTP requests, I also proactively navigated to related entities in addition to batch processing saves.
Continuing the theme of data optimization, I took advantage of the AMD API of RequireJS, taking caching a step further by importing a single entity manager across my view model modules. This manager was responsible for tracking all application data. Because caching a significant amount of data on the client can drag performance, maintaining a single manager was an important step to avoid wasteful recreation of entity managers for each view. With the entity manager caching and tracking data across the application, I fetched all “lookup data” (used in fields such as drop-down lists) on application start, allowing subsequent views to initialize more quickly.
Because no user enjoys losing unsaved data, I made use of change tracking to warn users taking actions that would otherwise cause unsaved data to be lost. Since FacSal accesses sensitive data that requires authenticated and authorized sessions, I also tracked users’ sessions and warned them when their sessions were nearing expiration.