Ruby training and singing with Sinatra

Hello, I am trying to improve my knowledge in ruby ​​by reading the book Ruby Programming Language . Reading Coders at Work I saw that many respondents offer to immerse themselves in the source code of the project

  • to learn the best practices.
  • to keep abreast of bad habits
  • and, of course, accept new ideas on how to do this.

I decided to choose the project as more independent, as I could find. My choice was Sinatra with It 1000 LOC.

Is this a good project to study? Do you offer another simple one (i.e. Less LOC)?

I tried to see the rails before, but I was scared of it.

+6
ruby sinatra
source share
3 answers

I’m not so much at Ruby (although I played a little with Sinatra), but I want to say that the Coders at Work advice should rather be read as “read the source code not only from one project, but from many”. We learn best by comparison. This is also how we can make out patterns and distract them.

So, perhaps you can choose a theme from Sinatra, see how it is implemented, and then compare it with how it is done in Rails.

The more sources you think, the better you understand a particular subject.

+2
source share

Reading Sinatra code is a good start. You might also want to read on Rack, the Sinatra HTTP interface. Not necessarily for coding practice, but just for understanding how Sinatra fits the entire stack.

Adding Ionuţ to the answer, Rails also uses Rack, so if you decide to look at Sinatra and Rails, you can compare how they use Rack.

+2
source share

Try entering gem list to display all the gems you set. Choose the one that belongs to your domain.

+2
source share

All Articles