codereading / sinatra

Classy web-development dressed in a DSL (official / canonical repo)
http://www.sinatrarb.com/
MIT License
12 stars 2 forks source link

What do you want to achieve out of this one? #1

Open adamakhtar opened 12 years ago

adamakhtar commented 12 years ago

@codereading/readers After rack it seemed that various people wanted to achieve different things from the code reading sessions - which is great! As the group was fairly new it was a bit difficult to figure out exactly how to achieve the various goals or even how to conduct a code reading session.

One thing that seemed to take off at the end was the walk through that I and several others participated in. It didn't go way deep into the code but it did have a nice feel to it and also leaves a documented explanation, albeit small one, for anyone who ventures over here in the future. For me that's enough. But how about you? Perhaps you want to really dig into the details or take a different approach.

If that is the case then please feel free to state what your interested in here or by opening up an issue and try and find other interested members in the group. I think it would be great having multiple mini groups scouring over the same codebase.

adamakhtar commented 12 years ago

oh and ill go ahead and open an issue for the walkthrough

agis commented 12 years ago

How would you recommend me to start with Sinatra? I've never used it before.

adamakhtar commented 12 years ago

Ive only tinkered with sinatra a bit and that was a year ago, but compared to rails it was so easy to get something up on the screen. Try the hello world example in the [readme] https://github.com/codereading/sinatra (about 6 lines of code) and try a few of the other features listed. Probably enough for codereading purposes.

erich commented 12 years ago

there is a really good book about sinatra - http://shop.oreilly.com/product/0636920019664.do

ghost commented 12 years ago

erich the whole point of this walkthrough is walking through Sinatra's code not how to use Sinatra which is what the Sinatra book is for. thecode internal to sinatra itself. its own source code for how it does things.

ericgj commented 12 years ago

Some ideas for questions to motivate our reading -

  1. How does Sinatra compile routes and decide which route handles a request?
  2. What happens internally when you call halt?
  3. What happens when you call pass?
  4. What is the code path by which the route handlers, which you define at the class level (subclass of Sinatra::Base), get executed in the context of a request?
  5. What are various options for error handling?
  6. What middleware gets wrapped with a Sinatra app? Are there differences between the modular and classic styles in this regard? How do these compare to the default middleware in a Rails app?
  7. You can execute a classic Sinatra app as a ruby program, and it will automatically serve it up. How does this work? How does this compare to other ways of serving up your app using rackup, or via the web server?
  8. How does Sinatra use Tilt to render templates?
  9. How do "inline templates" work internally?
ptn commented 12 years ago

+1 for ericgj's point number 7. That particular bit of Sinatra amazes me.

hovsater commented 12 years ago

@ptn I agree. Point 7 and 5 is quite interesting.

adamakhtar commented 12 years ago

Nice ideas @ericgj

How about we start with number 7 everyone?

agis commented 12 years ago

+1

ericgj commented 12 years ago

Just opened a new issue for discussing this see #4

samnang commented 12 years ago

Pretty nice list of ideas @ericgj . I think it would be good to move this individual number into its own issue, so everyone could discuss whatever they are interested. What do you think? @codereading/readers

I would like to find out on 7 and 9. For number 9, I would like to see why Sinatra decides to choose class variable as a separator for inline template.

gwynforthewyn commented 12 years ago

For number 7, can you give me an example of a classic Sinatra app? I mean, a small code sample.

ericgj commented 12 years ago

@jamandbees, the one in the Walkthrough thread. You require 'sinatra' instead of require 'sinatra/base', and just put your routes down on the top-level object. As opposed to the 'modular' style. There's detailed explanation of the differences in the Intro documentation.

gwynforthewyn commented 12 years ago

I thought so.

If you require "sinatra", it loads "sinatra.rb" which in turn loads "sinatra/base" and "sinatra/main".

main looks like it processes any arguments first. I'm honestly not quite following where main then uses base to do anything; I feel like I'm missing something simple there.

ericgj commented 12 years ago

@jamandbees: see discussion in issue #4. Note class Application < Base in main.