Coder Social home page Coder Social logo

elsie's Introduction

Elsie is an experiment, testing the hypothesis that (mostly) coding conventions can be a good way to implement state machines.

A set of opinions are tested here:

  • a Java interface defines a machine
  • interface methods define the inputs to the machine
  • arguments to methods capture the (variant) input data
  • a singleton instance of a Java class implementing the interface, defines a state

This is in contrast to the prevalent approach to state machines in Java, which involve a DSL. In those frameworks inputs (or events) are explicitly modeled as first-class entities.

  • whereas the DSL approach demands that you define a new class per input/event type, in Elsie they're just methods on an interface
  • whereas a typical DSL-generated state machine must be wrapped in "object clothes", in Elsie the state machine, ultimately, looks like a regular old Java class

See Also

The GoF State pattern.

TODO

  • discuss mutable vs. immutable data holder class
  • discuss side effects: immediate vs. monadic
  • discuss concurrency control and applicability to a range of situations, through interchangeable policies

elsie's People

Contributors

bill avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.