Want To Learn How To Program in Ruby? Beginning Ruby Was Written For You!

Beginning Ruby (buy it at Amazon.com) is a Ruby programming book aimed at newcomers to the language. It’s written in an instructional format and walks through basic programming concepts through to building Web apps, database apps, networking daemons, and GUI based apps. It’s well suited for someone new to programming as well as experienced developers who are just new to dynamic languages. See the Table of Contents.

Where To Buy

Amazon typically offers the best price for Beginning Ruby. Check it out on Amazon.com (US) or Amazon.co.uk (UK). The book is available in both print and Kindle formats. Alternatively, the publisher, Apress, also has the book for sale at full retail price as well as the e-book/PDF version.


Beginning Ruby has 27 5-star reviews over at Amazon.com, but others have been received in third party reviews or by e-mail:

This is not just an introduction to Ruby. Pretty much every technology that is linked to Ruby in some way is discussed [..] The author, Peter Cooper, is obviously a well-rounded Ruby developer, and his enthusiasm for the topic shines through. And with almost twice the number of pages as the other [books] reviewed here, his is easily the best value of the three.
Andy Hudson, Linux Format

Peter Cooper’s Beginning Ruby: From Novice to Professional has two audiences, novices with no programming experience who want to learn Ruby as their first programming language, and veterans who want to add Ruby to their programming toolkit. Cooper’s response to this challenge is a solid entry in the limited arena of Ruby tutorials.
Tim Hunter

This has to be the best book for Ruby beginners, whether it be for scripting or for moving towards Rails. [...] Easily a 9/10 in my eyes…nothing gets the 10 unless it has nudity….and that’s not an invitation Peter.
Jamie van Dyke

I’ve been reading Beginning Ruby by Peter Cooper. I’m really impressed. [...] [A] great book for a new programmer, or a programmer new to Ruby. It’s a great alternative to the other beginner’s books on Ruby out there.
Pat Eyler

Both Chris Pine’s book and _why’s guide have their moments, but in my opinion Cooper’s book has a considerable edge in clarity and usefulness. [...] In addition to being a great ruby book, it’s also one of the best “tech” books I’ve ever purchased. It’s rare to see this level of quality in technical writing.
“Phren0logy” on Amazon.com

I really like Beginning Ruby. I’ve been teaching a Ruby course at CCSF (City College of San Francisco) for the last two years and I’ve used the Pickaxe as the main textbook. It’s a fine book, but it’s a struggle to adapt that knotty mess into a sequence of didactic lessons. Next semester I’m using your book (CS132A) because I feel that you done a great job of organizing the material into teachable chunks. You’ve saved me the agony of writing my own textbook. Nice work.
Douglas Putnam – Professor of Computer Science, CCSF

Working through the early sections and have really enjoyed the book so far, your description of object orientation is the best I have come across in any book.
Caoimh O’Broin

The best, and most comprehensive, introduction to Ruby I’ve seen. [...] The text is neither dry nor whimsical, but a perfect blend between reference material and hands-on tutorial. [...] I almost want to buy a second copy out of sheer appreciation for Peter Cooper providing a great guide to a great programming language!
Zeff Morgan

I think Beginning Ruby: From Novice to Professional is a better first Ruby book than the venerable Pickaxe. [..] If you want to learn Ruby, Beginning Ruby is the book to buy.
Larry Wright

Leave a Comment

What I’ve Earned (And Learned) From Writing “Beginning Ruby”

As the author of Beginning Ruby, I make money for every copy sold in print and electronic formats (as well as some miscellaneous income I’ll cover later). It’s not much money – but that wasn’t the motivation for writing the book.

In this post I’m going to show you how it all works from my point of view including sales figures, pictures of my royalty statements, information about my advance, and similar gruesome stuff. There’s even a section at the end about how Apress pissed me off a bit (though I don’t regret the experience with them – they’re a good publisher generally, though less so since their restructuring) and why I’m happy with you pirating my book if you so choose (though this is by no means an encouragement to do so – it’s still illegal, alas!)

October 19 update: After being received well by readers on Hacker News and Reddit a week ago, this story was Slashdotted with an inaccurate summary on October 16 – the same day my daughter was born! :) I therefore redirected all traffic to this site to a cancer donation page as I couldn’t rebutt the nasty comments and I had bigger things on my mind at the time. I feel, however, I need to give some extra information throughout this post to clarify the points that were misunderstood by a minority of readers. These added notes are in bold italics.

The Advance

The “advance” is a sum of money you get from your publisher up-front while writing the book. Ostensibly the advance supports you while writing the book, but really it’s to ensure you get the book finished. For the first edition back in 2006 I got an advance of $6000. Apress gives you a third at a time at these points: 1) when three chapters are completed and approved, 2) when two thirds of the book is completed, and 3) when the manuscript is complete. So my $6000 was spread over about 9 months.

Note: Some non-writers make the mistake that an advance is a type of grant or bursary and that once the book is out, you earn more money per copy sold. The word “advance” is well chosen, because the payment is simply royalties in advance. So if you get a $1000 advance and make $1000 in royalties in the first year, you get no extra money. The royalties made once the book is actually selling “pay back” the advance you received earlier. The only advantage to you is that if your book bombs and doesn’t even sell enough copies to pay back the advance, you (usually) don’t have to give the publisher back a penny.

How Much Do I Get Per Book?

Print Copies

The retail price (RRP) of Beginning Ruby is $40 (give or take a penny) but my publisher, Apress, makes a varying amount per book – I don’t know why (Update: I’ve been told by informed readers that the varying net price is because different retailers and distributors get better discounts than others.). An “average net price” is shown on my royalty statements but this fluctuates. It’s usually anywhere between $18.00-$19.00. Let’s say $18.50. Of this $18.50, I get:

  • 10% ($1.85) for each of the first 4000 copies sold
  • 12.5% ($2.31) on copies 4001-8000
  • 15% ($2.77) on copies 8001-12000
  • 17.5% ($3.23) on copies 12001-25000
  • 20% ($3.70) thereafter

Note: If I promote the book with an affiliate link to Amazon.com and make 4% commission on their $26 sale, I can add another dollar per sale.

E-book / PDF Copies

Despite selling the e-book directly at $27.99, the net price for the e-book comes to about $18.00 overall. Since there are no printing or supply chain costs, though, you get double the royalties on e-books. If your print copies are currently earning a 10% royalty, say, you get 20% on the e-book sales. This means at the 10% mark, it’s $3.70 per e-book, $4.62 at the 12.5% level, $5.54 at the 15% level, and so on.

Sales Figures

As an introductory book to a programming language, Beginning Ruby has seen perennial sales – it’s not a time specific book (like, alas, 90%+ of Rails books). The biggest burst was around launch – as for most tech books – but the sales didn’t drop off significantly for the first edition over its lifespan. In 2 years (8 full quarters), 7673 paper copies and 486 e-books were sold. The sales in early 2009 boosted this up to approximately 8500 paper copies and 500 e-books total for the first edition, although the statements since 2008 are so hard to read I haven’t got an exact figure.

The second edition of Beginning Ruby was commissioned in late 2008 and came out in August 2009, so there are no sales figures for it at all yet. Once there are, I’ll be posting again. It’ll be interesting to see if the second edition experiences a similar burst to the first. Other Apress authors have suggested it will.

In the grand scheme of things, selling about 9000 copies of a technical book is neither cause for a great celebration or despair. The book easily paid back its advance in the first two quarters and it’s provided Apress with about $170,000 in net revenue over two years (of which about $19,000 has ended up with me).

Royalty Statements

The salient details have been given above but I want to show off some of Apress’s royalty statements. Back in 2007 they looked like this:


Note: You might appreciate seeing John Resig’s royalty statement for roughly the same period for Pro JavaScript Techniques. Somehow my book outsold his, but he got a better advance ;-)

I thought these statements were pretty cool. I couldn’t always figure out why the reserve was being calculated as it was or what the “licensed rights” were, but I could easily see how many copies I’d sold in both print and e-book format per quarter and had a good history and breakdown of my payment.

Note: See the 30% withholding in taxes at the bottom right? It turns out if you don’t identify as a US tax payer (and have the required number – which, alas, forces you to then file tax returns in the US), the US tax man will still steal 30% of your royalties (though oddly not your advances) to fund all sorts of nefarious nonsense. Luckily, if you’re in one of several countries with a tax treaty with the US at least, you can claim back some or all of the withheld tax from your local income tax. It’s not easy though.

In 2008 Apress implemented a new, supposedly better backoffice system, and now royalty statements are like this:


Apologies for the image quality; I took it on my iPhone and Photoshopped it.

This statement turned up today and it merely covers some e-book sales that occurred in the gap between the first and second edition (which is why it only covers about 150 sales). So, it’s one of the simpler statements I’ve received but I still feel like a degree in steganography to figure it out. I get the jist, but they do crazy things like split a 12.5% royalty up into a section for the 10% and another for the 2.5%.. then you have “proportional ebook royalty” sections added on. You also get your “reserve” back after 18 months and when you add those in as well.. it’s a train wreck compared to the 2007-style statements. I know I’m not the only Apress author to feel this way.


If you didn’t see the reference to “reserves” in the above royalty statements, scroll back up and check. Essentially you get a cut of your royalties hidden away for 18 months (technically “6 periods” – but since a period is a quarter, that’s 18 months) in order to pay for any “returns” – books that bookstores send back to the publisher which they can’t sell. In 2007 I believe – though I’m not sure – that I had $2200 of royalties taken away as reserves. I then got these amounts back sometime recently. Curiously, the taxes for these reserves were taken away back in 2007, so even though it was “income” US tax wise, the income didn’t materialize till 2009. This confuses me as much as I’m sure it would you.

Licensed Rights

On the royalty statements above, you should see references to “Licensed Rights.” My first editor told me that these are payments you receive for foreign versions of your book, for inclusion on systems like O’Reilly Safari, and “similar.” I’ve asked a couple of times now but I’ve never found out what these amounts are specifically for and I’m not aware of any translated editions of Beginning Ruby. (Update: On October 13 – 6 days ago – someone from Apress contacted me to let me ask questions about some of these issues, but I haven’t had a response as yet.)

The Second Edition – A New Advance But Royalties Go Back to 10%..

In late 2008, an editor at Apress – Michelle Lowman (Update: Who, by the way, was a great editor.) – got in touch with me about writing a second edition of Beginning Ruby. Since 2006, a number of library preferences had changed, URLs had changed, and there were quite a few updates or new sections to do (such as references to Ruby 1.9, new libraries, GUI development, and alternative Web frameworks).

Now, I wasn’t particularly keen on doing a second edition for a variety of reasons, but the Apress contract states that if you don’t, they have the right to do it without you, have someone else’s name slapped on the book, and, I believe, you get money taken out of your royalties to pay for various bits of extra work. Having my book pulled from under my feet didn’t sound appealing so I signed up to do it.

The weird thing about doing a second edition is that it’s not really treated as a “second edition.” Instead, it’s like an all new book. You get a new advance ($6500 in my case – $500 more than my first but significantly worse due to the USD-GBP rate at the time) and you have to go through all the same motions as with a new book. Your royalty rate and sales figures are even reset back to square one! So you’re straight back to a 10% royalty after clawing your way up to 15% after 8000+ sales. Ick.

The Free PDF Fiasco (or How Apress Really Pissed Me Off)

Since the money wasn’t too hot and I’m more interested in print sales anyway, I went into second edition negotiations with an insistence that the electronic/PDF version of the book could be freely available – as in beer, rather than speech. After all, the e-book’s sales were poor – the print edition outsold it 17 to 1 – and Apress had made a pitiful $7500ish over 2 years from it. Like Seth Godin and, well, hundreds of other authors, I believe free electronic copies can significantly increase mindshare and print sales. With a book like Beginning Ruby, the majority of readers want a print book, so it seemed a no-brainer to keep sales strong in a market with growing competition (from Manning, particularly).

