Automat State Machines with Glyph Lefkowitz – Episode 116

Summary

The venerable ‘if’ statement is a cornerstone of program flow and busines logic, but sometimes it can grow unwieldy and lead to unmaintainable software. One alternative that can result in cleaner and easier to understand code is a state machine. This week Glyph explains how Automat was created and how it has been used to upgrade portions of the Twisted project.

linode-banner-sponsor-largeDo you want to try out some of the tools and applications that you heard about on Podcast.__init__? Do you have a side project that you want to share with the world? Check out Linode at linode.com/podcastinit or use the code podcastinit2017 and get a $20 credit to try out their fast and reliable Linux virtual servers. They’ve got lightning fast networking and SSD servers with plenty of power and storage to run whatever you want to experiment on.


Preface

  • Hello and welcome to Podcast.__init__, the podcast about Python and the people who make it great.
  • I would like to thank everyone who supports us on Patreon. Your contributions help to make the show sustainable.
  • When you’re ready to launch your next project you’ll need somewhere to deploy it. Check out Linode at www.podastinit.com/linode and get a $20 credit to try out their fast and reliable Linux virtual servers for running your awesome app.
  • Visit the site to subscribe to the show, sign up for the newsletter, read the show notes, and get in touch.
  • To help other people find the show please leave a review on iTunes, or Google Play Music, tell your friends and co-workers, and share it on social media.
  • Your host as usual is Tobias Macey and today I’m interviewing Glyph about Automat, a library that provides self-service finite-state machines for the programmer on the go.

Interview

  • Introductions
  • How did you get introduced to Python?
  • What is a state machine and when might you want to use one?
  • There are a number of libraries available on PyPI that facilitate the creation of state machines. Why did you feel the need to build a new option and how does it differ from what was already available?
  • Why do you think developers fall into the trap of complicated conditional structures rather than reaching for a state machine?
  • For someone who wants to integrate Automat into their project how would they go about that and what are some of the gotchas that they should keep in mind?
  • What do the internals of Automat look like and how did you approach the overall design of the project?
  • What are some of the more difficult aspects of designing and implementing state machines properly?
  • What are some of the technical hurdles that you have been faced with in the process of building a library for implementing state machines?
  • What do you have planned for the future of Automat?
  • What are some of the most interesting use cases of Automat that you have seen?

Keep In Touch

Picks

Links

The intro and outro music is from Requiem for a Fish The Freak Fandango Orchestra / CC BY-SA