Books & Tools Techniques

Comprehensive coverage of Ruby 1.8 and 1.9

"The New Most Important Ruby Book"
Peter Cooper,
rubyinside.com

Completely updated for Ajax and Web 2.0

"A must-have reference"
Brendan Eich,
creator of JavaScript

Jude

Jude is my Java documentation browser. It combines Sun's definitive javadocs with the easy-to-use format of Java in a Nutshell, and tops it off with easy keyboard-based navigation and full-text searching.

Jude is available for free evaluation.

See the user's guide for more info

Java in a Nutshell

The 5th edition is now out, with complete coverage of Java 5.0!

It includes a fast-paced tutorial on the language, and a compact quick-reference for the core Java API.

Java Examples in a Nutshell

The 3rd edition, updated for Java 1.4

This edition has all-new coverage of the NIO and JavaSound APIs, completely rewritten Servlets and XML chapters, and coverage of new Java 1.4 features (assertions, logging, preferences, SSL, etc.) added througout. A great book for those who like to learn by example. 193 working examples: 21,900 lines of carefully commented code to learn from.

Java 1.5 Tiger: A Developer's Notebook

Amazon incorrectly credits me as the main author on this book. I'm actually the second author: really more of a consultant. This is a good book about all the language changes in the latest version of Java.

Effective Java

I didn't write this excellent book, but I wish I had.

Author Josh Bloch is probably best known for the collections classes in the java.util package. His experience and wisdom are apparent in this book. I learned from it and recommend it highly.

August 07, 2008

Method Chaining Part 2

The comments on my last post about method chaining in JavaScript were spectacular, and I want to publicly thank all who took the time to read my code and think about it. The final version of the code (which you can see below the fold) is much stronger thanks to their comments.
--- more ---

July 31, 2008

Method chaining in JavaScript inheritance hierarchies

In the 5th edition of my JavaScript book I made the embarrassing mistake of recommending a constructor and method chaining technique that only works for shallow class hierarchies--it works when class B extends A, for example, but not when C extends B and B extends A.

The technique I recommended was to put a superclass property in the prototype object of a class, and then to chain to a superclass constructor by calling this.superclass(). To see why this fails, imagine that we're creating an instance of class C (which extends B which extends A). The constructor C() chains to B() by calling this.superclass(). The constructor method B() is invoked on the same instance of C, however, so when it attempts to chain to A() by calling this.superclass(), it just ends up invoking itself. This incorrect chaining technique is discussed in sections 9.5.1 and 9.5.2, and is also used in example 9-10 and 9-11 at the very end of the chapter. I blogged about this mistake and a possible workaround almost two years ago.

Now, however, O'Reilly is preparing to do a reprint of the book, and I have an opportunity to fix this mistake. Below is a revised code from examples 9-10 and 9-11. I've renamed the defineClass() method to Class() and have modified it so that it automatically does constructor chaining (I was inspired by dojo for this change). More importantly, I've simplified method chaining by defining a global method named chain() for method chaining. If a method overrides a method defined by a superclass (or a "mixin" class) it can invoke that overridden class by invoking chain() like this: chain(this,arguments). (The second argument must be the arguments array of the overriding method, and the first argument must be the object on which that method was invoked.)

The code is below the fold. I think this is interesting JavaScript, and I'd love to have it checked for errors before it goes into print again... Please leave a comment if you think it could be improved! Update: comments are now closed; spammers have struck.
--- more ---

April 17, 2008

Ruby Review Roundup

The Ruby Programming Language has been gratifyingly well received by readers and reviewers. In addition to glowing reviews at rubyinside.com and slashdot.org, it has been reviewed ten times at amazon.com and I proud to say that all ten reviews give it a five-star rating.

Here are the reviews. For all except the slashdot review, the linked text is the title of the review:

Thanks everyone!

April 14, 2008

Errata for my Ruby Book

I've put together a list of 81 errors and updates to my Ruby book. These are fixed in the next printing. If you already own a copy of the book, however, you can go through and enter the changes yourself, if you are so inclined.

I use O'Reilly's style for describing the changes. Each entry in the file begins with a page number within delimiter characters. The delimiters indicate the severity of the change:

  • Page numbers in parentheses usually indicate typos or other minor non-technical changes. You can ignore these if you want.
  • Page numbers in curly braces indicate minor technical errors that have been corrected
  • Page numbers in square braces indicate more severe technical errors that have been corrected. There are only two of these, but they're worth noting.
  • Page numbers in angle brackets are updates (this differs a bit from normal O'Reilly style) to keep the book in sync with the evolution of Ruby 1.9. In my opinion, these are the interesting ones.

I've posted my list of changes here. They will all eventually appear on O'Reilly's errata page for the book as well.

April 07, 2008

Help fix up my book, please

The Ruby Programming Language is going to be reprinted next week, and O'Reilly has given me SVN write access to the docbook files to fix typos, errors, etc. I've got a list of about 25 relatively minor erros that I'll be fixing, but I'd love to stomp out more bugs on this reprint.

So, if you've got a copy of the book, and have found typos, mistakes or omissions, please let me know. You can email me (david@ this domain) or post them as comments on this blog. (Normally, you'd submit them on the O'Reilly website but since time is factor for this reprint, send them directly to me, please.) Keep in mind that this is just a reprint, not a new edition of the book, so I'm pretty constrained about the kinds of changes I can make. I can't add new sections or figures or tables, or cover brand new topics that aren't currently covered. I can often squeeze in short new paragraphs when they're needed to clarify things or if there is something important that I left out.

Thanks to DH, MD, RM, and DB, all of whom submitted one or more errata to me or to O'Reilly's website recently. I don't have access to the names (or initials) of the others who submitted errata to the publisher's website back in March and February.

Update: Thanks to those (BR, CS, ADS, MD) who commented and emailed me with other errors to correct. I ended up making about 80 changes--half to fix typos and minor errors, and half to update the book to track minor (mostly) changes in Ruby 1.9. I'll post a list of all changes soon.

March 31, 2008

Will C++ get Closures before Java does?

I just read that closures are being added to C++ [PDF link].

A note to Sun: you know your language is falling embarrassingly behind if the C++ standards committee can move more nimbly than you can!

(For those who aren't already sick of reading about closures in Java, Neal Gafter is developing a prototype Java compiler that supports closures, and he even has a JSR proposal drafted and ready to go.)

March 18, 2008

5 Years in Iraq

Tomorrow marks the 5th anniversary of Bush's war with Iraq. The costs:

  • 3990 US soldiers dead That is more than 2 per day.
  • 20,416 US soldiers wounded (badly enough to require air transport). That's more than 11 per day.
  • At least 82,240 civilians killed. That's 45 a day and only includes deaths that get reported in the media. One study puts the civilian death toll much, much higher.
  • $503 billion. That's 275 million dollars a day, and it doesn't include future obligations, such as veteran's health care. (Nobel laureate economist Joseph Stiglitz argues that the war has already cost 3 trillion dollars.)

The blood of 2 soldiers and $275 million down the drain today and tomorrow and the day after.... With no end in sight.

Our elected representatives seem uninterested in stopping this war, but these candidates for the US House of Representatives have a responsible plan to end the war. It is remarkably sane and it is the only glimmer of hope I've had in a long time.

March 03, 2008

Welcome Slashdot Readers

If you arrived here after reading slashdot's review of The Ruby Programming Language, you've come to the right place. Thanks, Brian, for the kind words! The post below includes links to the book's table of contents and to an interactive preview.

Advertising
About
Store
Search
Google
Web this site
Archives
Syndicate

Powered by
Movable Type