Rails Is Not Newcomer-friendly

4/22/2011 - Tim Elliott

Let's say I create a new rails application and I look at the generated file structure:

$ rails new foo
      create  README
      create  Rakefile
      create  config.ru

$ cd foo
$ find .

What an experienced rails dev sees:


What a newcomer sees:


When you are a newcomer, those 80 files and directories are intimidating! The README is a good start and it explains the directories, but tl;dr. A typical rails guide will now take the newcomer through creating a scaffold and database migration. But it is still too difficult to get to that magic point where you write a piece of code, and you get to see work.

All a beginner wants to do is put some code into an HTML file and see how Ruby on Rails works. Even with guidance, you currently have to navigate through too many obscure looking directories and files.

Let's make it as easy as possible for our newcomer devs to feel rewarded for installing Ruby on Rails. The true reward is when you get to write some original code and see it in your browser. In time, newcomers will learn to appreciate MVC, tests, and ActiveRecord, but for now all they want to do is write an HTML file and see the result in their browser:

    Hello world! My cat had <%= 2 + 2 %> legs before it picked a fight with that mean raccoon.

Perhaps we can add a new rails command, such as "easy" (note that this doesn't actually exist, I'm just fantasizing here):

$ rails easy foo
      creating foo/
      creating foo/README_FOR_BEGINNERS
      creating foo/app
      creating foo/app/views
      creating foo/app/views/application
      creating foo/app/views/application/index.html.erb
      Thank you for trying Ruby on Rails! Run "rails server" from within your project to launch a web server.

This looks a lot less intimidating. It's pretty obvious that there is a README file and there is a file that does something with HTML. This invites the newcomer to jump straight in and play. It would require that rails internally uses a default application/routes/etc. when everything is missing. But this should then work:

$ rails server
[2011-04-22 15:00:50] INFO  WEBrick 1.3.1
[2011-04-22 15:00:50] INFO  ruby 1.9.2 (2010-12-25) [x86_64-linux]
[2011-04-22 15:00:50] INFO  WEBrick::HTTPServer#start: pid=6299 port=3000

At a later date, perhaps the easy project can be upgraded to a full rails project:

$ rails level_up .
      create  README
      create  Rakefile
      create  config.ru
      exists  app

Let's make our newcomers happy, including those who don't want to read a guide or watch a video, and instead want to go straight to playing with their own code.