Amazon States Language – A JSON-based language to describe state machines
states-language.net
states-language.net
So Amazon has created a new calling convention, where conditional logic now also requires a context switch and JSON serialization. Then they charge you for the call .. $tdcall?
This will certainly have some useful applications, maybe someone will build an inexpensive data processing pipeline on top of it. Having seen many visual workflow tools through the years, most are simplifying complex underlying process, but these step functions and state transitions are modeling basic internal control flow with complex abstractions and little benefit other than retries with backoff.
The pure functional immutable nature of the data flow is ideally nice but tainted by the JSON. The parallelism is interesting, but it seems bolted on instead of a more powerful central part of the design.
is that entire system state to state or per state?
i.e. if i have 100 states each transitioning 365 times bootstrapped a thousand times
they'll charge nearly a million dollars or nearly a thousand?
noting that takes like a minute on my desktop.
"ChoiceStateX": {
"Type" : "Choice",
"Choices": [
{
"Not": {
"Variable": "$.type",
"StringEquals": "Private"
},
"Next": "Public"
},
{
"And": [
{
"Variable": "$.value",
"NumericGreaterThanEquals": 20
},
{
"Variable": "$.value",
"NumericLessThan": 30
}
],
"Next": "ValueInTwenties"
}
],
"Default": "DefaultState"
}This is the underlying spec of Amazon step functions.
and if you need json, plenty of xml to json convertors knocking around.
its one thing to serialise your states to json. quite another to try and recreate javascript or any other low permission language in it.
I know _why_ they did it, and i bet a fair few pure managerial types fall for the bait and commission a project or thousand on it, locking themselves in to amazons absurd pricing model for production systems. But everyones got to make a buck eh.
Well, it seems history is being repeated. Just because something exists that a lot of people use doesn't mean you need to build everything on top of it.
What's new this time is the pricing model. It used to be we could run what we wanted on our own hardware on our own time. SaaS is new, mostly impossible to pirate (hacking AWS keys aside), and priced to make your eyes water.
(cond
((not (eq (type $) :private)) :public)
((<= 20 (value $) 29) :value-in-twenties)
(t :default-state))I wrote a short essay about this work in which I argue that the software engineering community needs to embrace the design methodologies and rigour of hardware designers: https://medium.com/@alpinelakes/on-monday-i-learned-i-got-ac...
See also: http://blog.encapsule.org/early-encapsule-project-history/20... (old code but same ideas as what I'm building now in Node.js/HTML5 @Encapsule).
Several things I believe are actually essential to make use of any of these ideas at scale:
- There needs to be an ad-hoc extensible standard for notating serialized data with markers, tags, semantics, metadata (whatever you care to call it). It is not practical to do unsupervised feature extraction on internal message streams. And, it's _insanity_ to write/test/maintain custom validation/normalization logic.
- Given the above, FSM declarations must be encoded with labels (as above) so that generic code can easily affect interop.
- Small FSM's are reasonably easy to comprehend. But, very few systems can be modeled with simple FSM's. Rather, real systems can be modeled as complex directed graphs where edges represent the flow of observable state from one FSM to another (vertices represent individual FSM).
- Given that real systems can be modeled using non-trivial graph models of FSM (as above), building reusable components by splicing and dicing the graph up is logically possible. But, this is not something that mortals can do by hand. Considerable tooling is required to make it practical to design systems like this.
If you're interested in these topics, and want to help, look me up @Encapsule.
Kind of like Hypertext and Hypermedia, which languished as an academic pipe dream for decades with occasional commercial moments of brilliance (Hypercard), until Tim Berners Lee figured out the right mix.
the main problems included being actually very hard to understand visually, very ugly, and subject to all sorts of edge case errors when running. basically easier to write code then compile uml from that for anyone crazy enough to want it.
the crux of the problems is verbosity. Once systems start to get to a reasonable level of complexity the uml diagrams can cover the walls of a large room.
vs 1 page of a4 for pseudocode.
I have given a couple of keynotes on this topic at the W3C and RESTfest over the years, but just haven't done a lot of the grunt work since I have a day job.
See - http://www.slideshare.net/StuC/ill-see-you-on-the-write-side...
Also - http://www.slideshare.net/StuC/linking-data-and-actions-on-t...
And per your point about how you need serialized data notation + FSMs, see http://web.archive.org/web/20160410102032/http://www.stuchar...
I have felt this train of thought could be useful for a general purpose approach to software engineering beyond distributed systems interop. Unfortunately this has been a hobby horse of mine for about 10 years that I don't have a lot of time to dedicate to....
> I have felt this train of thought could be useful for a general purpose approach to software engineering beyond distributed systems interop
One of the best articles I've read in recent years on the topic is 'On the Industrial Adoption of Model Driven Engineering. Is your company ready for MDE?': http://www.uajournals.com/ijisebc/journal/1/4.pdf
> Unfortunately this has been a hobby horse of mine for about 10 years that I don't have a lot of time to dedicate to....
It's a fun horse to ride if not a bit of a wild and tiring.
Wait until you guys check out my hashtable implementation in the cloud.
https://github.com/jbeard4/SCION
And for background, see the pioneering work of Dr. David Harel:
A list of all of his papers
http://www.wisdom.weizmann.ac.il/~harel/papers.html
A few on Statecharts
http://www.wisdom.weizmann.ac.il/~harel/SCANNED.PAPERS/Seman...
http://www.wisdom.weizmann.ac.il/~harel/reactive_systems.htm...
http://www.wisdom.weizmann.ac.il/~harel/papers/RhapsodySeman...
http://www.wisdom.weizmann.ac.il/~harel/papers/Statecharts.H...
http://www.wisdom.weizmann.ac.il/~harel/papers/Statecharts.H...
Prof. Harel the dreamer...
http://www.wisdom.weizmann.ac.il/~harel/papers/LiberatingPro...
We're working on a new variant of JSONPath that we're hoping to publish as a formal, comprehensive specification. It's essentially a superset of JSONPath with some syntax warts fixed (like the need to start with $). I wrote a little about it on HN a week ago [1].
I wonder what the new thing to replace enterprise JSON will be.
Major differences that I can see are we enable multiple functions to be sent per state, and that the output data from any state is referenceable by any other state, not just passing it down in turn through the states.
We support fallback states but in a different way, and don't support the retry concept directly within the state language itself, has to be built as a set of states to perform a loop to attempt a retry.
We don't support parallel stages, but do support branches, and remerging of those branches.
Probably the final difference I can see, is one of our options when running a function allows you to actually append additional states to the machine during the runtime process.
133 byte interpreter in JavaScript. Input is JSON specifying state name, write, move direction, and next state. Turing machines, basically.
Mine was for fun, but why is Amazon doing this?
Step Functions give you this external context for doing retry, conditional trigger of downstream functions, parallel trigger of additional functions and more. Execution time of a state machine can last for up to a year, so this also gives you a way to do more than 5 minutes of work at a time.
But is there no existing language that can be used to describe state machines?
They needed a syntax that was easy to transform into usage of other Amazon resources. I'm guessing JSON was by far the most straightforward for them, not to mention that they've been using the system themselves for quite a while. But I'm just guessing.
The only thing new or interesting about States is it has a product behind it that implements it at scale, available now; give it a try.
I think it's quite likely that this syntax is state-machine assembler, and smart people will find nicer expressions of this and compile them down.
In particular, some people prefer dependency graphs to explicit state machines for this sort of thing.
Oh no.
So, now that it is happening to me, am I allowed to apologize to the numerous old-coders that tried to tell me this when I was coming up?
If they're a little undisciplined, they'll probably add stuff to implement counting and comparison directly, to put a hard limit on loops.
I'd also guess an addition of a couple special tasks, perhaps append to log in s3 bucket and continue, that perhaps come with a discount.
There are about 3 million old flowchart tools out there, any feature you see tacked on is a candidate.
Tangentially, other organizations will be inspired by this, and implement their own language in json, but this time they'll do it "the right way" then you'll get a working group to try to reconcile all the competing standards.
Or maybe not. kind of what happened with XML though.
edit
ah, here you go. https://www.w3.org/TR/scxml/ that stuff.
It would be fun to implement Zork with this system.
He also mentioned that because it was a formally specified syntax, you could, should you choose to, build other more convenient syntaxes that reduce to it. It won't surprise me to see that happen fairly quickly.
You want to talk weirdly over-engineered, check out SWF
What does breaking it up like that give you?
(Full disclosure: I work at Bazaarvoice, and my colleague does, too!)
The Step Functions UI on the other hand is really rather intuitive.
They really need to improve the SWF UI
https://github.com/swift-nav/wolf
Excited about the potential of using lambda functions with SWF - we have workflows with predominantly idle workers that would greatly benefit from it!
Why: "oh no"?
I vote for "263D first quarter moon" and "263E last quarter moon", which cannot be displayed here.
https://en.wikibooks.org/wiki/Unicode/List_of_useful_symbols...
Maybe this is supposed to be pre-alpha?
Consistent with the Tim Bray blog article saying the validator's "implementation is kind of gross."
But then again: stay out of trouble, avoid Amazon.