Book Question on RoR

Hi there,

I am a newbie and interested in learning Ruby on Rails. I see there are
2 books out there:

Ruby for Rails
Ruby techniques for Rails developers
David A. Black

and

Agile Web D. with Rails : A Pragmatic Guide (Pragmatic
Programmers)
Dave T., David Heinemeier H., Andreas S., and Thomas F.

Which one should I get? “Agile Web D. with Rails” also
supposed to have a second edition coming out in September. I appreciate
any feedbacks from those who have read these books. Thanks.

Dobb

Hi Dobb,
I think both books are great, but as you know, the second book is all
about rails, while the first is much more about the ruby behind rails.
If you have the money, buy them both and wait for the 2nd edition of
the second, buy it either, the two editions diffs a lot, although the
basics
still the same, but much more up to date, as the rapid grows of rails,
you would surely want to know how the other cool kid play;-)
If money is an issue as the same to me, I sure will wait for the new
edition
comes out.
Wish this helps.
Dobb Lou wrote:

Hi there,

I am a newbie and interested in learning Ruby on Rails. I see there are
2 books out there:

Ruby for Rails
Ruby techniques for Rails developers
David A. Black

and

Agile Web D. with Rails : A Pragmatic Guide (Pragmatic
Programmers)
Dave T., David Heinemeier H., Andreas S., and Thomas F.

Which one should I get? “Agile Web D. with Rails” also
supposed to have a second edition coming out in September. I appreciate
any feedbacks from those who have read these books. Thanks.

Dobb

Jeffrey H. wrote:

I’ll put in my vote for David Black’s Ruby for Rails. While you
should probably invest in both, starting with Ruby for Rails might
reduce some of the smoke and mirrors you’re likely to find when
diving into Rails for the first time. If you have a beginning
knowledge of Ruby before you dig in, you’ll probably find the Agile
book a better read.

When you do buy Agile Web D. with Rails I recommend you get the
Second Edition. The Beta eBook is available as PDF and as long as I have
the Foxit Reader handy, it is a fine way to read that book. I have both
editions of Agile and I would be lost right now without the second
edition.

It looks like I need to grab a copy of Ruby for Rails. I have the latest
edition of the Pick Axe book but I need something to fill in a few gaps.
Of course just diving in tends to fill in the gaps quickly too :wink:

Matt G.
http://mattgriffith.net

If you are new to both Ruby and Rails, I recommend the Ruby for Rails
book
to start. It really helped me to understand the basics. Knowing how
Ruby
works really helps understanding the magic behind Rails code. Then
AWDWR.
Once I started writing code, I found the Rails Recipes book very
helpful.

  • $.02
    -Larry

Hi Dobb –

On 13-Jul-06, at 3:12 AM, Dobb Lou wrote:

I am a newbie and interested in learning Ruby on Rails. I see
there are
2 books out there:

Ruby for Rails
Agile Web D. with Rails

Which one should I get?

I’ll put in my vote for David Black’s Ruby for Rails. While you
should probably invest in both, starting with Ruby for Rails might
reduce some of the smoke and mirrors you’re likely to find when
diving into Rails for the first time. If you have a beginning
knowledge of Ruby before you dig in, you’ll probably find the Agile
book a better read.

My $0.02

/Jeff


http://re.visioni.st
http://quotedprintable.com

Before I found Ruby and Rails, I had taught myself several procedural
languages. This has been a disadvantage in many respects. Ruby is so
well
designed, ( everything is an object), that you can write procedural code
in
it. I was still struggling with the object mindset when I read the
pickaxe
and AWDWR books. They are great books, and I use them for reference.
But, I
had trouble following their examples. The were too many things shown,
but
not explained to my satisfaction. The way RoR was written helped me to
understand objects, their scope and behavior better. I understand what
mixins are now. And the difference between include and require.
Modules,
classes, and methods are there as well.

On 7/13/06, Dark A. [email protected] wrote:

Seems like Ruby for Rails has really been gaining in popularity for the
best way to learn. Not to long ago it seemed liek AWDWR was the one usually
recommended.

AWDWR was the first good Rails book out, and was the ‘Rails Bible’
at
the time. AWDWR second edition is still worthy of a place on the
bookshelf. It is good for understanding how Agile programming should be
done with Rails.

Larry - were you completely new to Ruby when you read it ? And did you
have

previous programming experience ?

