mudasobwa

mudasobwa

Creator of Cure

Elixir Blog Post: Finitomata :: The Proper FSM for Elixir

Blogged about the motivation and reasoning behind my idea to create yet another FSM library. Long story short: I did it in a proper way :slight_smile:

Finitomata :: The Proper FSM for Elixir

Most Liked

ityonemo

ityonemo

I wrote this library which seems similar:

https://hexdocs.pm/state_server/StateServer.html

mudasobwa

mudasobwa

Creator of Cure

Ouch, indeed. Great one! I googled and grepped hex.pm but somehow failed to nail it down. Two independent solutions so similar is a hint it’s a proper approach.

There is one significant difference, though. The definition made of PlantUML allows a no-cost visualization, after I’ve done Make embedded FSM description visible in VSCode · Issue #2 · am-kantox/finitomata · GitHub, the diagram would be transparently visible in VSCode, and the mix task to generate the diagram will also be available soon.

Also, by hiding all the OTP stuff under the hood and exposing callbacks only, I hope I made it more beginners-friendly.

KristerV

KristerV

very interesting. the example at the end could be a bit more ‘real world’ as i’ve only heard about FSM used in games. What do you use it for?

I wanted something, that is error-prone and easy to grasp.

You probably wanted to say “not error-prone”?

mudasobwa

mudasobwa

Creator of Cure

The real-world example would have not fit the page :slight_smile:

We in Fintech use FSMs for literally everything. Consider a long-lived “transaction” when the client puts an order and saves it, in ten days comes and tries to execute it. We are to contact a bank, receive a response and either trade or contact client for why it could not be traded etc. It’s like eventlog, but for the state of the object. We must prevent the client from the attempt to execute incomplete order, or to re-execute the order rejected by bank without introducing any changes, or like. One FSM obsoletes dozens of if conditional statements.

Of course, thanks, fixed.

derek-zhou

derek-zhou

I follow your blog already; the contents are always superb. May I suggest you to add the tags in your feed? You already have a nice tagging system; it’s a shame that this tagging system is not exposed through your feed. Since you are using Atom, the standard format shall be:

<category term="elixir" />
...

Where Next?

Popular in Blog Posts Top

jordiee
https://medium.com/@jpiepkow/distributed-state-is-hard-5a0d384c2f3c
New
axelson
I describe how we use Hot Reloading with Webpack to develop faster and show how to integrate Webpack 5, webpack-dev-server, and Phoenix f...
New
brainlid
You are storing some Phoenix LiveView state in the browser. You want to retrieve that saved state as early as possible to improve the use...
New
bencoppock
I write about the frustration that can occur when dealing with string and atom-based keys in maps and how to (safely) translate string-ba...
New
New
brainlid
Elixir has a built-in Zip library that comes with OTP. This post explores how to use the zip module and asks the important question: “Is ...
New
bemesa21
Sorting and deleting many-to-many associations made easy with Ecto’s :sort_param and :delete_param options from cast_assoc, powered by Li...
New
Paradox
Testing is an important part of any modern piece of software. But writing tests can quickly become an exercise in frustration, with tons ...
New
PragTob
I ran into an interesting problem recently where simple concurrency on the BEAM via Task.async made my application a lot slower and a lot...
New
gaggle
This post explores different ways to do test automation in Elixir, focusing on how to handle dependency injection — covering patterns, li...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
beno
I will often find my self writing things similar to: case some_value do nil -&gt; something() "" -&gt; something() _ -&gt; someth...
New

We're in Beta

About us Mission Statement