I have no reason to believe my editor didn’t fight my corner, but whenever she took it to the meetings (where all the top Apress honchos decide what books to publish and how) she came back saying that the top brass weren’t keen. I begged and begged, wrote a couple of pleas, and offered to talk directly to these people to get my ideas across, but nope – nothing. The only compromise that was reached was that a couple of chapters could be released per month, separately – which is about as appealing to readers as getting a tenth of an orgasm. Even this didn’t make it into my contract, and I did push on it.

(Update: Some readers have, rightly, pointed out that there are different business cases regarding giving away e-books in order to encourage print sales – and not all books are likely to meet the criteria. I would have agreed for my first edition, but my second edition is entering a far more competitive atmosphere – it’s no longer the only up to date book. Also, despite good sales and great reviews, my book hasn’t been noticed by a large swathe of the most experienced Ruby community.. the same people who recommend books to others! If the more experienced folks can “test” the book for free, they’re more likely to recommend it to the newcomers. My book isn’t even listed at the officially sanctioned Ruby book listing at ruby-doc.org – as an aside, it once was with a snide comment next to it, but I believe the maintainer has a grudge against me ;-) )

Eventually the book was published in August 2009 and I have yet to see how it will sell. What really flipped my lid, though, was seeing other Apress books like Dive Into Python and Pro Git getting the treatment I wanted. You can read both of these awesome titles online, in full, for free. Offering electronic content for free to promote print book sales isn’t an alien concept to Apress so someone’s playing favorites over there.

Pirate My Book? (Yes, that’s a question mark.)

(Update: This is the most contentious section and the most misunderstood. I am basically saying two things: 1 – if you pirate my book, I think that’s pretty cool, and 2 – I’m running a thought experiment on the ways around the legal restrictions there are. Note that I am NOT saying “you should pirate my book” or “please break the law and get into trouble” as some Slashdotters believe. I say this is NOT a good idea if you are not aware of the risks. So, no, I’m not going to pursue you and I actually think it’s great when I see my book being pirated, but I cannot advocate you break the law.)

My reaction to seeing other Apress books getting the free, electronic version treatment is: I’m good with you pirating my book! (Update: “I’m good with you” NOT meaning “You must,” as some Slashdotters believe.) Now, of course, I can’t actively participate in pirating my book but, heck, it’s around on plenty of “free e-book” sites and on RapidShare. There are even links on Twitter to torrents like this. I am happy for you to pirate my book, but.. I’m NOT A LAWYER, and I can’t guarantee what Apress would do about it – so you’d be doing it off your own back! So, uhm, don’t pirate it? ;-) The only condition, of course, if you do is that if you like the book and you think a print copy would be swell to own, please buy one – even if it’s just for someone you know who wants to learn to program! :-) (Update: I’ve received e-mails from readers who went on to do exactly this.)

Now – a thought experiment.. According to my contract, I own the copyright to the entire book except for the cover, table of contents, and the indexes. My contract also states that I have exclusively allowed Apress to publish and reproduce my content. So.. I suspect that if you took my book, removed the cover, contents and indexes, and turned it into a PDF with a cover of your own creation, Apress couldn’t do anything about it because everything would be my copyright. Now, I cannot allow you to do this, but I would not pursue you if you did ;-) So, er, don’t do it! (Update: Yes, I’m aware this is “cute” language but my message isn’t too obscured – I like seeing my book pirated but I cannot legally demand you do so or to break the law!)


As a way to become well known, to have something awesome for your résume, or to satisfy an ambition to “write a book and have it published”, writing a book and getting it published by a major publisher isn’t a bad way to spend your time. If a little fame and respect are all you want, one book is enough. If you want to earn a serious income from books, you need to pump out several books. That’s why most tech books seem to be by authors who’ve written a single book or many books (I seem to recall Knuth making that observation once).