Before I found Ruby and Rails, I had taught myself several procedural
languages. This has been a disadvantage in many respects. Ruby is so
well
designed, ( everything is an object), that you can write procedural code
in
it. I was still struggling with the object mindset when I read the
pickaxe
and AWDWR books. They are great books, and I use them for reference.
But, I
had trouble following their examples. The were too many things shown,
but
not explained to my satisfaction. The way RoR was written helped me to
understand objects, their scope and behavior better. I understand what
mixins are now. And the difference between include and require.
Modules,
classes, and methods are there as well.
-Larry

Stuart

Seems like Ruby for Rails has really been gaining in popularity for the
best
way to learn. Not to long ago it seemed liek AWDWR was the one usually
recommended.

Larry - were you completely new to Ruby when you read it ? And did you
have
previous programming experience ?

Stuart

I’m a newbie too, but define newbie. Are you new to just Ruby and Rails
or
OOP or programming all together ?
I have all of them :). Agile Wed Dev is available as a beta PDF from
PragmaticProgrammer. So you can get updates on the 2nd edition as they
are
released. However I found, and it depends how you learn, if you can
read
code and learn from that then AWDWR might be the book. For me, I
decided a
step back (which was really a step forward) was the way to go. I picked
up
Learning to Program by Chris P… Give you funadmentals in programming
but
for Ruby. Also, Programing Ruby (1st version is online - ruby-lang.org)
is
pretty much indispensible.
Hope that helps!

Stuart

Well it’s all interesting. I’m kind of going back and forth between
them
all.
So I’m writing back because, inspired by the thread I went back to
r4rmusic1.
Yesterday I had done some work on my own but using AWDWR.
Here is something I noticed.

In AWDWR I definded an action in the controller to display all records
in a
table. It has a method in it that is defined in the model.
Controller:
def list
@positions = Position.current_openings
end

Model:
def self.current_openings
find(:all)
end

Whereas in Ruby for Rails (at least in r4rmusic1 to accomplish something
similar it’s a controller action:
def welcome
@composers = Composer.find(:all) .sort_by {|c| [c.last_name,
c.first_name]}
end

Point is not so much as they are just two different approaches. I
think,
and could be wrong, there might be some huge difference. 1) keeping
things
solely in controller and 2) using the model for methods.

Interesting.
Stuart

unknown wrote:

Hi –

On Thu, 13 Jul 2006, Dark A. wrote:

So it’s not that you, as a Rails developer, have to decide whether
you’re going to put everything in your controllers or your models.
Rather, you make judgements constantly depending on what the code is
doing and where it fits best.

David

I would think it would be worth mentioning as well that Rails implements
a variation of the MVC model. One take on that is that all business
logic (which is sometimes a bit fuzzy to define) belongs in the model
(M), while logic that is related to linking the model and the view (V)
belongs in the controller ©. Sorting for the purposes of presentation
would then be a controller function - maybe even a view function, but
not something that would normally go in a model. OTOH, a method that
filters out only a particular subset of model items for the purpose of
processing would belong in the model…for example, a function that
returns all currently active users.

Keith

Hi –

On Thu, 13 Jul 2006, Dark A. wrote:

def list
def welcome
@composers = Composer.find(:all) .sort_by {|c| [c.last_name,
c.first_name]}
end

Point is not so much as they are just two different approaches. I think,
and could be wrong, there might be some huge difference. 1) keeping things
solely in controller and 2) using the model for methods.

The choice of where the code goes will depend on what the code does.
I figure a sort operation (and yes, it could be done with a SQL
fragment :slight_smile: is generally ad hoc and on-the-fly; and if it is, it
belongs in the controller. Otherwise your model would have to come
equipped with a method for every possible sort contingency. That
would be unwieldy – and that’s why sort and sort_by take blocks: so
that you can customize them for a particular occasion.

On the other hand, something that functions more as a stable
quasi-property of the model belongs in the model. For example, if you
have a composer with first and last name and want to be able to say:

composer.full_name

you’ll want a method in the model that does something like:

def full_name
first_name + " " + last_name
end

So it’s not that you, as a Rails developer, have to decide whether
you’re going to put everything in your controllers or your models.
Rather, you make judgements constantly depending on what the code is
doing and where it fits best.

David


http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
Ruby for Rails => RUBY FOR RAILS (reviewed on
Slashdot, 7/12/2006!)
http://dablog.rubypal.com => D[avid ]A[. ]B[lack’s][ Web]log
[email protected] => me