Rails Cookbook 59
honestpuck writes "When reading the foreword of Rails Cookbook I felt a strong kinship with Zed Shaw, I too have fond memories of the first edition of Perl Cookbook and the way I relied on it once I'd taken the training wheels off. Since that one I have relied on several of the O'Reilly Cookbook series. It is only when I discard the early tutorial and dive in the deep end with a "cookbook" on my desk that I really start to learn proficiency." Read the rest of honestpuck's review.
Rails Cookbook | |
author | Rob Orsini |
pages | 514 |
publisher | O'Reilly |
rating | 7 |
reviewer | honestpuck |
ISBN | 0596527314 |
summary | for programmers who know something about web development but are early in their use of Rails, |
I felt timorous and unsure when I finished Agile Web Development with Rails, a marvelous tutorial that introduced me to my first real web development framework (I must have enjoyed it, I just bought the second edition). Since I have volunteered to develop a fairly large and complex web application in Rails I awaited the arrival of my copy of Rails Cookbook with hopeful anticipation and bated breath.
Rob Orsini, his fellow contributors (15 in all) and the team at O'Reilly have once again delivered. Compared to the previous titles in the series I've owned Rails Cookbook seems to have fewer recipes but as it is tackling an entire application framework and some serious issues, some of the solutions and discussions run a lot longer. The book is targeted at programmers who know something about web development but are early in their use of Rails, though it should be helpful to all Rails developers.
The book starts with tackling issues of installation and getting development tools installed in the first two chapters. Despite already deploying a couple of simple Rails apps I found that there was the odd useful tip in these chapters. The book then covers each of the three main sections of Rails; Active Record, Action View and Action Controller. The rest of the book goes on with large chapters on testing, Javascript, debugging, performance and hosting and deployment. Along the way it also covers REST, Action Mailer, security, plug-ins and graphics.
The extremely large section on Active Record was to me the most useful. I seem to spend an inordinate percentage of my Rails coding time with Active Record and it contains a large part of Rails power so I appreciated the size of this chapter. By contrast the chapter on graphics is almost entirely unread.
It seems obvious that this book should be compared to Pragmatic's Rails Recipes. The first point of difference is that Rails Cookbook covers installation and setup. The second point is that is 'Recipes' covers Rails 1.1 while 'Cookbook' targets the brand new Rails 1.2. As a project fairly new on the scene Rails is a fast moving target so the six months between the two books makes a difference. Both books have excellent coverage of the various aspects of Rails, with a great deal of overlap. 'Recipes' has more, shorter pieces while 'Cookbook' tends towards longer pieces with more discussion. 'Cookbook' is also more general, with more recipes more likely to be useful in every Rails project you write.
The style is different between the two. Here Cookbook comes off second best, it feels as though tightly edited by a number of hands and ends up lacking personality; functional but cold compared to Recipes. The writing, however, is good. It's easily read, at times it feels like a good textbook. The layout is clean, it is easy to find the information you need from each recipe when you want.
With almost all "cookbook" style books I seem to be left feeling that a number of the recipes are just a little too obvious and covered well in beginner tutorials. There is some of this in Rails Cookbook, most notably the first two chapters, but overall the book will be useful to any beginner to intermediate Rails programmer. Personally I had a couple of moments where I read a tip and wanted to scream as it demonstrated and explained in a few short sentences and half a page of code what had taken me hours to discover for myself.
The "Cookbook" series all seem to be books worth the price and shelf space. This one is no exception. I'd give it three out of five with an extra half for its timely information on Rails 1.2 and would recommend it for all Rails programmers from the absolute beginner through to all but the most experienced. If you already have a copy of 'Recipes' and are happy with it then you might want to stick with that till either volume is updated for the next major revision of Rails, otherwise you will almost certainly appreciate a copy of Rails Cookbook.
You can purchase Rails Cookbook from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Re: (Score:2)
I have a co-worker who loves it and whenever I say something like, "I'm going to write a small program around a few syscalls and some low level bit twiddling in C" his response is always "Oh, you know Python can do that, right? And it'll be faster!"
It actually looks like a decent language, but he's turned me off to it (and it seems to grab a lot of the things I don't like from perl [disclaimer: I like perl] and very few of the ones that I do). I'll learn it sometime, but I
Re: (Score:2)
Re:Yes, but it's rails... ;) (Score:5, Funny)
Re: (Score:3, Interesting)
I don't want to become a professional, I'd just like to do know what to do when I have to write a script and make simple web apps. The only real programmers I know
Re: (Score:1)
Re: (Score:2)
I'm not about to recommend PERL or Java or SQL
C'mon, I was just about to recommend Java. It's a good language to start off with since there's a ton of information out there, it's a flexable language that you can use for tons of different use cases, and it's a good introduction to OO programming, which if you're starting from scratch, is the way I'd go. I would stay away from stuff like PERL and PHP since the former is just an explosion at the punctuation factory, and the latter could help instill bad practices from the get-go since it's so easy to h
Re: (Score:2)
Re:Yes, but it's rails... ;) (Score:5, Insightful)
Here's the bad part: there's virtually no decent introductory programming texts for python or most other languages. Most of them tacitly assume you know some other language and gloss over basic things like structuring a program with control flow, functional (de)composition, and proper use of objects, or they make a hash out of trying to introduce them. To that end, I'd really recommend Structure and Interpretation of Computer Programs (aka SICP) as a learning text, but dear lord is it tedious and didactic. It's also going to teach you an abstract way of thinking that doesn't really map to python's practical structures (i.e. you're never going to use tail recursion generally, let alone an amb operator).
I really love smalltalk for playing around with programming, not so much for the language itself (it's just okay) but for the way that you don't think about "compiling" or "modules" so much as you just have objects that you fiddle around with, and your changes just happen. Unfortunately, Squeak is such a poorly-documented disastrous hodgepodge that I can't recommend it to new programmers.
So it's kind of a desert out there for decent introductory texts, but a language with good community support and mostly helpful people will be a big boost, and python does stand out.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
If I install Python and the Win32all library and an IDE (maybe Boaconstrictor or one of those), there won't anything that runs using resources when I'm not actually working with Python, right? I mean, there won't be any libraries or little thingies running in the background that will take resourc
Re: (Score:2)
Boa Constructor is actually pretty awful. PyDev for Eclipse is decent -- yeah, it's a Java IDE, but it's a good plugin. Now THAT will eat resources when you run it. For a lighter alternative, you can always use emacs if you can get used to its weirdness, and it has a great python mode (never thought I'd call emacs slim).
Re:Yes, but it's Idle (Score:1)
An good intro to Idle follows:
http://hkn.eecs.berkeley.edu/~dyoo/python/idle_int ro/index.html [berkeley.edu]
Re: (Score:2)
http://msdn.microsoft.com/vstudio/express/ [microsoft.com]
http://www.monodevelop.com/ [monodevelop.com]
Visual C# 2005 Express Edition for Windows development, Visual Web Developer 2005 Express Edition for the web and MonoDevelop for Linux desktop apps.
Good luck, have fun and think in layers.
Re: (Score:2)
Re: (Score:1)
For Ruby, there's Chris Pine's Learn to Program [pine.fm] or Why the Lucky Stiff's Poignant Guide to Ruby [poignantguide.net] which is whimsical, but does pretty much the same thing, or just go to Try Ruby [hobix.com] and type help.
For Python there's Instant Hacking [hetland.org], or Use [uselesspython.com]
Re: (Score:2)
Re: (Score:1)
People don't make a big enough fuss about the interactive interpreter, partly because it's hard to describe why it's so useful. Try it out though, starting with diveintopython.org.
Re: (Score:2, Insightful)
Rails is awesome for developers (cause it's easy) but from a system and resource POV it's atrocious. And I thought I'd never find something that I disliked as much as PHP (due to security concerns, again, don't get me wrong, it has it's place).
--I
Re:Yes, but it's rails... ;) (Score:5, Funny)
Yeah (Score:2)
I agree that this is a fantastic book, as it shows you some incredibly slick stuff you can do using Rails. But unless you already have somewhat of an understanding of Ruby then I'd strongly recommend getting a separate reference book just for Ruby by itself. O'Reilly makes one of those, too.
Re:Yeah (Score:4, Funny)
No, no. That was Rails Recipes [slashdot.org]. Completely different. That's just a bunch of recipes. This is a cookbook! A COOKBOOK!
Re: (Score:3, Informative)
> reference book just for Ruby by itself.
The Ruby Way [amazon.com] is an excellent book for that, plus, the author, Hal Fulton, is a nice guy. And his RubyForge user account name [rubyforge.org] is "hal9000", for which he gets additional points.
You can get it for more at B&N (Score:5, Funny)
Havn't I seen this before? (Score:1)
Re: (Score:1)
http://books.slashdot.org/article.pl?sid=06/12/11
Re: (Score:2)
Only 999,999 doller, love you long time...
Or there's the Extreme Programming edition of the above for an extra ten bucks.
(wtf is extreme programming anyhow, hell I've been a coder for 7 years and I haven't met a single extreme programmer face to face)
Re: (Score:2)
Lifted from the Better Book... (Score:4, Informative)
And, while the book has a shiny "Rails 1.2" badge on the cover, very little of it had anything to do with Rails 1.2 whatsoever, there were only a handful of recipes in the very back which dealt with the new features.
Plus, was it really necessary to burn 3 pages talking about how to join a discussion group of fellow Rails developers? If you're a web developer and you can't find an online community to discuss the language/framework, you need more help than Rob's book is able to offer...
Re: (Score:1)
Jaredbpd,
I am sorry to disappoint you but nothing was lifted from Rails Recipes. I would like to find you a recipe that mixes join models and polymorphism in Rails Recipe. I wrote the last 2 recipes in that chapter and that code is taken straight out (in simplified form) from one of my applications. I actually wrote the join model and polymorphism one and then I was asked to write one just about polymorphism as introduction to the concepts. The editor thought that my recipe was a little too advanced.
You
Rails is Doomed (Score:1, Flamebait)
http://www.beust.com/weblog/archives/000382.html [beust.com]
Re:Rails is Doomed (Score:5, Informative)
Also, that blog post has a ton of errors. Here's one: If you want to write a Web application in Ruby, there is only one solution. Only one. Ruby on Rails. Hm, about about Camping [hobix.com] or Nitro [nitroproject.org]?
Rails scales perfectly well, just the same as any other share-nothing approach.
Ugh, so much FUD.
Re: (Score:1)
The author appears to *like* R&R. He/she is just being realistic about it going mainstream. I see no evidence he/she is out to bash R&R.
Whether he/she knew about the Rails alternatives or not does not diminish from the main point.
Re: (Score:2)
But no core UTF-8 support makes it useless to large numbers of people. The hacked support doesn't cut it. It needs to be supported right down in the core to make it fully stable and workable.
Bob
Re:Rails is Doomed (Score:5, Funny)
(defun fibonacci (nn)
"Return 2 consecutive Fibonacci numbers."
(declare (type (integer 0) nn))
(case nn
(0 (values 0 0)) (1 (values 1 0)) (2 (values 1 1)) (3 (values 2 1))
(t (multiple-value-bind (mm rr) (floor nn 2)
(declare (integer mm) (type (integer 0 1) rr))
(multiple-value-bind (f0 f1) (fibonacci mm)
(declare (type (integer 0) f0 f1))
(if (zerop rr)
(values (* f0 (+ (* f1 2) f0))
(+ (* f0 f0) (* f1 f1)))
(values (+ (* f0 f0) (sqr (+ f0 f1)))
(* f0 (+ (* f1 2) f0)))))))))
Re: (Score:1)
Everyone knows Haskell is the best language for writing a Fibonnaci generator.
Re: (Score:3, Funny)
Everyone knows Haskell is the best language for writing a Fibonnaci generator.
You really do just have to choose the best language based on the problem you are solving. After all, every language is good at one thing, and Fibanacci generators are Haskell's. :P
Re: (Score:3, Informative)
(defun fib (n)
"nth element of the Fibonacci sequence"
(check-type n (integer 0 *))
(if (< n 2) n
(+ (fib (1- n)) (fib (- n 2)))))
Lisp is a pretty good language. Its reasons for not catching on have more to do with its grassroots beginnings (no M$ Visual Lisp) and the fact that GC/automatic memory management
Re: (Score:2)
When it's the difference between lisp, which was marginally easier to develop with once you understood it, or cobol, which was easier to understand, but harder to develop with once you knew it, which do you think people would choose?
Cobol more than nine times out of ten...and with the increase in coders, there was an increase in available code. Pathways to solve common problems were made a
Re: (Score:2)
Re: (Score:3, Insightful)
Re: (Score:2)
I like Lisp and Paul Graham's essays almost had me won over, b
*yawn* (Score:1)
;;; Return (fib n) and (fib (+ n 1))
;;;
(define (two-fibs n)
(two-fibs-aux 0 1 n))
(define (two-fibs-aux m n i)
(if (zero? i)
(values m n)
(two-fibs-aux n (+ m n) (- i 1))))
Re: (Score:1)
To me the development tools for Rails is like a holy grail. Coming from
Re: (Score:1)
using Kiva, JRun, ATG Dynamo, Tomcat, Websphere, Spring Framework, JSEE. I have
also worked Perl+CGI, a smattering of cold fusion, plain old php,
drupal, cakephp (rails like php framework).
I am currently working on deploying a rails app.
So what is my take on Ruby/Rails?
Briefly here are the pros/cons as I see it:
pros:
1) Ruby feels good to program in. Like Perl,PHP, or LISP you can
layout data using the language itself. S
Oooh (Score:1)
but it is just about some programming thing
me sad
I was disappointed with this title (Score:2)
Speaking of which, though, the devoting of a good chunk of paper real estate to installation, seems to be space better left for meatier topics. Especially on a top