I started attending the Portland WordPress Meetup a few years ago as a way to make connections and improve my WordPress skills. However I quickly discovered simply attending meetings wasn’t helping my coding skills much. Then we had Lance Willett come and speak on breaking themes. The talk was excellent, and afterwards I made sure to introduce myself.
Lance was very gracious and offered me his contact information and told me to send him so code and he would be happy to review it.
I was excited!
I was terrified…
One of the most nerve wracking parts of joining a team or getting out there is having someone else review your code. Inviting comments on how I had chosen to structure and write something was not high on my list of priorities. But Lance offered, and I wanted to oblige.
Most of my work was not public at the time, so I didn’t have anything ready to go for the code review. Not long after, though, I was helping my wife out with a site of hers. She got frustrated that WordPress greeted her with “Howdy.”
“I’m not a cowgirl!” She said.
So I spent a day coding up a simple plugin to allow her to change it, and posted it to Github (this commit was the original completed code).
I was pretty proud of my little plugin, and decided it would be a perfect code sample to share with Lance. It was short enough to digest quickly, but meaty enough that there was some actual code to look at. So I sent it.
And I waited. And I second guessed myself. And I was sure that it was actually terrible.
Finally the reply came through, and I was completely relieved. I wasn’t told how terrible my code was. I wasn’t told that I should stop trying to code all together. The reply was largely positive. Lance pointed me to resources for things like sanitization and PHPDoc comments. He provided insight into how he would have approached the same bit of code and how to improve it.
I took his advice and updated my code after looking through all of the feedback. As a result my code became better. But more than just my silly plugin improved. Lance helped point me to many of the topics that I didn’t even know to explore. Every piece of PHP code I have written since has benefitted from his advice.
I never had the opportunity to thank Lance for his time (Thanks Lance, you are awesome!), but this code review has stayed with me in powerful ways. As I have started doing reviews for colleagues, friends, and acquaintances I strive to always be courteous, encouraging, and honest. Submitting code for review is scary, but completely worth it. It can be a mechanism for very accelerated learning, but the reviewer has to be a part of that.
So if you find yourself in a position to have your code reviewed, do it! It’s a fantastic process that will help you get better.
If you find yourself in the position to review the work of someone else, focus on being encouraging, and using the time to teach, train, and explain what you know. Point to outside resources that can be referenced well after the initial review is complete (I admit I’m not always the greatest at this part). You can have lasting impact on someone else’s work.
Have you had your code reviewed? Reviewed someone else’s work? Was it a good experience? A bad one?