This Week I Learned: 2023-11-12

  1. There’s a new spatie PHP package on the block – this one for making parallel processing in PHP simpler. Now I just need to find an excuse to try it out in one of my hobby projects…
  2. Disabling buttons to prevent double-clicks is bad for accessibility. Here Chris Ferdinandi argues for the more elegant solution of applying an attribute to the form element and checking it within the onsubmit logic, which also prevents users from firing duplicate submissions via keyboard actions.
  3. Here’s an interesting take from the Google Testing Blog about whether there’s such a thing as making your tests too DRY. “Since tests don’t have tests, it should be easy for humans to manually inspect them for correctness, even at the expense of greater code duplication”. Instead you could aim to make your tests DAMP (full of Descriptive And Meaningful Phrases).
  4. Despite what my first CTO told me back in 2007, COUNT(*) is not actually slower than COUNT(id), in mysql at least. In fact, it’s better to do it this way and let the query optimiser have free rein to choose the most efficient column to count on.
  5. A useful checklist of things to consider when adding a second server to your project. All of which will also make it easier to migrate your project from one server to another (say, if you want to change which cloud service you are hosting it on), a process I’m currently going through with one of my side projects.