The Complete Guide to Avoiding and Fixing Common Rails 3 Code and Design ProblemsAs 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(TM) 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 withModel layer code, from general object-oriented programming violations to complex SQL and excessive redundancy Domain modeling, including schema and database issues such as normalization and serialization View layer tools and conventions Controller-layer code, including RESTful code Service-related APIs, including timeouts, exceptions, backgrounding, and response codes Third-party code, including plug-ins and gems Testing, from test suites to test-driven development processes Scaling and deployment Database issues, including migrations and validations System design for "graceful degradation" in the real world
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.
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.
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.
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.
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.
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.
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.
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.
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.
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..
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.
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.
Книга будет полезна не только новичкам, но и состоявшимся разработчикам. Есть довольно интересные решения по рефакторингу и оптимизации Rails-приложений.