Simply put, I wish that I had been able to read Stu Halloway and Justin Gehtland's Rails For Java Developers before I began on my own journey of learning Ruby and Rails after a professional life of Java development. If you are looking for a book that cuts through the hype to a commendably unbiased comparison of the web development environment in these two great languages, look no further.
With "Rails is not for everything" on the first page of the preface, the book identifies its audience as informed Java developers who haven't necessarily made up their minds about Ruby and Rails. To paraphrase the authors, however, Java programmers have lived through a lot of the struggles that Rails attempts to address. Through showing how and explaining why this is the case, this book serves as an excellent guide for those of us willing to investigate a new technology for web development.
When you buy a new car, the first step is the test drive. In the same way, Chapter 1 is like a test-drive of a "car" unlike any you've ever been in as a Java developer. The tour is as brief as possible while still exposing the reader to all of the ideas that the rest of the book fleshes out. In fact, for those who found any particular topic instantly appealing, the book provides an instant reference for where to turn next.
After any test drive invigorating enough to get you to purchase the vehicle, the dealer will often sit you in the drivers seat and point out where everything is in the unfamiliar cockpit. Chapter 2 is much the same, showing how familiar concepts in the Java language are expressed in the Ruby language. The chapter contains ten sections on topics ranging from the basics of primitive types and arrays to control flow and exception handling. This sets the stage for Chapter 3 where the authors explore those aspects of Ruby that either have no clear analogue in Java or are essentially unrecognizable.
In Chapter 4, the authors crack the hood and show you just how different Hibernate and ActiveRecord are from a developer's perspective. There are a lot of differences, and I feel this chapter will be the first that begins to give the reader an idea about whether they'll enjoy the Rails framework as a whole. The "Rails Way" begins to become visible and stands in stark contract to the choices that Hibernate makes in its own implementation. The authors' aim is to compare these two frameworks without bias, and they succeed.
A comparison of Struts and ActionController is the focus of Chapter 5. Struts' status as the lowest-common-denominator of the Java frameworks that specialize in communication with web forms led to its inclusion in this chapter. Again the authors walk through a simple example, illustrating the differences in approach. Many of Rails' optimizations towards developer simplicity come at a cost of application performance. An investigation at the end of this chapter provides an estimation of the ultimate cost of those tradeoffs.
Chapter 6 focuses on rendering HTML, where the Java developer space is somewhat more fragmented. As a result, a lot of the Java material focuses on general concepts, while the Rails material is focused on some of the most advantageous elements of the Rails stack-- specifically AJAX and RJS. I do find it to be a bit strange that the authors took the time to discuss Markaby, which, to my knowledge, is not very widely used at all.
Testing is the focus of Chapter 7. Although treatment of rcov and the "dummy objects" make this a useful section even for intermediate Rubyists, I'm a bit surprised that the authors did not focus more specifically on Rails testing. One of the central tensions in the book (and between outspoken practitioners of both languages) is the attitudes that the respective communities have towards choice. Perhaps more than in any other area, the submission to "opinionated software" reaps considerable rewards when testing Rails code.
Chapter 8 deals with the development process itself, focusing on build tools like Rake and Ant, and continuous integration tools like Cerebus and CruiseControl. The authors do not spend as much time on the inner workings of those libraries as they do on the Rails libraries. That's understandable, because uses of a build tool are myriad; this book is meant to be an introduction. If build tools and deployment are areas of interest for you, you'll likely need other resources to become more familiar with the breadth of offerings on both the Java and Ruby sides. My experience tells me that Rake is more expressive than Ant, but there's certainly a learning curve for both.
Chapter 9 concerns Web Services and XML. There are many ideas discussed in this short chapter, because this topic is getting attention in different ways among leading Ruby and Java programmers. There is a lot of enthusiasm for REST on the part of many Rails developers, and so the authors provide a brief overview of what REST is, and how Rails supports it. Java developers have to parse XML in many different contexts, and there's a lot of work that has gone into developing a useful and highly efficient stack for processing XML data. As a result, comparisons and contrasts dominate the chapter.
Chapter 10 deals with security and doesn't include too much treatment on the Java side. It seems to be a defense of Rails against some common attacks. While I do feel that's useful information, especially for any reader in a discussion with his manager, it seems that Ruby security libraries are not yet as mainstream as those of Java, such as Acegi.
If you've read this far, you should definitely buy the book.