The Importance of Code Review

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.

code-review

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:

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.

By the way, my latest theme “Summit” is now available on DevPress and has been thoroughly reviewed. I think you’ll like it.

About Devin

I am a developer based in Austin, Texas. I run a little theme shop called DevPress and help manage a WooCommerce shop with Universal Yums. Find me on twitter @devinsays.

2 Responses

  1. Tell me about it, man. I’m absolutely loving the collaboration. I’ve gotten help here and there from good people like Norcross but this is the first time I’ve hit the streets and asked anyone who was willing to lay eyes on my code to do a review. I was inspired by your tweet up there and I’m definitely glad I followed suit. I’ll be doing this exact thing from now on and I suggest every one else do the same if they don’t have a team available to them.

    Side note: What I learned in the last 24 hours from you and a few other guys is going to make about 6 or 7 of my other existing projects better. That’s something to write home about!

  2. Emil Uzelac

    Glad to trade and it was a wonderful experience too.
    We’ll definitely do this again soon, got one almost finished up!

Leave a Reply