Contributing to Discourse

Therapeutic Refactoring

Junior/Intermediate Ruby developers looking for an Open Source project to contribute to should consider practising clean coding techniques by refactoring the Discourse project.

Until around July this year, I had not contributed any code to an open source project. I have just ticked over three years as a professional developer and I have had the mandatory contribute to OSS on a to-do list for a while now. Until July this year I had submitted pull requests to a couple of projects that added to their documentation - I wanted to contribute code but despite the many posts out there on how-to-get-started-contributing-to-oss, I didn't have much success!

Then a couple of things happened:

  • I realised that I too find refactoring to be therapeutic
  • I met Discourse

To elaborate, Katrina Owen's (@kytrinyx) talk on Therapeutic Refactoring had a profound impact on me. A couple of days after watching it, I found in a state of almost post-meditative calm, staring at a pull request that cleaned up some complicated and unhappy code that I had written at work a few years ago. Code Climate showed me some nice shades of green, and I realised that I also find refactoring to be therapeutic!

Discourse is an Ember and Rails project and so uses the technologies that I had spent a lot of time with at work. Its core team includes Jeff Atwood (@codinghorror), Robin Ward (@eviltrout) and Sam Saffron(@samsaffron) of Stack Overflow fame, and its pitch is pretty far reaching!

I had met Sam Saffron at a Ruby meetup in Sydney and was inspired by his talk on his MiniProfiler project so when I first heard about (his involvement with) Discourse, I poked around a bit and ended up on - before long I found their post on how to contribute to Discourse.

I figured maybe I'd use Discourse as an opportunity to practise refactoring and reinforce the coding principles I had been reading about in Sandi Metz's book, and on the Code Climate blog, and submitted my first pull request.

Wondering how I knew where to start? By looking at the Code Climate report of Discourse and picking a smell. Setting up the project for development wasn't so hard thanks to excellent documentation. I used flog and flay locally to monitor the progress of my efforts until I discovered later that you can register your fork of Discourse with Code Climate. Once you have forked the project, try hitting and Code Climate will help you through the rest.

I found Sam and Robin's feedback to be excellent and encouraging and was reminded how important it is to find a project that is maintained by folks who communicate well!

By the end of the summer (I'm in the northern hemisphere at the moment), I had made several contributions to Discourse, learning a ton along the way. I even implemented a feature and helped a bit on their Rails4 upgrade. One of my better refactoring pull requests was used in an interview to demonstrate my journey towards writing better code (I got the job!).

If you are in a similar stage in your journey as a developer, I encourage you to spend some time (therapeutically) refactoring your open source project of choice. As you can see, Discourse is a good candidate! Also, a word of advice - stay with the principle of having fun and playing to your strengths. I found contributing to the Rails side of Discourse to have a much better yield than the Ember side.

Good luck!