These are chat archives for dry-rb/chat

27th
Feb 2018
Jonah
@jonahx
Feb 27 2018 05:30
This article on state machines hiding in OO domain objects trending on HN now got me thinking about how you’d implement some of that example code using the dry-rb ecosystem….
Andy Holland
@AMHOL
Feb 27 2018 05:58
State is considered a curse-word around here :p
I'm not a fan of state machines personally, I haven't read the article but when I've used the pattern in the past it falls apart as soon as you want to make a batch operation
dry-rb libraries have a tenancy towards the(request) data being the state that gets transformed as it flows through your application
Andy Holland
@AMHOL
Feb 27 2018 06:03
Having said that, you could probably still use some of them as the basis for something like a state machine
Jonah
@jonahx
Feb 27 2018 06:21
@AMHOL I don’t think it’s a mutability issue, even if his implementation does use mutable objects. What I found interesting was the issue of how to divide up your code, and how some approaches can obsure what is really a state machine at bottom, and should be modeled as such. You can ofc implement that code using immutable data structures and transformations...
I see a connection to the same thing that dry-transaction achieves: making high-level logic transparent
Andy Holland
@AMHOL
Feb 27 2018 06:23
I'm not sure I get that, I'll have to read the article when I get a chance
Jonah
@jonahx
Feb 27 2018 06:24
you can skim past a lot of the code… fwiw
Andy Holland
@AMHOL
Feb 27 2018 06:29
:+1: