- Amazon Student members save an additional 10% on Textbooks with promo code TEXTBOOK10. Enter code TEXTBOOK10 at checkout. Here's how (restrictions apply)
Rails for Java Developers Paperback – Feb 23 2007
Special Offers and Product Promotions
No Kindle device required. Download one of the Free Kindle apps to start reading Kindle books on your smartphone, tablet, and computer.
To get the free app, enter your e-mail address or mobile phone number.
About the Author
Stuart Halloway is a member of Clojure/core and CTO at Relevance, where he spends his time on secret projects for world domination, and watching Phineas and Ferb.
Most Helpful Customer Reviews on Amazon.com (beta)
Love it or hate it, Rails is a platform that is geting a lot of atention these days, and a competent softare engineer cannot afford to *not* have an opinion on it... The evolution of Java is being heavily influenced by ideas from this community. And why not? Good ideas ae good ideas, no matter where they come from. Clearly, Rails contains concepts that can be 'borrowed' and brought over into Java with great success - one just has to look at the landscape of recent open source projects to see this in action (and of course, a lot of these ideas were borrowed from the Java community in the first place).
So, if you are a developer who has cut his teeth for years on Java, what is the shortest path to get up to speed with Rails? I have to recommend this book. It explains both Ruby and Rails by comparing and contrasting to things you are already familiar with from your Java experience. The authors are also exceptional presenters and writers - the book is written well and the ideas are clearly refined from battle-testing as presentation and classroom materials.
Specifically, the authors' coverage of the Ruby language is quite good in terms of being very clear and leading the reader from an understanding of how to write Java-style to Ruby to a deeper level of being able to write more idiomatic Ruby code. The coverage of ActiveRecord and Hibernate is quite informative, although it doesn't get into any of the approaches to caching data in Rails, it is a good introduction to the differences (Rails tends to cache views). The section on Controllers using Struts is enough to make me wish I never see another routing configuration xml file again.
One of the primary differences between Java web applications and Rails web applications is that the Java web apps tend to use a lot of configuration files written in XML. While type safety is often listed as something people like about statically typed Java, the book should point out that all of this XML plumbing is not quite type safe either. The magic of Ruby's dynamic nature and more complete object oriented features such as duck typing and mixins help provide an escape for this, where the story is really all in the code.
All in all, this is a very readable technical book. It's a quite a bit more than a reference manual and is filled with generous nuggets of wisdom that have already made me a better developer.
Halloway and Gehtland provide a tutorial to learning Ruby and Rails by examining similarities with Java. The tutorial progresses by providing examples in both Ruby and Java using popular Java frameworks. The introduction of Ruby and Rails concepts by juxtaposing them with similar concepts implemented in Java is comforting for the developer who may feel a little intimidated by the differences between the languages. Working through the book, the Java developer will learn the basics about creating and deploying Ruby on Rails applications, picking up an exciting new language along the way.
The first three chapters introduce the Ruby programming language. This is the best Java-centric Ruby introduction that I've seen and it's something I wish I had available to me when I was first learning the language. The rest of the material covers the basics of Rails applications as well as web services and security issues. I found the chapters on testing and automating the development process to be particularly good.
The approach this book takes may not be suitable for everyone. After a certain point, I found that the constant juxtaposition of the Java way of accomplishing a task with the Ruby on Rails way of accomplishing a task wore a bit thin. I found myself just trying to skip past the Java bits to get on with the Ruby. Still, I found the book to be quite good overall. If you are an experienced Java developer seeking a gentle introduction to Ruby on Rails, you can't do better than "Rails for Java Developers".
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.
The other thing I like about this book is that they cover the complete picture, not just Rails. There are chapters devoted to Ruby, ActiveRecord, Rake, security and testing - all from a Java Developer's point of view. Through this book Stu and Justin correctly point out that it doesn't have to be an either-or situation. This is not a "one-size-fits-all" world. They are right - and that is the main reason you should read this book. Read this book to expand your knowledge, grow in your career, and learn not only how to code in Rails but how to be a better Java Developer as a result.
Look for similar items by category
- Books > Computers & Technology > Computer Science
- Books > Computers & Technology > Databases > Database Design
- Books > Computers & Technology > Databases > Java & Databases
- Books > Computers & Technology > History & Culture > Privacy
- Books > Computers & Technology > Internet & Social Media
- Books > Computers & Technology > Networking & Cloud Computing > Data in the Enterprise > Client-Server Systems
- Books > Computers & Technology > Networking & Cloud Computing > Network Security
- Books > Computers & Technology > Programming > Java
- Books > Computers & Technology > Programming > Languages & Tools
- Books > Computers & Technology > Programming > Software Design, Testing & Engineering > Software Development
- Books > Computers & Technology > Programming > Software Design, Testing & Engineering > Testing
- Books > Computers & Technology > Software
- Books > Computers & Technology > Web Development > Programming
- Books > Textbooks > Computer Science & Information Systems > Computer Science
- Books > Textbooks > Computer Science & Information Systems > Database Storage & Design
- Books > Textbooks > Computer Science & Information Systems > Programming Languages