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 create README create Rakefile create config.ru ... ... ... $ cd foo $ find .
What an experienced rails dev sees:
What a newcomer sees:
./XEAnIr ./XEAnIr/TwwSIXTiIEA.KR ./XEAnIr/IAIiITSIysKf ./XEAnIr/IAIiITSIysKf/IAnSsXiIEAf.KR ./XEAnIr/IAIiITSIysKf/fsffIEA_fiEKs.KR ./XEAnIr/IAIiITSIysKf/fsXKsi_iEOsA.KR ./XEAnIr/IAIiITSIysKf/RTXOiKTXs_fISsAXsKf.KR ./XEAnIr/IAIiITSIysKf/cIcs_ikwsf.KR ./XEAnIr/uTiTRTfs.kcS ./XEAnIr/KEvisf.KR ./XEAnIr/sAUIKEAcsAif ./XEAnIr/sAUIKEAcsAif/usUsSEwcsAi.KR ./XEAnIr/sAUIKEAcsAif/isfi.KR ./XEAnIr/sAUIKEAcsAif/wKEuvXiIEA.KR ./XEAnIr/sAUIKEAcsAi.KR ./XEAnIr/REEi.KR ./XEAnIr/SEXTSsf ./XEAnIr/SEXTSsf/sA.kcS ./README ./icw ./icw/XTXHs ./icw/XTXHs/.rIiOssw ./uR ./uR/fssuf.KR ./SEr ./SEr/.rIiOssw ./uEX ./uEX/QWZltW_GPQ_ZMM ./dscnISs ./Tww ./Tww/cTISsKf ./Tww/cTISsKf/.rIiOssw ./Tww/cEusSf ./Tww/cEusSf/.rIiOssw ./Tww/Tffsif ./Tww/Tffsif/fikSsfHssif ./Tww/Tffsif/fikSsfHssif/TwwSIXTiIEA.Xff ./Tww/Tffsif/pTUTfXKIwif ./Tww/Tffsif/pTUTfXKIwif/TwwSIXTiIEA.pf ./Tww/Tffsif/IcTrsf ./Tww/Tffsif/IcTrsf/KTISf.wAr ./Tww/UIsVf ./Tww/UIsVf/STkEvif ./Tww/UIsVf/STkEvif/TwwSIXTiIEA.HicS.sKR ./Tww/XEAiKESSsKf ./Tww/XEAiKESSsKf/TwwSIXTiIEA_XEAiKESSsK.KR ./Tww/HsSwsKf ./Tww/HsSwsKf/TwwSIXTiIEA_HsSwsK.KR ./fXKIwi ./fXKIwi/KTISf ./.rIiIrAEKs ./XEAnIr.Kv ./SIR ./SIR/iTfOf ./SIR/iTfOf/.rIiOssw ./isfi ./isfi/nIhivKsf ./isfi/nIhivKsf/.rIiOssw ./isfi/IAisrKTiIEA ./isfi/IAisrKTiIEA/.rIiOssw ./isfi/wsKnEKcTAXs ./isfi/wsKnEKcTAXs/RKEVfIAr_isfi.KR ./isfi/nvAXiIEATS ./isfi/nvAXiIEATS/.rIiOssw ./isfi/vAIi ./isfi/vAIi/.rIiOssw ./isfi/isfi_HsSwsK.KR ./QTOsnISs ./UsAuEK ./UsAuEK/Tffsif ./UsAuEK/Tffsif/fikSsfHssif ./UsAuEK/Tffsif/fikSsfHssif/.rIiOssw ./UsAuEK/Tffsif/pTUTfXKIwif ./UsAuEK/Tffsif/pTUTfXKIwif/pJvsKk.pf ./UsAuEK/Tffsif/pTUTfXKIwif/pJvsKk_vpf.pf ./UsAuEK/wSvrIAf ./UsAuEK/wSvrIAf/.rIiOssw ./wvRSIX ./wvRSIX/KEREif.ihi ./wvRSIX/422.HicS ./wvRSIX/nTUIXEA.IXE ./wvRSIX/404.HicS ./wvRSIX/500.HicS ./wvRSIX/IAush.HicS
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:
<html> <body> Hello world! My cat had <%= 2 + 2 %> legs before it picked a fight with that mean raccoon. </body> </html>
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.