codereading / sinatra

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

Searching for the entry-point #11

Open agis opened 12 years ago

agis commented 12 years ago

As I'm new to Sinatra (and ruby generally) I'm searching for an entry point to start reading through the source, something like we did with the Rack project (we started reading run and use first).

The other issues that are opened till now seems a little advanced to me, so I'm wondering if there's a simpler way to start.

EDIT: As I see 95% of Sinatra is mainly in sinatra/lib/base.rb.

I've also noted that this file is kinda large (~1600 loc).. so I was wondering: Why didn't they broke up the code into smaller pieces (eg. separate files)? Wouldn't it make the code easier to maintain?

Isn't Sinatra considered to be a "monolithic" app, which is not a good thing?

@codereading/readers

ericgj commented 12 years ago

One place to start might be to look at what happens when you define a route, e.g. get '/foo' do ... end .

Or another place would be to follow the path of a request as it comes in and gets dispatched to a route.

It's a good question about why the code is all in one file, I'd like to know myself.

gwynforthewyn commented 12 years ago

Sinatra isn't monolithic. Reading through base.rb: it uses one file, but inside that file is a bunch of Modules and within the Modules there're a bunch of classes. Physically, sure, it's one big file. But logically it's a bunch of separate namespaces and whatnot.

I'm going through issue 2 as best I can: seeing what happens when the simple.rb example is executed. If you'd like, I'd love a few more pairs of eyes over there.