M
Mc Osten
I started using ruby a couple of weeks ago and it's time to make a couple
of questions
This is a long post, so I'm gonna write a short summary
1. Books
* Book on Rails
* Book on Ruby
2. Some internals (method resolution and such)
3. Module syntax
1. BOOKS
Up to now I read the first part of the online version of "Pragmatic
Programmer's Guide". I found it well done, even if I'm not really able to
find some informations I like to know. Expecially about what happens under
the hood (without having to look at the sources )
I need a book about Rails, but that seem a minor problem. I see that there
are two main options (and I hope it's not OT to ask here):
a) Ruby on Rails: Up and Running
b) Agile web developement with Rails
The second one got amazing reviews on Amazon and is also linked in the
Rails page. I think I'll go with this one
I also need a book on Ruby. I think I really don't need a "pratical" book.
I'm not a new programmer and I have got some experience with dynamic
languages (exspecially with Python). So being "beginner friendly" is not a
concern.
I like quite a lot ruby and I'd like to learn how it works (and how to use
language constructs to hack it and fully use dynamic capabilities). For
example in the Python world the Nutshell is quite exaustive about how
Python "works" (without entering in the C implementation realm).
For example it explains in detail method resolution, which functions are
called under the hood (for example the __setattr__ and such).
I need that kind of book.
Another thing that could be useful is a library reference (but I already
saw there is plenty of information online). I'd go with the Ruby in a
Nutshell... but for example with Perl the Nutshell was not what I was
looking for and I had to buy Wall's book to understand some useful stuff
(ok, Perl is a *really* complex language, with lots of rules etc...)
Another Nutshell I bought was the Cocoa Nutshell (that is quite useless to
me, since duplicates a lot of informations I can get from Apple site).
Unfortunately I live in Italy and I've no bookshop nearby that deals with
english tech books. So I've no opportunity to have a look at them before
buying.
So... is there a lot more in the printed edition of Pragmatic
programmer...? How's the coverage of advanced topics?
And "The Ruby Way"? How is it?
2. I wanted to know what happens if I do
class A
def foo
end
end
a = A.new
a.foo
I found that it is *not* the same than
a.sendfoo)
I mean, if I redefine send, send is not called in "a.foo".
I thought I could redefine __send__, but ruby has not the same opinion on
the matter.
For example in Python I can do this redefinining __getattribute__ (I know
it's not good to go on a language ng talking about another language). In
fact this is even more radical...
Is there a function that is called when I call a.foo? Or it's just a lookup
in a.methods? Can I trap this? The __send__ message how is handled?
And are "attr" and "attr_writer" functions? What kind of functions are
them? Is there a place on the net where are explained in detail these
subjects? A book? [ ref 1. ]
3. Module syntax
What is the difference between :: and .? I suppose they do the very same
thing. Am I correct?
Thanks in advace.
of questions
This is a long post, so I'm gonna write a short summary
1. Books
* Book on Rails
* Book on Ruby
2. Some internals (method resolution and such)
3. Module syntax
1. BOOKS
Up to now I read the first part of the online version of "Pragmatic
Programmer's Guide". I found it well done, even if I'm not really able to
find some informations I like to know. Expecially about what happens under
the hood (without having to look at the sources )
I need a book about Rails, but that seem a minor problem. I see that there
are two main options (and I hope it's not OT to ask here):
a) Ruby on Rails: Up and Running
b) Agile web developement with Rails
The second one got amazing reviews on Amazon and is also linked in the
Rails page. I think I'll go with this one
I also need a book on Ruby. I think I really don't need a "pratical" book.
I'm not a new programmer and I have got some experience with dynamic
languages (exspecially with Python). So being "beginner friendly" is not a
concern.
I like quite a lot ruby and I'd like to learn how it works (and how to use
language constructs to hack it and fully use dynamic capabilities). For
example in the Python world the Nutshell is quite exaustive about how
Python "works" (without entering in the C implementation realm).
For example it explains in detail method resolution, which functions are
called under the hood (for example the __setattr__ and such).
I need that kind of book.
Another thing that could be useful is a library reference (but I already
saw there is plenty of information online). I'd go with the Ruby in a
Nutshell... but for example with Perl the Nutshell was not what I was
looking for and I had to buy Wall's book to understand some useful stuff
(ok, Perl is a *really* complex language, with lots of rules etc...)
Another Nutshell I bought was the Cocoa Nutshell (that is quite useless to
me, since duplicates a lot of informations I can get from Apple site).
Unfortunately I live in Italy and I've no bookshop nearby that deals with
english tech books. So I've no opportunity to have a look at them before
buying.
So... is there a lot more in the printed edition of Pragmatic
programmer...? How's the coverage of advanced topics?
And "The Ruby Way"? How is it?
2. I wanted to know what happens if I do
class A
def foo
end
end
a = A.new
a.foo
I found that it is *not* the same than
a.sendfoo)
I mean, if I redefine send, send is not called in "a.foo".
I thought I could redefine __send__, but ruby has not the same opinion on
the matter.
For example in Python I can do this redefinining __getattribute__ (I know
it's not good to go on a language ng talking about another language). In
fact this is even more radical...
Is there a function that is called when I call a.foo? Or it's just a lookup
in a.methods? Can I trap this? The __send__ message how is handled?
And are "attr" and "attr_writer" functions? What kind of functions are
them? Is there a place on the net where are explained in detail these
subjects? A book? [ ref 1. ]
3. Module syntax
What is the difference between :: and .? I suppose they do the very same
thing. Am I correct?
Thanks in advace.