I have been using Docker Compose for local development for years now. While I am comfortable writing or debugging a docker-compose.yml file, if I can avoid doing so, I will. Luckily, the WordPress open-source platform has a zero-config tool for Docker-based local development that is built on top of Docker Compose. If you run this […]
The new React documentation site is live and looks great. This section on creating custom hooks to encapsulate logic that needs to be used in multiple places in a React application is quite good. This is an important strategy to learn, and can help a lot when developing multiple blocks for a WordPress site. In […]
In this final chapter of part 1, I will walk through a refactor in order to review all of the concepts covered in earlier chapters. I will discuss how I decided where to draw the lines between concerns and show how that guided my decisions around refactoring. In addition, I show how to use integration […]
WordPress plugins used to use one big class, which was a singleton, and exposed instances of all of the plugin’s classes. This worked, but singletons have a lot of downsides. It was the best solution in PHP 5.2, which we used to have to support. In the previous section, I wrote about singletons and their […]
Singletons used to be very common in WordPress plugins. It used to be that singletons were the only way, besides global variables to have a globally available instance of a class in a WordPress plugin.
This section covers why Singletons are not great and when it’s not a big deal. It will cover some ways to refactor plugins so they don’t have singletons.