codereading / rack

a modular Ruby webserver interface
http://rack.rubyforge.org/
Other
18 stars 2 forks source link

Blog post on Rack code reading #11

Open agis opened 12 years ago

agis commented 12 years ago

Fellow code readers, I've started a blog some days ago and I've decided it would be a good place to sum up what I've learned from our code reading session on Rack.

I haven't shared it yet, I wanted first to share it with fellow @codereading/readers so I can get opinions/corrections/general feedback etc.

I've also put a credits section in the beggining since some of the sentences are actually taken from our Issues tracker.

http://agis.heroku.com/blog/2012/05/31/hands-on-rack/

samnang commented 12 years ago

Well done, I think it's a very good wrap up of the topic. One thing I notice of your code snippet to explain how Rack package and run Middlewares which use Class object(Middleware) instead of using objects that were instantiated. Here what I think it should be:

yo_middleware = YoMiddleware.new(OurApp) # iteration 1
another_middleware = AnotherMiddleware.new(yo_middleware) # iteration 2
cool_middleware = CoolMiddleware.new(another_middleware) # iteration 3
agis commented 12 years ago

Right. Fixed that. I wonder what @skade thinks about this. I think he's in EuRuKo atm.

skade commented 12 years ago

One minor nitpick about the first code sample:

{"Content-Type" => "text/plain"}

Content-Length is a mandatory header on fixed-length responses. If you use the Rack::Lint middleware, it will fail.

Otherwise, good post!

adamakhtar commented 11 years ago

hi @Agis , Sorry but ive only just discovered this post of yours but great work! Thanks for the write up and hope the code reading projects continue to help you!