3 years ago 4,761 views
Presented by Andy Snell
April 3, 2020
PHP may not have a native data type for an Enumerated Type like other programming languages, but there are other solutions we can leverage to represent a member of a set of values. We’ll see how representing things like statuses with enums provides immutability, improved readability, and type safety — preventing the kind of errors that happen with “magic strings” and class constants. In this session, we’ll be making our own immutable enums from scratch in order to explore the concept, but we’ll also introduce some open source libraries for use in your production code. We’ll also demystify the imposing-sounding “finite state machine” by using using immutable enum objects to regulate the transitions between member elements.
Andy Snell has been a self-taught computer nerd since his junior year of high school when first introduced to Gentoo Linux. He picked up programming from “PHP 6 and MySQL 5 for Dynamic Web Sites“, and since then, he has worked on building PHP applications in the electronic payments and telecom industries. He has a passion for simple and elegant solutions for difficult problems. When not debugging his code, he enjoys Magic the Gathering, travel, and recreational mathematics.