HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
etgryphon
stativus
JavaScript2012–2012
etgryphon / stativus

stativus

Statecharts for the rest of us...in javascript

2Distinct people
2Mentions
0Explicit recommenders
125GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Statecharts for the rest of us...in javascript

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by week2 dated mentions

Observed mentions: 2012-04-16 16:58:32 UTC to 2012-07-03 17:39:34 UTC. Weeks start Monday, UTC.

012012-04-16 00:00:00 UTC to 2012-04-23 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsApr 162012-04-23 00:00:00 UTC to 2012-04-30 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-04-30 00:00:00 UTC to 2012-05-07 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-05-07 00:00:00 UTC to 2012-05-14 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-05-14 00:00:00 UTC to 2012-05-21 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-05-21 00:00:00 UTC to 2012-05-28 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsMay 212012-05-28 00:00:00 UTC to 2012-06-04 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-06-04 00:00:00 UTC to 2012-06-11 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-06-11 00:00:00 UTC to 2012-06-18 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-06-18 00:00:00 UTC to 2012-06-25 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-06-25 00:00:00 UTC to 2012-07-02 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2012-07-02 00:00:00 UTC to 2012-07-09 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsJul 2

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Apr 162012-04-16 00:00:00 UTC2012-04-23 00:00:00 UTC101
Apr 232012-04-23 00:00:00 UTC2012-04-30 00:00:00 UTC000
Apr 302012-04-30 00:00:00 UTC2012-05-07 00:00:00 UTC000
May 72012-05-07 00:00:00 UTC2012-05-14 00:00:00 UTC000
May 142012-05-14 00:00:00 UTC2012-05-21 00:00:00 UTC000
May 212012-05-21 00:00:00 UTC2012-05-28 00:00:00 UTC000
May 282012-05-28 00:00:00 UTC2012-06-04 00:00:00 UTC000
Jun 42012-06-04 00:00:00 UTC2012-06-11 00:00:00 UTC000
Jun 112012-06-11 00:00:00 UTC2012-06-18 00:00:00 UTC000
Jun 182012-06-18 00:00:00 UTC2012-06-25 00:00:00 UTC000
Jun 252012-06-25 00:00:00 UTC2012-07-02 00:00:00 UTC000
Jul 22012-07-02 00:00:00 UTC2012-07-09 00:00:00 UTC101

What Hacker News says

2 sources
One problem with a state machine approach compared to MVC is that it isn't as familiar. Do you use a Moore or a Mealy machine? A combination of the two? Most people don't use state machines to model the flow of an entire web application, so if you try it out, you might feel like you're on your own. It can be worth it, though. I used state machines for a client-side UI in ClojureScript a few months ago. It forced me to think hard about the structure and flow of the app. But after that, my state was in an explicit, contained area. If I had been using something like Backbone, the state would have been hidden among the various model objects. I felt like I had a much better mental model of how the program worked after the initial design process. Keeping state in control reduces complexity. [1] Another benefit was that the state machine library
Read the rest
I used allowed me to audit the trail of states as they happened. When a user toggled a checkbox to trigger an event, I could look in the JS console and see the moment the checkbox was triggered. If something wasn't working, I could often debug it by seeing if the states and transitions happened in the right order. I wouldn't be able to do this with a traditional MVC framework. There's one very important thing that nobody has mentioned yet: state machines look ugly in your code. When they get big, they are difficult to follow. I started out using a state machine library that was just too simple. Once the interactions became complex, I was getting lost in my code. I looked for a clearer, more succinct way of modeling state machines, and eventually I came to Harel statecharts. [2] Statecharts are a way to model state machines without explicitly writing out a ton of redundant states. The number of states becomes a problem when you actually try to model an application with a basic non-deterministic FSM. If you're interested in using state machines in your web application, you need to read the linked paper. The example of modeling a digital watch with statecharts makes it easier to see how you could use them in a web app. I believe statecharts are to MVC as Clojure is to every mutable state language out there. It feels weird at first, but once you get used to it, it's much simpler. It's just not necessarily easier. [3] If you want to try them out, there's a good library called Stativus for writing statecharts in JavaScript: https://github.com/etgryphon/stativus/ [1] See "Out of the Tarpit" for why state and complexity are closely related: https://dl.dropbox.com/u/249607/all/Out%20of%20the%20Tarpit.... (The original link is down, so I made a mirror.) [2] The original article on statecharts: http://www.wisdom.weizmann.ac.il/~dharel/SCANNED.PAPERS/Stat... [3] More about the idea that simpler things are not necessarily easier: http://www.infoq.com/presentations/Simple-Made-Easy
In MVC, MOVE - Or Simply A State Machine?

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.