7) ElixirConf US 2018 – Architecting Flow in Elixir - From Leveraging Pipes to Designing Token APIs – René Föhring

ElixirConf US 2018 – Architecting Flow in Elixir - From Leveraging Pipes to Designing Token APIs – René Föhring (@rrrene)

This talk is about ‘architecting flow’, which basically means ‘organizing and structuring what is done when, where and by which actor’ during the execution of our programs.

Making this top-level flow of data and responsibility obvious and comprehensible for the major parts of our applications is self-serving: When it’s easy to get the general flow of a program, it is easier to reason about changes, onboard new people into the team and communicate across teams.

In this talk, we’ll look at the spectrum of techniques to Architect Flow in Elixir. The audience will learn to reason about the trade-offs of each approach. We’ll look at the use of pipes and with macros in smaller programs. We’ll learn how to use the Token approach to create binding contracts between different parts of bigger programs. And we’ll discuss how to (and when NOT to) use metaprogramming to build custom DSLs for the most common use-cases in larger domains.

Audience: Intermediate, Advanced
Topics: #architecture

All talks are available in the ElixirConf US 2018 Talks List or via the #elixirconf2018 tag

5 Likes

@rrrene This was one of my favorite talks in the conference. It really helps me to organize my thoughts around basic dataflow and transformation in an application. Does the name “token” for the last pattern (used by Plug.Conn, Ecto.Changeset, Absinthe.Resolution) come from somewhere or is that a term that you devised yourself?

2 Likes

I’d love to know this too. I built a framework that uses the token pattern for messages and didn’t even know it was called that.

1 Like

I did not come up with the name in general.

Looking at workflow engines, BPMN specifically, the data structure which runs through a business process and gets enriched with information by the activities is called a “Token” (the name also reminded me how a Kerberos token is often used to transport information unrelated to authorization).

This “Token” we’re talking about is often called a “context” in the OOP space - there might be a RequestContext, an ExecutionContext, a SessionContext and so on. But we’re already using “context” for the bounded contexts we generate in Phoenix >= 1.3.

That’s why I decided “Token” was a good name to talk about this very relevant concept in Elixir :+1:

8 Likes

This was one of the talks I was able to attend live, and although I was able to tell René in person at one point during the conference, I want to reiterate that I really loved the pacing of this talk. I mean, I quite enjoyed the content as well, but the pacing is what stuck with me.

4 Likes

Totally agree with @ckhrysze. I was struck by the clarity and pacing of the talk. It put into words a lot of things I have been feeling about flow management and showed me areas for improvement. We will be discussing this one at the Seattle meetup bect week.

1 Like

Just echoing the above; the talk reified and ratified a few things for me - I’ve implented the pattern in an ad-hoc way in few apps I’ve built or worked on, and seeing it made more robust is extremely useful, thank you @rrrene

1 Like

Here is the speaker’s blog posts on this same topic. I found them very well-written and intriguing.