Discourse as Your First Rails App

I have seen some twittering by @robconery that I would like to respond to here as opposed to on twitter.

https://twitter.com/robconery/status/321772134366056449

https://twitter.com/robconery/status/321772327266291712

https://twitter.com/robconery/status/321772408468013056


Getting started with Rails on Windows is hell, there, I said it. People often have this delusion that there is this magical Ruby installer you can install, it installs Ruby, you can use that develop Rails.

The reality is that Ruby, as used by most Rails apps is full of unixism, performance of Ruby MRI (the default Ruby) on Windows is abysmal, Rails load times are hellish, sooner or later (more likely sooner) you are going to hit gems that simply do not work properly on Windows.

So … if you are on Windows (Disclaimer: my primary Dev machine is Windows 8) and would like to play with Rails you are must install a Linux VM.

Getting a VM from 0, to ready to rock-and-roll with Rails is a tedious task. You need to install Ruby (preferably rbenv or rvm). You need to configure a database. You need to install a whole bunch of weird and wonderful packages you never knew you needed, like libreadline or libyaml.

The article presents a very simple way to get a bootstrapped VM ready for Rails and Discourse development. It takes care of a bunch of things for you that you probably never even knew you needed, including GC tuning.

You can use that VM to develop other Rails apps if you wish, its bootstrapped and ready to go. This series of tweets is merely criticising the title, the beef of the article is about giving a simple way for Windows users to get started with Discourse.

In response to some of the particular points:

Discourse is highly tuned for performance

Hell yeah, and we are playing nice with the community helping tune Rails with stuff we find.

I have personally built flame graph support for MiniProfiler, we are finding all sorts of wonderful things and making sure we share all this love with the community.

There is this complete misconception out there that Discourse does not use Active Record idiomatically, the reality is that the majority of Discourse is idiomatic Active Record and idiomatic well tested Rails with the odd performance exceptions. Sure, you can point your finger at a few exceptions, but look through all the code, not only at the exceptions.

Discourse uses pretty idiomatic Active Model Serializers for persistence, we made a few contributions to help turbo boost them.

Our test suite contains over 2000 tests. Our code base has been heavily scrutinized due to our high profile and heavily refactored since launch.


uses a heavy Single-Page App approach

Like it or hate it, Discourse is an Ember app, we work with @tomdale @wycats and team to make sure our Ember code is as idiomatic as possible. A lot of ground has shifted under our feet in the last year, keeping up with best practices can be hard. Nonetheless, we are not afraid of making big changes, like shifting our code from CoffeeScript to JavaScript or doing major refactoring so the code flows better. We are totally open to contributions from the community.

If you don’t want to touch the Ember bits and still want to hack on Discourse, there is plenty to do.


Which brings me to my final points:

The sentiment of the tweets, is move along, nothing to see here, if you are new to Rails avoid at all costs. I think that sentiment is completely wrong.

If you are a Windows dev and want to get started hacking on Discourse, this is the easiest way for you to get going.

  • It gives you a VM where you can hack on the Discourse CSS and get live reloads as you are hacking, allowing you to easily contribute style changes to us.

  • Plenty of areas of Discourse could do with help and don’t require extensive Rails knowledge, like building new oneboxes

  • If you are a JavaScript dev there is plenty to hack on that does not involve even looking at Rails code.

  • If you would like to get started with some Rails bits, you could look at amending models, controllers, or libraries.

  • As an added advantage, you will have a VM that you can use for hacking on many other Rails apps.

  • Its still early days, but we intent to have a very simple mechanism of building plugins, and this will be an excellent bootstrap for it.

  • See also: Discourse Development Contribution Guidelines


Yes, Discourse is huge, I would probably not learn how to program or how to build Rails apps just by reading Discourse source code. That was never the intention. There is plenty to learn from the code, there is plenty to hack on for a wide variety of backgrounds. Looking at our code is not going to make you a bad Ember or Rails developer. Reading lots on lots of different bits of code is the way you become a better developer.

And, as always this vagrant image is simply a service to the community. Make it easier for Windows developers to get started hacking on Discourse. As an added bonus they can use the image to hack on any Rails project.

12 Likes