WordPress Add-On Code Quality Needs to Improve ASAP and You Can Help
The baseline is low. Way too low. We need to change the way we share our knowledge with the new generations of WordPress developers.
WordPress attracts developers by allowing anyone to participate in the ecosystem by creating plugins and themes. There aren’t any systems in place that would assure that the quality of the add-on software meets any guidelines. This is both great, as it allows people with little experience in programming to create new solutions, but it’s also a curse for the community at the same time, as it allows lowest quality code to enter the system.
Don’t get me wrong, I love WordPress and I’ve been participating and working with WordPress-related software for the last 10 years or so now. I’ve seen it grow from a basic blogging platform to the fully-fledged, multi purpose CMS it currently is. I remember the times when it didn’t have custom post types yet, only posts and pages. And I’m currently working as a tech support agent for an exclusively WordPress-based company.
My job gives me a great opportunity to see the WordPress world from a perspective that many developers don’t usually have a chance to experience. As I spend 40 hours each week helping users diagnose and fix issues with their WordPress sites, it’s very hard not to notice the main culprit here.
WordPress is a very weird case. Usually, when you create software, you’re able to ensure to a certain degree that it will work correctly and will be able to withstand various kinds of difficulties. You can do TDD which, when done correctly, will give you a high level of confidence that your code is error-free. In WordPress, this is not enough to ensure your software will not have bugs.
I’ve had a chance to see how the quality of code in major WordPress plugins is improving over the last years as companies have invested additional resources to make sure the software they provide meets the highest possible standards. Some companies switched to TDD and have opened dedicated Quality Assurance departments. It’s not perfect yet, but the trend is clearly visible and should make anyone optimistic about the future of the platform in general.
There is, however, a downside to all that. Despite the best efforts we put into making our code run smoothly, in WordPress this will never be enough. It’s because our software will always run alongside of other people’s software. And even if you can guarantee the quality of your code, you can’t do the same for other people’s plugins.
As anyone who knows a bit of PHP and can read the documentation can create and distribute a plugin or theme, we can often see how dramatic impact this can have on people’s lives and businesses. Companies rely on WordPress as the main platform to share information and sell products. In some cases, the WordPress site is the business, so when it’s down or when it experiences issues, the business is down as well.
My tech support experience shows that users will install plugins on their business website without running any tests first. They seem to be trusting that every plugin they try will do the thing it says in the description, without any side effects. It doesn’t matter whether it’s a major, well known plugin or some tiny one used on 100 sites. It’s still too rare for me to see people considering to test the software that can make or break their livelihood, unfortunately. Users of WordPress aren’t thought about things like staging sites and manual testing. We don’t put enough focus on teaching WordPress users how to distinguish between good quality and bad quality software, how to look for and understand reviews.
The quality of the code in some plugins can be really bad. I wanted to say ‘astonishingly bad’, but I think this won’t be a surprise to anyone.
We have to do something to stop the onslaught of tutorial-based and StackOverflow-copy-paste-based development in the WordPress world.
It is unacceptable that there are people in our community who can influence other people’s livelihoods just because they followed a few PHP and WordPress tutorials and can google for code snippets.
This is something that the WordPress community has the power to change.
I believe that we should start by changing the way we share our knowledge. We need more tutorials that not only teach about functions and classes but also teach upcoming developers why and how to read other’s code and learn from it. How to understand what others wrote. How to take time to participate in the Open Source movement, get some first-hand experience with production-ready code before you write your own. We need to stop showing quantity of possibilities and start also showing the quality. We need to stop providing snippets without any context — as we do on Stack Overflow. The “just give me a solution that I can copy” approach will continue to break trust in WordPress and will only help to perpetuate the popular opinion that WordPress is an insecure platform.
It is up to the WordPress community whether we will teach the new generation of developers how to follow good practices like TDD, how to actually learn to code by reading code instead of following tutorials and how to know what good quality code looks like by showing them good quality code and using it as the basis to dissect and teach. Isn’t that one of the basic ideas of the Open Source movement that WordPress proudly is taking part in, that we can read other people’s code?
I’m throwing a challenge here to everyone who is writing educational articles and stories for WordPress developers to start including above mentioned elements, for the good of the community.
Some additional inspirational resources on the subject I suggest to check out as well: