Any developer knows: quality code is important. When it comes to developing on an open source platform like WordPress, quality is always a concern. Plugins and themes with bad code can wreak unintended havoc on WordPress sites. As the plugin repository continues to grow, so does the probability of installing a dangerous plugin. This age-old problem has prompted Tide. Originally referenced in Matt Mullenweg’s State of the Word 2017, the Tide Project aims to lift code quality across the WordPress ecosystem.
Tide is a service consisting of an API, Audit Server, and Sync Server, working in tandem to run a series of automated tests against the WordPress.org plugin and theme directories. PHP compatibility and test errors/warnings will be displayed for user reference in the directory. To learn more about Tide and how it will interact with the WordPress ecosystem, we sat down with Luke Carbis, Director of Product & Innovation at XWP.
Can you explain the motivation behind Tide and why it got started?
As we were thinking about XWP’s mission to Build a Better Web, we realized that one of our highest impact projects was our involvement in the WordPress Coding Standards project. This is because Coding Standards encourage developers to write more secure, more performant, more maintainable, less buggy code.
Unfortunately, when we looked into this further, we realized that there are some huge technical hurdles for developers to overcome before they’re able to integrate the WordPress Coding Standards into their projects and workflows. We wanted to make it much easier for even beginner developers to use the Coding Standards, which is why we created Tide.
We believe that if Tide can encourage and guide WordPress Developers to write better code, every WordPress site (and by extension, the entire web) will be better. That’s how Tide got its name: A rising tide lifts all boats.
How do you suggest developers implement code standards in their organizations?
Right now, it’s quite complicated. You’ll need to install PEAR and PHP CodeSniffer. Then install the rules for WordPress Coding Standards (by the way, remember to keep this up to date, which you’ll have to do manually with a git pull). Finally, setup PHP CodeSniffer with your particular IDE.
We’re working toward a future where there’s a one-step setup with Tide.
How can developers up their game to create better code?
- Learn the coding standards
Read through the Coding Standards on the WordPress Codex. Focus on identifying a few changes you could make to your existing habits. Revisit them occasionally to see if there’s something else you could improve.
- Peer code review
Ask peers and mentors to review the code you write. I used to work closely with Frankie Jarrett, who had a habit of always finding something that could be improved in every commit. Try to find opportunities to code review other developer’s code, too. Github has a fantastic code review feature, so make sure you’re using branches and pull requests (not just pushing code directly into your master branch).
- Revisit and refactor old code
Refactoring old code is a fantastic way to keep an old codebase fresh, while at the same time reinforcing all the new things you’ve learned since writing it.
Why is WordPress.org adopting Tide? When?
For Tide to have the highest impact, it has to reach the most amount of developers and be accepted by the WordPress development community. There’s no better way for that to happen then everyone pitching in on the open-source codebase to prepare Tide for WordPress.org. Our first step will be to integrate Tide’s PHP version compatibility data into plugin and theme pages, and we’re aiming to have this ready by June. You can follow along here: https://github.com/wptide/tide-issues/issues/1
How do you see Tide evolving? What do you think the future of this project will be?
In the long-term, I’d love to see Tide exist as a simple tool or extension for your code editor, which guides developers toward better coding standards as they tap out each line of code. It could also exist on WordPress.org with a user focus, helping WordPress users choose the most secure, performant, and reliable plugins and themes.
Interested in contributing to Tide? Check out the project site for Tide or get involved directly in conversations around Tide by joining the #tide channel on the Make WordPress slack. For more information about Tide and WordPress, check out this free, on-demand webinar: From Good To Great: Coding Standards and WordPress.