views:

148

answers:

5
+1  Q: 

Rails and beyond

I feel like I'm an intermediate-advanced Rails programmer. I've written some small client apps. However, I feel like I'm missing something. I don't really understand HTTP; what a web server is; how networking works; what Mongrel is beyond just "script/server". Are there any good books to explain what HTTP is and other stuff I'm missing out on?

A: 

Maybe this could help a little:

http://railstutor.org/projects/rails-tutor/wiki/Courseware%5FOutline

(disclaimer: it's a perpetual work in progress)

Carlo Pecchia
+2  A: 

Probably the closest book I have read to what you are looking for is HTTP, The Definitive Guide by David Gourley. It is older, so it doesn't go into Reverse Proxies in much depth, but covers most of the other stuff you need to understand.

One book I reccomend Rails developers read is RESTful Web Services, by Leonard Richardson and Sam Ruby. It has a lot of examples, many in Ruby, of how the web works, mixed in with a lot of XML. The forward by DHH sort of hints that this kind of thinking underlies many of the design principles at work.

Another book I recommend to get a deeper understanding of Rails from the software architecture perspective is Patterns of Enterprise Application Architecture by Martin Fowler. It has the logic behind many of the concepts that appear in Rails, such as ActiveRecord, SingleTableInheritance, ApplicationController, etc.

Finally, I have to mention Release It by Michael Nygard. It gives a good introduction into the concerns of building larger web sites, avoiding interdependencies, using load balancers, etc.

MattMcKnight
A: 

From The book Apprenticeship Patterns

Dig Deeper Recipe.

Action

Find and read RFC 2616, which describes HTTP1.1, and RFC 707, which describes the state of the art in Remote Procedure Call technology as of January 1976. Armed with your deeper knowledge of HTTP, try to implement a client and a server for RFC 707. When you feel you have a good understanding of the trade-offs made by the editors of RFC 707, examine a modern open source implementation of the same ideas, such as the Apache Thrift framework that powers Facebook. Then, from your informed vantage point, write a blog post describing the evolution of our knowledge regarding remote procedure calls and distributed systems over the last three decades.

Now, go and read Steve Vinoski’s articles about RPC. Do you now have doubts about the depth of your understanding? Write a blog post about your doubts and your current level of understanding.

This is going to give you a deep understanding of the problems of http has been facing the last three decades, and why http is the way it is.

You can also start building application and utilities over Rack, you will find all the things that rails is hidden to you.

A friend of mine asked my how he can learn rails, and I proposed him to build toy application in this order

Sinatra -> Rack -> Rails

Pedro
A: 

Thanks for all the responses!

I'll definitely check out HTTP The Definitive Guide, RESTful Web Services, Enterprise Application Architecture, and Release It!

But what about books for learning about web servers/other networking related concepts...things like Apache, CGI vs FastCGI, what Passenger is, etc. etc.

Rebecca Morgan
A: 

HTTP is mostly about sending HTTP requests and getting back HTTP responses. You might find unpicking the following piece of code a useful starting point:

require 'net/http'
require 'uri'

response = Net::HTTP.get_response(URI.parse("http://bit.ly/1vS07N"))

#response is a HTTP response
puts response.inspect

case response
 when Net::HTTPRedirection then puts response['location']
else
 puts 'no redirection'
end
  • Try substituting different URLs and see what you get back.
  • Try digging through the contents of the response object

If you want to see a real HTTP conversation going on, try using a tool called "wireshark" ( http://www.wireshark.org/ ) - it can capture all the packets leaving and arriving on your machine and then reassembling the HTTP conversation - even at different levels.

You can use wireshark to see pretty much any networked conversation between apps.

cartoonfox