ignite.js: An Introduction
Ignite.js is a package to help design, implement and debug asynchronous software. It is a framework that allows state machines to be described in a natural, understandable way within JavaScript. It is focused on being quick and easy to use, whilst providing powerful tools to help the design, implementation and deployment stages.
Reasons to Use
- Simplified asynchronous and behavioural design for node.js
- Remove callbacks
- Handle multiple EventEmitters easily
- Allow structured system design
- Fully asynchronous
- Useful plug-ins to support common asynchronous patterns
- Easily create visual representations of the code (state diagrams and, coming soon, sequence diagrams)
- Simply distribute the behaviour across multiple processes
- Support tools to help design, debug and deploy
- Easily build high performance web servers to power rich Internet applications (see our Chat Demo)
Inspiration
The inspiration for Ignite.js is UML2 modelling, where the object-oriented (OO) design can be combined with behaviour design in such a way that both the static and dynamic aspects of the system are described. OO design and programming, in the shape of components and classes, is obviously now very widely known and adopted. Behaviour driven design, in the shape of state machines, although used, is much less popular. The reasons for this are many but include:
- Behaviour driven design is asynchronous, which doesn't match the synchronous nature of most programming languages;
- Traditional state machines have been a restrictive environment in which to design a system.
- Good behavioural design is difficult!
The power and asynchronous nature of node.js turns (1) on its head, it is a highly efficient asynchronous programming environment, but it means that behavioural design becomes much more important. State machines have also come a long way from the rather simplistic view often taught on CS courses. Ignite.js uses as its basis UML2 state machines, which offer such things as:
- State machine variables (aka Extended States)
- Guard conditions
- Entry and exit actions
- Internal (local) and external transitions
- Hierarchical states
- Event deferral
The great news is that the architecture of node.js makes it an ideal system in which to use state machines. Unfortunately, good behavioural design is still non-trivial, but we believe by having a framework, along with associated tools, that it becomes a much easier and more natural process.