Why you shouldn’t learn rails (the case for Sinatra)
Here’s a (non-exhaustive, non-scientific) list of the things you (as a programmer) get from Rails:
- custom routing
- an ORM
- asset packaging
- the ability to manage multiple environments
- custom generators
Do you know what all these items are and why you need them? I didn’t think so.
If you get started with Rails you will have a working database-backed website within a couple of hours. You will also have absolutely no clue how it works. You’ll be terrified to change anything lest you break the entire thing. Rails is a wonderful framework, but only if you need it- if you are learning to program I can guarantee that you don’t need it.
My advice- learn Sinatra instead.
Sinatra is a web framework for ruby and uses many of the same conventions as Rails. Only it’s much, much simpler. Here’s an example to illustrate the difference:
A program that prints “Hello World” to the screen is the first step to learning a new language. To do this in Rails you will need a whopping 51 files. Compare that to only 1 file in a Sinatra app. Which project do you have a better chance of understanding fully?
The biggest mistake I’ve seen from people learning to program is trying to do too much at once. People think that because they can do something means they should. Frameworks like Rails allow you to get really far without really knowing what you’re doing. You will have much better results if you concentrate on making something you actually understand.
So learn Sinatra. Make a small website that you understand. Keep adding to it. You will find yourself doing a lot of repetitive tasks- you’ll wish you could automate them. Eventually you’ll look at Rails again. This time you’ll discover that it solves most of the growing pains you’ve been having with your Sinatra app. Along the way you’ll have gained a deep understanding of how websites work.
There’s no shortcut to becoming a programmer. Save yourself some pain and start with Sinatra.