This Week I Learned: 2021-11-07

  1. How enums are going to work in PHP 8.1, thanks to Laravel News. In some ways they will be less useful than defining class constants to identify your possible states (e.g. you can’t compare an enum to an integer directly, so you’ll need to do a tiny bit more to get the value of the enum). In other ways they have lots to offer (e.g. the ability to add methods, something I did occasionally back in my Java days). The main thing I love about enums is the strong typing that they offer, removing the need to keep checking whether a value that’s been passed is actually one of the “approved” values for order status or what-have-you.
  2. 16 different ways of building hamburger buttons with sub-optimal accessibility. The main moral of the story is: if you’re making a button, use a <button>.
  3. Spring means the start of daylight saving here in NZ. I found this summary of the last 120 years of time zone changes interesting – turns out nothing mucks with time quite like a World War.
  4. The Opquast Web Quality Assurance checklist is a set of over 200 benchmarks for creating an easy-to-use website – everything from favicons to I18n to explicit embargoes on evil ecommerce practices like sneaking extra items into the cart or signing unwitting users up for your spamletter . I particularly like rule #94 (“The homepage explains the nature of the content and services offered”) – astonishing how often this isn’t the case in the real world!
  5. I’ve always preferred to use my IDE in light mode. Partly because I have shitty eyesight, but let’s be honest, also because this polarising issue is second only to the tabs v spaces debate and I tend to pick the side with the least obnoxious evangelists. Deep down I wondered whether the mainstream preference for dark mode was more about showing you were a “real dev” by changing as many of your IDE settings as possible (or using vim), or a hipsterish nostalgia for the days of yore when dark mode was all there was. Imagine how delighted I was to stumble across a scientifical explanation of why light mode is better!