Jump to ratings and reviews
Rate this book

Addison-Wesley Professional Ruby Series

Rails AntiPatterns: Best Practice Ruby on Rails Refactoring (Addison-Wesley Professional Ruby) by Chad Pytel

Rate this book
The Complete Guide to Avoiding and Fixing Common Rails 3 Code and Design Problems As developers worldwide have adopted the powerful Ruby on Rails web framework, many have fallen victim to common mistakes that reduce code quality, performance, reliability, stability, scalability, and maintainability. Rails AntiPatterns identifies these widespread Rails code and design problems, explains why they’re bad and why they happen—and shows exactly what to do instead. The book is organized into concise, modular chapters—each outlines a single common AntiPattern and offers detailed, cookbook-style code solutions that were previously difficult or impossible to find. Leading Rails developers Chad Pytel and Tammer Saleh also offer specific guidance for refactoring existing bad code or design to reflect sound object-oriented principles and established Rails best practices. With their help, developers, architects, and testers can dramatically improve new and existing applications, avoid future problems, and establish superior Rails coding standards throughout their organizations. This book will help you understand, avoid, and solve problems with

Paperback

First published August 16, 2010

32 people are currently reading
310 people want to read

About the author

Chad Pytel

3 books2 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
93 (32%)
4 stars
117 (40%)
3 stars
65 (22%)
2 stars
11 (3%)
1 star
2 (<1%)
Displaying 1 - 26 of 26 reviews
Profile Image for Katherine.
149 reviews
September 25, 2013
Some antipatterns discussed are now irrelevant for those using Rails 3.2 or later versions (see migrations). Metaprogramming is nice but not readable. Sphinx is no longer preferred given efficiency of Elasticsearch. I DISAGREE WITH THE STUPID HAML CODE RECOMMENDATION. JUST TOO USELESS. Overall, I think it is well-written but requires updates and some solutions have to be ignored.
Profile Image for Ed Limonov.
13 reviews
November 7, 2019
Really enjoyed it, it was surprisingly easy to read. Explained all the rules and PRINCIPLES well. I was thinking about our production code all the time while reading it.
Profile Image for Tumas.
4 reviews17 followers
February 9, 2014
If you have been working with Rails for a year or two, you probably already know 90% of the anti-patterns presented in the book. Great read for devs new to the framework although one should keep in mind that most ruby gem recommendations are outdated.
Profile Image for Dave Bolton.
192 reviews95 followers
November 22, 2011
Nothing very profound, but probably useful to a new/mid level Rails developer.
Profile Image for Fernando Contreras.
19 reviews
August 2, 2018
Leyendo este libro, miras los errores mas comunes en Rails, como los patrones pueden ayudarte a refactorizar tu codigo y volverlo mas entendible. Excelente libro si ya tienes algunos meses utilizando Rails y quieres mejorar la calidad de tu codigo, pero sobre todo, entender logica para abstraer las cosas.

El concepto de refactorizar es excelente, pero no todo siempre necesita ser refactorizado, el programador busca que su codigo sea legible y que haga sentido a lo que dice hacer.
Profile Image for Anton Antonov.
351 reviews48 followers
July 26, 2024
Years ago, I was curious to become a good Ruby on Rails engineer then.

While these patterns were slightly dated at the time of reading the book, the problem with it is that it's just very long to get to the very simple and generic points.

It's padded up, I'd say. Nowadays, just go to https://github.com/rubocop/rails-styl....
Profile Image for Dan.
Author 3 books9 followers
June 23, 2017
The recommended solutions to these antipatterns would only be considered best practices in the backwards idiocracy that is the Rails ghetto.
Profile Image for Jason.
350 reviews14 followers
December 1, 2019
Had some dated references to libraries, but in general a solid all around guide to small anti-pattern refactors. Worth keeping around as a reference.
18 reviews1 follower
May 24, 2021
Pretty obviously dated but a lot of stuff in it holds up well. All in all a pretty good book on Rails design patterns and refactoring.
Profile Image for Youssef Ragab.
9 reviews9 followers
February 22, 2012
We at Trustious have opted for rails as the framework of choice. We went through the regular rails learning curve but eventually started to get that feeling of "Are we doing it right?" ... that is until we found this book! There are several good references out there on the basics and details of building a web application in rails. They do a good job getting you up and running but when it comes to design patterns and best practices, most of them leave you in the dark. This is where this book comes in. The book presents the most common "mistakes" or "anti patterns" that rails developers fall for and presents quality solutions to them. The anti patterns are thoughtfully classified according to area i.e. models, views, controllers, services, testing, databases, deployment among others. I strongly recommend this book for any serious rails developer.
Profile Image for Rob Warner.
288 reviews3 followers
February 1, 2011
Once you learn all the things you CAN do with technology, and muddle around with mistakes, you're ready to learn what you SHOULD do. Rails AntiPatterns presents common mistakes that Rails coders make, and then explains one-to-many better alternatives for solving the same issues. The book is easy to read, has solid code examples, and explains WHY the alternatives it presents are better. I read this cover-to-cover, and plan to keep it accessible and refer to it often. Must-read for Rails developers.
Profile Image for Dave Golombek.
287 reviews15 followers
August 16, 2011
This book has a pretty signal to noise ratio, lots of good advice and not much wasted space. The code samples are about the right size (although there are a lot of minor bugs in them, missing "nots", etc) and illustrate the concepts well. The choice of patterns and solutions match well with what I run into on a regular basis, and even when the suggested pattern is one I already know well, there was usually a tidbit in the response that taught me something new. Lots of Thoughtbot gems were recommended, no big surprise there, but they're popular for a reason.
Profile Image for Bjoern Rochel.
398 reviews83 followers
January 4, 2015
A good compilation of smells and design flaws found in common Rails applications. However I think that someone who has spend a year with rails probably shouldn't be surprised by most of the suggested practices and refactorings. Looks like daily business to me.

The one chapter that really stood out though was the one about testing. There's definitively something to take away from this chapter, even if you've been doing Rails development for years.
Profile Image for Eric Brooke.
111 reviews18 followers
July 5, 2013
A really good book. Demonstrates computer science concepts and puts them into Rails/Ruby context/language. I particularly like that the authors show an example what is wrong with it and then show several examples/steps how to solve the problem. It is a hard book to just read through but is an excellent reference. I look forward to the Rails 4 update..
Profile Image for Jason.
3 reviews
May 6, 2012
This book is something that every new rails programmer should go through once when they first start and then once about two years in to their development. This book shows many of the common screw ups of a rails app and how to fix them.
Profile Image for Hector.
9 reviews
April 13, 2011
Strongly recommended for Rails developers looking for an intermediate-level Rails book.
Profile Image for Jamie.
133 reviews1 follower
March 27, 2011
Has some great examples and real practical advice that is applicable to all code, not just Rails!
Profile Image for Brendon.
2 reviews
May 7, 2011
Mostly good advice. Not sure if it's the kindle edition to blame, but the number of egregious code errors I recall while reading was really bad, though. 2.5 stars.
Profile Image for Artur Sabirov.
60 reviews5 followers
February 3, 2012
Книга будет полезна не только новичкам, но и состоявшимся разработчикам. Есть довольно интересные решения по рефакторингу и оптимизации Rails-приложений.
37 reviews1 follower
September 26, 2012
Great intro to Rails good-practices with a little background to thing to-do and not-to-do in your rails code.
1 review
Read
October 23, 2015
Really an awesome books. It helped me improve my rails thinking.
Displaying 1 - 26 of 26 reviews

Can't find what you're looking for?

Get help and learn more about the design.