Home

Awesome

Usecase for Statecharts in SproutCore

This project includes the same SproutCore 2 application in two versions:

  1. Without a statechart but with mediating and coordinating controllers
  2. With a statechart that replaces the coordinating responsibilities form the controllers

The application is complex enough to get in trouble with a bunch of coordination controllers but simple enough to understand in a few minutes.

For a high level view you can see the statechart diagram in 'pomodoro-timer-statechart.png'

Soft results of this Experiment

The goal was to show the difference in maintainability of the two resulting codebases.

Of course it doesn't make too much sense to speak of hard maintainability for such a simple application but this can quickly become a problem if the application grows and complexity rises.

Here are some thoughts and soft results:

Hard facts and numbers

Of course these differences can not only be described with 'blabla' but also with concrete measures. jsmeter was used to measure the two complete javascript code bases and here are the results:

Without Statechart

With Statechart

The results show that statecharts add more lines of code but lower complexity and improve the overall maintainability of the code base.