Clojurians
#architecture
<
2018-02-22
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

manderson19:02:21

@drewverlee I'm a bit late to the conversation here, but what you described above sounds similar to an event driven FSM I wrote a while back. We used it in one of our applications for a time that had a complex business logic workflow and the FSM abstraction made it easier to comprehend/represent. We ended up scrapping that part of the application for other reasons, but the code remains in one of our OSS projects: https://github.com/LiaisonTechnologies/proletariat/blob/master/src/proletariat/fsm.clj. It has a good bit of documentation. Might at least generate some ideas...

drewverlee21:02:51

@manderson very interesting i’ll take a look. The description seems close to what i imagine. I’m curious why i dont see things modeled this way more often. I want a more declarative way to model the possible states an application can be in.

manderson22:02:56

Yep, that's what lead me to that approach and it actually made for really easy to visualize code (and made me wonder if I was missing something because it isn't more prevalent). One problem is that it's hard to test if your events have side effects (eg: calls to a DB), so I added a multi-mock namespace in the same repo above for mocking multi-methods. It's not ideal but served its purpose.

ivan.kanak_clojurians22:02:58

luna-lang is all around that concept