One of the huge benefits of working as a developer on a team is code review. You’ll commit changes for a project and then another developer will review them before pushing live. This helps avoid obvious mistakes and typos in the code- but it’s also one of the best ways to learn. Invariably your code can be better or more efficient, and having another developer look at your code will expose those gaps.
In the WordPress community, a lot of us are solo freelancers or the single developer at a small company. This might make it feel like it’s more difficult to get advice or a code review- but it’s really not. I’ve found several developers willing to trade time for code review, especially if we’re working on the same sort of problems.
Emil Ezuliac (a WordPress.org theme team lead) gave me the idea a few weeks ago. He knew I was working on a commercial theme, and had one of his own own almost ready, and suggested we trade reviews. It didn’t take long, probably 30-45 minutes. One of Emil’s suggestions led to this post about font loading, along with a slew of other good tips. The process was extremely helpful.
I also put out an open call on Twitter for other code reviews:
Any developers want to try out my latest theme and give feedback? http://t.co/zrrvl9JbZw Send me your email and I'll get you a copy.
— Devin Price (@devinsays) May 27, 2014
A number of developers took me up on the offer, including Sean Davis, Alex Patin, and John Blalock. Even though my theme was “finished” and already had one code review, they all found additional bugs and issues I hadn’t run into yet.
There’s many benefits to having a fellow developer find issues and bugs with your code (rather than customers or users):
- Developers can generally give clear steps to reproduce the issue.
- Developer may have encountered similar issues in their own code and can suggest fixes.
- Developers won’t be frustrated when they find a bug. It’s fun to open an issue that you don’t have to fix yourself.
- And come on, really, it’s the right thing to do.
It’s actually been quite fun to trade reviews with Sean Davis, as a number of other developers are also in the GitHub repo for his latest theme making suggestions. We’re discussing approaches on some of the issues that our rag-tag group of “reviewers” found. So, remember, even if it’s a private repo- that doesn’t mean you can get the same discussion and support that you would get with an open project.
Before you ask for an outside review- make sure you’ve done as much review yourself as possible. If you’re working on a theme, run it through the unit tests. Run it through theme check. Try it on different browsers at different widths. Check all your templates. Pull down data from other sites you run and view it. Set up the theme with a fresh database. Then you can be sure you’ll get the best use out of your code reviewer’s time.