Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
adamakhtar opened this issue May 31, 2012 · 16 comments
Open

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

adamakhtar opened this issue May 31, 2012 · 16 comments

Comments

@adamakhtar
Copy link
Member

@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
Copy link
Member Author

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

@agis
Copy link

agis commented May 31, 2012

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

@adamakhtar
Copy link
Member Author

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
Copy link

erich commented Jun 1, 2012

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

@ghost
Copy link

ghost commented Jun 1, 2012

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
Copy link
Member

ericgj commented Jun 1, 2012

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
Copy link

ptn commented Jun 2, 2012

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

@hovsater
Copy link

hovsater commented Jun 4, 2012

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

@adamakhtar
Copy link
Member Author

Nice ideas @ericgj

How about we start with number 7 everyone?

@agis
Copy link

agis commented Jun 4, 2012

+1

@ericgj
Copy link
Member

ericgj commented Jun 4, 2012

Just opened a new issue for discussing this see #4

@samnang
Copy link
Member

samnang commented Jun 5, 2012

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
Copy link

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

@ericgj
Copy link
Member

ericgj commented Jun 13, 2012

@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
Copy link

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
Copy link
Member

ericgj commented Jun 13, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants