EMx 075: Live View Implementation With Jeff Kreeftmeijer

00:00 34:19
Download MP3

Jeff Kreeftmeijer works at Appsignal where they create a tool for application monitoring that works in Ruby and Elixir. He works specifically with integrations focusing in Elixir and also writes articles for their Elixir and Ruby newsletters. Jeff started as a Ruby programmer but had an interest in functional programming which lead him to gain an interest in Elixir. When he started at Appsignal they were already considering an Elixir integration and that made it a perfect fit.

Jeff then shares more details about his involvement in Appsignal’s two newsletters called Ruby magic and Elixir alchemy, both of which are aimed at more experienced programmers. He also details his experience with articles that he wrote on Live Share and how he came to write them. The panelists also introduce the Go game that is written about in these articles.

The next topic covered by the Elixir experts is the Go game Live View implementation mentioned in Jeff’s articles. The panelists draw comparisons of how something similar could have been implemented in React. Jeff highlights that he doesn’t have to write JavaScript and doesn’t have to worry about state either. However, in part 1 of Jeff’s current implementation he used a struct to track the state. In part 2 of the implementation, where he implements the code rule, he has another struct that tracks the game.

The panelists then discuss how Jeff maintains the game state. In the first version of the implementation he keeps it in the Live View process and when he implemented multiplayer he had to move the game state to a GenServer. He also shares some of the details of why using a GenServer is necessary for multiplayer. Jeff is then asked what his experience was like using a dynamic supervisor and he shares the technical ideas of how this helped him in the project.

Next the conversation moves to how the game is able to communicate moves between players to each other. The issue with connecting two sessions to the same Live View is that one player won’t be updated if the other makes a move. Jeff details how using a Pub/Sub helps to overcome this issue. The panelists also discuss ideas of how the game could be implemented in a multi server instance.

Jeff shares how his article series still has many more installments that can come out, specifically citing that they haven’t even covered assigning player connections with different player callers. This kind of functionality would handle the assignment of which players controlled which pieces. Jeff closes with highlighting the convenience that comes from using the libraries that they are using as they natively come with technologies they find helpful for building out an interactive, collaborative project.

Lastly, the panelists discuss what Jeff is currently doing to work more with these same technologies. Jeff shares that he has a side project where he tries to build a fish tank with artificial intelligence and how he uses Live View for this project.

Panelists

  • Mark Ericksen
  • Eric Oestrich
  • Josh Adams
  • Michael Ries

Guest

  • Jeff Kreeftmeijer

Sponsors

Links

Picks

Josh Adams

Eric Oestrich

Michael Ries

Mark Ericksen

Jeff Kreeftmeijer

FAQ

What is Live View?

Live View is a library that leverages server rendered HTML.


What is a GenServer?

A GenServer is an Elixir process that can be used to keep state.


What is a Pub/Sub?

Pub/Sub is short for publish/subscribe and is a messaging pattern that publishes messages to a topic rather than sending them directly to receivers.


What is a Dynamic Superviser

A supervisor is a process that supervises other processes. A dynamic superviser starts with no children and they are created on demand.


Sign up for the Newsletter

Join our newsletter and get updates in your inbox. We won’t spam you and we respect your privacy.