I’d argue that unless you’re writing a very niche book (that’s unlikely to earn back its advance) or a book that’s likely to be extremely popular, you should avoid the major publishers and instead find a mid-sized publisher that can offer more attractive royalties. Advances look appealing but if your royalty rate sucks, it makes no difference unless you think you’ll never earn it back. Instead, look for a publisher like The Pragmatic Bookshelf that can offer you 50% royalties. (Update: There has been a lot of FUD over the Prags’ royalty rate which Dave has countered here.) Even if I’d sold only 2000 books for $18 net (versus 8500 at Apress), I’d have made the same money! The marketing that a publisher like Apress can provide doesn’t quadruple your sales, so you’d be ahead. Smaller publishers are also easier to talk to (from what I’ve heard) and you can negotiate better licensing deals with them.

I certainly couldn’t say I regret my Beginning Ruby experience, though. The above is all stuff I’ve learned because of this process and there’s a lot you don’t know as a no-book newbie. Getting even one book under your belt with a “regular” publisher can open your eyes and have a big effect on your way of thinking. I’ve also got to work with some really interesting people at Apress (most of whom who have, sadly, left or been fired in the big scaledown they did recently). The effect of Beginning Ruby has only been positive to me, even if it hasn’t gone as smoothly as I’ve wanted.. and it could certainly be worse than receiving random checks with indecipherable royalty statements every few months!

Comments (69)

Reviews of Beginning Ruby Across the Web

With this post I want to keep track of some of the “Beginning Ruby” reviews made on other blogs over the years:

About.com’s Review – “Beginning Ruby is an excellent choice for any beginning Ruby programmer. In the face of established competition, Beginning Ruby holds its own and remains a good choice.”

Larry Wright’s review – “I think Beginning Ruby: From Novice to Professional is a better first Ruby book than the venerable Pickaxe.”

29 reviews on Amazon.com – 26 of which are 5 stars; 3 are 4 stars.

Pat Eyler’s review – “Beginning Ruby is a great book for a new programmer, or a programmer new to Ruby. It’s a great alternative to the other beginner’s books on Ruby out there.”

Hendy Irawan’s review

Stephen Bartholomew’s review – “Even with a language like Ruby, teaching complete novices how to program is no mean feat. Peter Cooper’s new book ‘Beginning Ruby’ attempts to take the complete beginner through being a competent programmer.”

Huw Collingbourne’s review – “Once again, then, I can recommend this book as a good introduction to the fundamentals of Ruby programming and its updated section on web development frameworks is welcome.”

Review on Slashdot – “It’s a good book for someone who wants to learn Ruby as his first programming language. It could be better. I liked Cooper’s patient and thoughtful explanations about installing Ruby and RubyGems, how to use a command line, and what a text editor is for. Cooper supplies answers to all the typical Ruby-nuby questions, but his explanation of basic concepts is marred by the occasional confusing reference to advanced or even irrelevant topics. For the experienced programmer who learns best by reading and working through examples this book is a good choice. Dave Thomas’ Programming Ruby, The Pragmatic Programmer’s Guide (a.k.a. the Pickaxe) is a tough competitor, but each book has a considerable amount of material that is not found in the other book. For example the Pickaxe’s core library reference is exhaustive but it has only a limited amount of the kind of tutorial explanations that is Beginning Ruby’s strength.”

Leave a Comment

Beginning Ruby’s Table of Contents


  1. Let’s Get It Started: Installing Ruby
  2. Programming == Joy: A Whistle-Stop Tour of Ruby and Object Orientation
  3. Ruby’s Building Blocks: Data, Expressions, and Flow Control
  4. Developing Your First Ruby Application
  5. The Ruby Ecosystem and Community
  6. Classes, Objects, and Modules
  7. Projects and Libraries
  8. Documentation, Error Handling, Debugging, and Testing
  9. Files and Databases
  10. Deploying Ruby Applications and Libraries
  11. Advanced Ruby Features
  12. Tying It Together: Developing a Larger Ruby Application
  13. Web Application Frameworks: Rails, Sinatra, and Ramaze
  14. Ruby and the Internet
  15. Networking, Sockets, and Daemons
  16. GUI-Based Desktop Application Development
  17. Useful Ruby Libraries and Gems


  • APPENDIX A Ruby Primer and Review for Developers
  • APPENDIX B Ruby Reference
  • APPENDIX C Useful Resources

Comments (2)