Ruby Developer's Guide 94
Ruby Developer's Guide | |
author | Robert Feldt, Lyle Johnson, and Michael Neuman |
pages | 720 |
publisher | Syngress |
rating | 7 |
reviewer | Cole Tucker |
ISBN | 1-928994-64-4 |
summary | Good introduction to Ruby -- an overview as well as a practical cookbook. |
The writers of the book are very enthusiastic about both Ruby and the Ruby Application Archive (RAA), Ruby's response to CPAN. Overall, the text does a very good job demonstrating the base knowledge necessary for each of the libraries introduced and so can be quite useful to any developer with an understanding of core Ruby programming.
Directed towards programmers with a working knowledge of Ruby, the text is a quick read even with working through the examples. It effortlessly introduces the basic concepts of each package worked through and then gives locations where more in-depth information can be gathered. If you wish to work through any of the topics covered without digging through documentation just to obtain a basic grasp of the package, then this book is for you.
The book itself is a Syngress publication, and comes with a "1 year upgrade buyer protection plan" which seems to mean they have an errata page for the book and an "Ask the Author" section on the books website, along with a couple of other features mostly involving email. Looking at the errata page, it seems to be useful and up to date. The "Ask the Author" section also seemed to be fairly well-used by prior customers. Syngress seems to be serious about keeping customers up to date about the state of the book and providing services beyond that.
As for the book's problems, none of which are horrible, but do get old after a while: First, the book is big, and not completely because of content. The examples in the book span pages, and the text used in the source is a larger font that in the rest of the text. The examples also are full applications within themselves, instead of being presented in chunks and then having the full source available online. Another annoyance is each time the book mentions installing a package or library it goes through the whole "$./configure.rb; make; make install" process. The book also appears to have some organization issues, with notes for the text in the table of contents, which just served to irritate me. The final negative thing I noticed was that, though the text assumes programming knowledge of Ruby, the first chapter is dedicated to walking the reader through downloading and installing Ruby. The chapter is a big one too. So the book has a couple of hitches, mostly related to layout or mixed expectations towards the ability of the reader.
If you can deal with these small issues and are interested in the material covered, I can definitely recommend the Ruby Developer's Guide. The content is definitely there and they authors know their stuff.
Chapter List:
- Booting Ruby Discusses downloading and installing Ruby, IDE and editor support for Ruby and syntax stylings.
- GUI Toolkits for Ruby Covers use of Tk, GTK+, FOX and SWin GUI toolkits with a brush through on others available.
- Accessing Databases with Ruby Introduces the Ruby/DBI, Ruby/ODBC, Ruby/LDAp and Ruby DBM-file drivers.
- XML and Ruby Talks about the use of XML, including a basic introduction to it and then goes into parsing and creating XML using libraries from the RAA.
- Web Services and Distributed Ruby Goes into the libraries used for RPC's, SOAP and running distributed services with Ruby.
- WWW and Networking with Ruby Implements a server using high-level and low-level Ruby networking classes, then goes into using Ruby for the web, finishing up with a discussion of mod_ruby and eruby.
- Miscellaneous Libraries and Tools This chapter finishes the discussion centered around the RAA, going into graphics programming, data structures, genetic algorithms and other topics that didn't fit into a chapter of their own.
- Profiling and Performance Tuning Introduces the aspect of analyzing algorithms in Ruby, profiling your programs and discusses the advantages of similar Ruby constructs depending on what your focus is, with the intent of getting lean, mean programs.
- Parse Generators Discusses using Ruby instead of Bison or Yacc for creating a parser, and then goes into the advantages of various Ruby libraries to each other.
- Extending and Embedding Ruby Covers writing extensions to Ruby in C and C++ and later embedding Ruby into programs.
You can purchase the Ruby Developer's Guide from bn.com. Want to see your own review here? Just read the book review guidelines, then use Slashdot's handy submission form.
tired jokes (Score:1)
I bet this gets old within, oh, about 13 days of programming in Ruby.
Re:tired jokes (Score:1)
s/13/"RIGHT NOW"/ge;
Tom
Re:WTF? (Score:2, Informative)
intresting language (Score:5, Interesting)
Theres a intresting presentation of it, comparing to some other languages here:
http://www.io.com/~jimm/downloads/rubytalk/talk
Looks like the language uses lots of sort cuts, might give it a try sometime
Re:intresting language (Score:5, Insightful)
It's not that the language uses shortcuts really. Sure, there's a $_ in there to keep the Perl people happy, but it's not often used. No, the reason Ruby is so fast to code is because the libraries are so good.
See, Perl has some nice little tricks like map and grep. In Ruby these are methods of the Array class. However, they're implemented in a module. Want to grep a hash? No problem. Want to map (collect) on your own custom build data structure? Just import the module into your class and there you go. One short line of code. That's modularity for you.
Sure, there are a few problems. The I/O stuff isn't half as modular as it should be, but that will change soon.
Basically, though, there aren't any of those kludges associated with other languages. Everything is nice, clean, pure, unlike Perl's 'most of the time it does this, except when it does this' attitude. It's that that is the real time saver.
Ruby shines with unit tests (Score:5, Interesting)
* a terse syntax
* True object orientation
* dynamic typing
* and *unit tests*
is a winning combination. The first three allows you to write well-factored, compact and flexible code. With a comprehensive test suite you have much more confidence in your code than you get from static typing, so it effectively voids that issue.
Another thing I really like about Ruby is that you can reopen classes. This means that you can add features to existing classes, if that is where they really belong. When you do that every object of that type automagically gets the new features. Along with the fact that a lot of built-in features in ruby are methods, and the fact that you can rename and redefine existing methods means that ruby itself can be extended in very interesting ways! E.g, lets say you want to load ruby modules from zip files! Simple, just redefine Kernel.require to access zip files as well as directories.
Most of all, though, I just like the ease of expression you get with ruby.
sadly enough (Score:1)
i'm enthusiastic about ruby's future (can't you tell).
Re:sadly enough (Score:1)
Re:Ruby shines with unit tests (Score:2, Interesting)
Re:Ruby shines with unit tests (Score:2)
Ruby is dynamically typed, so if you have no means of automatically exercise most lines of code in your program, you cannot be reasonably sure you wont get runtime errors, because e.g
* you pass the wrong number of arguments to functions
* objects do not respond to the messages that are send to them
* etc etc
Re:intresting language (Score:1)
It does look like the code is very neat, and easy to prduce maintainable code. This is a big plus for software engineer (like me).
I've also stayed clear of perl because of this, most of the perl code I've seen looks horrible
I have nothing againest perl, I've seen some pretty neat stuff done with regular expressions.
Anyway my 1 cents worth
Ruby (Score:2, Informative)
Ruby is... (Score:2, Informative)
http://www.rubycentral.com/ [rubycentral.com]
and
http://www.ruby-lang.org/en/index.html [ruby-lang.org]
Re:Ruby is Swell but... (Score:2, Informative)
No documentation? The entire Programming Ruby: The Pragmatic Programmer's Guide book is online for free at http://www.rubycentral.com/book/index.html [rubycentral.com]. The book (in HTML Help format) also comes with the Windows install package at http://www.rubycentral.com/downloads/ruby-install
Re:Ruby is Swell but... (Score:2)
No Documentation? (Score:3, Informative)
Re:No Documentation? (Score:1)
You just don't get this amount of free documentation in the Perl or Python worlds.
Before making such bold claims, you should probably check out man perl, and the plethora of man pages which are listed therein.
Re:No Documentation? (Score:2)
Believe me, I am quite aware of the Perl man pages -- I even learned Perl from them in 1992 and I still use Perl (and its man pages and perldoc) today. But to really know Perl you have to read the Camel book. And Wall and Schwartz haven't made that free yet. The Ruby version is free, however.
Re:Ruby is Swell but... (Score:2, Informative)
Re:Ruby is Swell but... (Score:2)
See "The Pragmatic Programmer", page 103, tip# 29: "Write Code That Writes Code"
(Ruby code that writes Java code).
alot -- a lot (Score:1)
Re:Ruby is Swell but... (Score:1)
Re:Ruby is Swell but... (Score:2)
I'm not so much interested in having Ruby and Java work together in any sense.
I'm just using Ruby as one of my tools to write Java.
Re:Ruby is Swell but... (Score:3, Insightful)
WRT to your 'maybe if it had gotten out there before python' comment: explain, then, why it is MORE popular than Python in Japan, in spite of having come out later. I think the acceptance issues have been driven more by the fact that much of the work has been done in Japan (and, hence, much of the documentation is in Japanese).
/me swivels in chair and looks at shelf behind
As for 'Like no documention': Like, dude, I've got Like 4 books on the shell behind me about, Like, Ruby.
As for wrong bindings. You have actually written the authors about these, right? So far I've found Ruby module authors to be just as pleasant and helpful has their Perl and Python counterparts, in spite of my complete lack of Japanese language skills and their oft admitted poor English skills.
I would argue that Ruby is benefitting from maturing after Python, like all languages should. Matz is learning what to include and what to avoid in his language design.
Finally... you can't seriously expect us to take the "this software has bugs, so we can't use it" argument, do you? All software has bugs. All languages have warts in their design and bugs in their implementation.
Re:Ruby is Swell but... (Score:1)
Then there's the fact that in Ruby everything really is an object. I don't have to ask myself, "ok, can I do this with an instance method, or do I pass the object to a function?" Even when Python gets this right, methods far too infrequently return self, requiring extraneous assignments, and decreasing efficiency, both in terms of computer efficiency, and programmer efficiency.
Re:Ruby is Swell but... (Score:1)
Ruby has some nice features, but it'll never be more than a tiny niche language, regardless of whatever is going on in Japan.
Why don't you take your own advice?
There are way too may people making silly assertions on both side of the fence. Different people are interested in different problem domains. People work and think in different ways, so what is a productive environment for one person may not be for another. Your lack of productivity with Ruby means no more than the previous poster's lack of productivity with Python. As far as niches go, I've got news for you - both of them are niche languages. At least they're niches compared to some other general purpose languages like Java or C++. Be happy that you have a chance to use Python in your work; most people don't get that opportunity. I guess I'm just argumentative tonight, but people in the Ruby community have (for the most part) already bored of constantly carrying on this same tiresome argument about Python and Perl. It's just not interesting anymore.
Re:Ruby is Swell but... (Score:1)
It is a matter of which is more useful for a given task. For myself, Ruby has all of the text manipulation-y goodness of Perl, but with a pure OO design that lends itself to predictability(and those things that surprise me always manage to be good things).
I am productive in Python, but I've found Ruby clearly superior in situations, such as web programming, which require loads of text manipulation. The ability to modify existing classes without having to subclass them is also extremely useful.
Re:Ruby is Swell but... (Score:3, Interesting)
The problem of support is, of course, a real one in many applications. The fallacy of the "who cares?" argument here is that the same argument could probably have been used against every programming language since the first assembler was written. Not every new language "makes it" by a long shot, but not every well-supported language lives forever, either. Python was barely on people's radar for the very longest time; it has succeeded because enough people were convinced it had advantages that outweighed a temporary (or possibly even permanent) disadvantage in publicity, support, or whatever reason-to-fail you might give.
Well, you can be proud of your heritage without repeating the sins of your parents. :-) As far
as I can tell (I've programmed in Perl since 1991
and in Ruby for a few months), Ruby retains much
of Perl's flexibility while hugely reducing
the amount of (non-regexp) "line noise" feel that
even I think Perl sometimes has, and dramatically reducing the number of oddball special cases. I
know you could say the same thing about Python,
but I never really "got into" Python, for whatever
reason. Like it or not, I think we all realize
that tastes vary somewhat in these things.
Re:Ruby is Swell but... (Score:1)
so there is documentation. I should have said very little Documentation and the majority of it kinda poor, and in comparison to other main stream languages it has virtually no documentation.
more popular in japan? my response is have the python Docs been translated to japanese?
probable not, and there's your answer.
Re:Ruby is Swell but... (Score:1)
Dude, seriously, our band is HUGE in Sweden!
I prefer Ruby to Python, but... (Score:3, Informative)
Also, there is a bit of a disagreement about the GUI interface to use with Ruby. Fox is preferred on Windows machines, but it often causes library conflicts if you attempt to install it on Linux machines.
These are "growing pains", but for the moment Python is significantly more useable for many purposes. (OTOH, if I'm only using it on my own machine, or I only intend to distribute it to other programmers, and if GUI doesn't need to port to a system that can't handle gtk properly (e.g., Win95), then I prefer Ruby.)
OTOH, I'm still not totally convinced that importable modules can actually replace multiple inheritence. So far I haven't run into any show stoppers, but I keep having the nagging feeling that one is lurking somewhere in the future
Re:I prefer Ruby to Python, but... (Score:2)
Given the number of object-oriented languages (including Java) that have been doing Just Fine without MI, I suspect your nagging feeling is probably just needless worry. I have no doubt that your code could have a different conceptual feel without multiple inheritance, but, hey, single (implementation) inheritance itself is probably over-used. Stepanov, god of the STL would argue (I think) that what people really want in most cases is generic programming on well-structured data. Interestingly, Ruby can be used in this way, too, despite the pretensions to being "pure OO".
Re:I prefer Ruby to Python, but... (Score:1)
For the record, I've never heard of FOX causing "library conflicts" if you attempt to install it on Linux machines (can you substantiate this claim at all?). In fact, Linux is the primary development platform for FOX (although it's equally well-supported on Windows).
If we're still comparing Ruby with Python, what's your point anyway? The last time I checked there was plenty of disagreement about which GUI interface to use with Python as well.
Re:I prefer Ruby to Python, but... (Score:2)
Now one of these machines is a beta Mandrake 8.2 and the other's a beta Red Hat 7.3, so it's not conclusive. But the Mandrake that I've ordered hasn't told me that it's shipped yet, so... that's the best I can do.
As to Python GUI, Tkinter seems solid on all platforms I've tested. It might not do everything that I'd want, but it works. The Ruby version
I don't know whether or not I would have been able to compile Fox on Windows. Probably not (I'd depend on CygWin). But the Professional Programmers site has a nice install that puts a working copy of Fox in the Ruby folder of even a Win95 machine (nice, as that's what I use). But (as I said) I can't use it on the Linux side of things. Yes, it isn't really Fox, it's a coordination between Fox, FxRuby, and OpenGL, but the effect is that the build won't complete.
(It's better than it was... for awhile I had three mutually incompatible versions of things running. Now I've got Fox compiled, and the Fox Calculator working, etc. But the Ruby connection is still non-functioning.)
SpecRuby seems to almost work (on Win95), but every time I exit it, it crashes (so did a prior version of Fox, though less regularly). I think that these must be designed for Win98, and Win95 is doing something differently. I suppose I might decide to build all of my windows on the Linux side, and port them to the Windows side, but I find mechanically generated code hard to tinker with. (Perhaps I should just try harder, but
Glade is the obvious answer, but unfortunately the use of gtk with Win95 is
Very much 'Not Insightful' - List of Docs follows (Score:4, Informative)
Check out the ruby-lang pages list of docs [ruby-lang.org] there's a lot of good stuff there.
I own Programming Ruby - The Pragmatic Programmer's Guide [rubycentral.com] (available in full online) known as 'The Pickaxe Book' (ie the Ruby Camel) and Ruby in a Nutshell [oreilly.com] from OReilly by the language designer Yukihiro Matsumoto (known as matz on the mailing list). Hail matz!
Then there's a personal favorite dead tree of mine The Ruby Way [prenhall.com] by Hal Fulton. I haven't finished it yet but it's full of crunchy goodness.
Between, those books and the wealth of tutorials and docs linked from www.ruby-lang.org/en there's a lot more material available than there was for Python when I started using it.
And the fact that these books keep selling and getting published implies to me that people are using Ruby.
When in doubt check the Ruby Book list at www.rubygarden.org [rubygarden.org] to see whats out now and whats in the pipe.
As far as the bindings being buggy - I've only played with a few but they seem as good as I recall pythons bindings from when I used python. (admittedly that was a while ago)
C'mon give Ruby a try - I've found it a delight to play with. You might like it - and if not -well, learning why you dislike it is a valuable type of learning as well
I suggest the Pickaxe book [rubycentral.com] (you'll eventually want to buy a hardcopy) and if you don't want to download the interpreter right now - well hold onto your hats. A clever fellow named Clemens Wyss has an 'interactive' version of the Pickaxe with all the code examples live in your browser so you can play with the code a lil. Find it here [www.ruby.ch]
In closing:
RubyCentral [rubycentral.com]
RubyGarden [rubygarden.org]
Ruby-Lang [ruby-lang.org]
Ruby-Talk Mailinglist [ruby-talk.org]
or check out the newsgroup at comp.lang.ruby
Kevin
--
'Just another Ruby Miner'
Re:Ruby is Swell but... (Score:1)
I am! After doing OO Perl for a while I find Ruby to be oh so much cleaner.
"There is Like no Documentation on it"
Hmmm.... let's see there are five English language books on Ruby now:
"Programming Ruby: The Pragmatic Programmer's Guide"
"Ruby In a Nutshell" (by Matz himself)
"The Ruby Way"
"The Ruby Developer's Guide"
"Teach Yourself Ruby in 21 days" (actually very good book)
And in fact the full text of "Programming Ruby" can be read online at http://rubycentral.com
I'm not sure how you can say there's no documentation.
"and most bindings are buggy"
I'm not sure what you mean by 'bindings' here.
RIAA? but we hate them! (Score:2, Funny)
Ohhhh... he said "RAA"... never mind.
Ruby code examples (Score:3, Informative)
Re:Ruby code examples (Score:1)
start here [ruby-lang.org] or download here (to save bandwidth) [ruby-lang.org]
Get free book about ruby or buy paper version. [rubycentral.com]
Ruby? (Score:2, Funny)
Re:Ruby? (Score:1)
http://www.mindview.net/Etc/FAQ.html#Ruby
Re:Ruby? (Score:2)
Yes, people in what you could call the Ruby Community did in fact wonder what Bruce Eckel was thinking when he wrote that. This quote is particularly weird given that he goes on to point out that the syntax is more Perlish. I think what is really going on here is that Ruby did fairly self-consciously tried to implement some features of particular languages that the author thought would be especially useful. But a lot of the similarities with various scripting languages are almost certainly less "rip-off" than the inevitable consequence of working in a constrained design space. It is actually quite reminiscent of a situation you see in plagiarism lawsuits against screenwriters who are accused of "clearly copying" some part of their work from that of some amateur they may or may not have barely seen once upon a time. But it turns out that the courts recognize that once you have the nucleus of a specific idea, a lot of plot and character similarities basically come along for the ride.
The real reason Ruby got written was that the author thought it was a better language for his uses than the alternatives available to him. Obviously, you won't get universal agreement on something like this, but to assume that something like Ruby would be an ignorant rip-off of your favorite language strikes me as a bit weird.
Re:Ruby? (Score:1)
I don't think ripoff is the right word, either. I posted the link to the Eckel's comment because I hoped to see some reaction from Ruby fans. I admire Eckel, but everyone is wrong sometimes, and Ruby folks should be the first to have valid arguments with Eckel's points.
And even if it's valid to describe Ruby as a ripoff, that doesn't make it a bad thing, in my mind. More the merrier. I have to admit I haven't looked into Ruby too deeply, primarily because my initial glance led me to believe it was harder to type ('self.' is a lot easier for me to type than '@' believe it or don't--my hands start to hurt if I have to type too many shifted chars away from the home row). Silly way to judge a language, but there you have it.
It's just a different way to do things, I guess. To each his own (and thank goodness there are choices!).
Re:Ruby? (Score:2)
Indeed. I think a lot of Ruby users don't find themselves very interested in this issue any more. For a wide sampling of opinion on this and related issues, back in the day, you might be interested in this 138-post thread [google.com]
Or maybe not. :-) More seriously, the best response in this thread is, I think, the second
one, by the author of the book involved.
Don't miss ... (Score:1, Redundant)
Ruby is a great language with a lovely syntax, try it !
Programming Ruby Online Edition (Score:5, Informative)
Other books (Score:5, Informative)
And some in german:
Re:Other books (Score:3, Informative)
I would love to see this book get published, but the last I heard, as suggested by this message from the author himself, [google.com] the book has been cancelled. Does anybody know if they changed their minds on this or found a new publisher (Addison Wesley did the original contract)?
My little (unreleased) intro to Ruby (Score:4, Interesting)
It's only a first draft, but it should give a reasonable overview to the curious.
Any thorough, unbiased comparison Ruby v. Python? (Score:2, Interesting)
Re:Any thorough, unbiased comparison Ruby v. Pytho (Score:1)
I'm not going to respond to the "Python is better than Ruby" troll. Oops, I just did.
Sample Chapter (Score:5, Informative)
http://www.syngress.com/book_catalog/183_Ruby/sam
If you want to see what the book is like.
(Note: I write books for Syngress, though I have no financial interest in this one. Consider this a plug if you like.)
Nice large fonts, lots of complete examples (Score:2)
ruby's great and all, but... (Score:3, Interesting)
Lack of a CPAN type tool is *still* the reason I haven't mainly switched to python BTW. Download sites like VoP aren't even in the same category.
Ruby is a wonderful language (Score:1, Interesting)
"If you pick up a starving dog and make him prosperous, he will not bite
you. This is the principal difference between a dog and a man." --Mark Twain
Re:Ruby is a wonderful language (Score:1)
What kind of "strong typedefs" does Python have that Ruby doesn't?