Effective state machines for complex logic by David Khourshid (Effect Days 2024)

preview_player
Показать описание

Effect is an ecosystem of tools to build better applications and libraries in TypeScript.

______________________________________

David Khourshid discusses the use of state machines and the Effect library for handling complex logic in applications. He explains how state machines help make edge cases and use cases explicit and how the Effect library can be used for declaratively representing effects in state machines.

Highlights:

→ The benefits of using state machines for handling complex workflows; different types of effects in state machines, including actions and actors.
→ The importance of declarative representation and how it can be converted into diagrams.
→ The actor model and its role in state machines.

_____________________________________

Learn more about and follow David:

_____________________________________

#Effect #TypeScript #XState #StateMachines #EffectDays #EffectDays2024
Рекомендации по теме
Комментарии
Автор

95% of this video is about XState and the only time the Effect is used, it is when wrapping one-line code in Effect.sync and immediately running it with Effect.runSync, which is no better than just running the same code directly .

I'd wish for a better example that shows where Effect shines. For example a basic error handling and how we can then branch out to a specific error state in XState.

lordraven
Автор

This video is really explaining in a nutshell what a state machine and the actor model are. It is not very clear how Effect could be used in the context of XState and what it would change to the dev experience.

It looks like Sandro Maglione is the person to look up for answers.

ApprendreSansNecessite
Автор

I've used this library before and it just kills productivity as it is full of gotchas and pitfalls (not to mention the boilerplate). Worth learning the idea of state machines but really, sum types (or discriminated unions if you prefer) are a more practical way of making illegal states unrepresentable. All the other bells and whistles xstate gives you over and above sum types have a very poor cost/benefit ratio.

m