Sinatra versus Rails
Why do we start with Sinatra, and not Ruby on Rails? How do the two compare?
You could compare Sinatra to a bicycle, and Rails to a car. Both do the job of getting you from A to B.
Sinatra is much more lightweight, needs less resources, and does fewer things out of the box. Rails on the other hand is packed with features, comes with a ton of code, and makes it very easy to build complicated web applications in limited time, if you know how to use it.
With Rails every little piece of code in your application has a precisely defined place. So when you look at any other Rails application you know exactly what’s were, and you can get started immediately. Sinatra on the other hand defines almost nothing for you. People come up with their own structures, and different Sinatra applications can look very different.
Of course, because it’s lightweight, Sinatra also is much faster than Rails, and this is where our little metaphor ends fairly quickly :) Rack, by the way, would be a pair of shoes. Sinatra and Rails both use Rack under the hood.
So which one is better for a beginner?
Both are great :) Sinatra is great for learning the basics of HTTP and routing. Rails on the other hand is better for learning how to use a database and actually store things, and learning the concept of a “resource”.
Also, next to Sinatra and Rails there are, of course, lots of other frameworks for building web applications. For example, Hanami has gained popularity quite quickly recently.