Prime Refactoring: Ruby Edition – Intimatenights.co.uk
Programmers can transform even the most chaotic software into welldesigned systems that are far easier to evolve and maintain What's , they can do it through a series of simple, proven steps This book features Ruby examples and idioms throughoutnot code adapted from Java or any other environment Excellent introduction to the discipline of refactoring You'll see these lessons reappear everywhere both in your code and in other learning materials Part of the canon of programming (and now without all the Java!)Favorite quote: How will you know when you are really getting it? When you start to calm down When you feel absolute confidence that no matter how screwedup someone left it, you can make the code better, enough better to keep making progress. Why I started reading it: The non Ruby version was recommended to me some time ago by a senior developer I respect a lot I’m still new to Ruby and don’t know how to make Ruby code pretty, so though this could help.What I liked about it: That it was so easy and fun to read Usually I dread reading technical books a little, cos I think they will be all dry and a bit boring I think reading this book helped with that fear I liked that it discussed the refactorings in context of object oriented design and how they would help to get the key components of it right What I disliked: Maybe it was a little too easy to read A lot of the concepts and advices seemed common sense It was nice to get the confirmation that I’ve already learned a thing or two in my career I think struggling with the ideas a bitwould have meant I’m gettingout of it Also the structure of the book was a bit confusing I read it from cover to cover And the names of the refactorings were used in the beginning, before being introduced I actually googled a lot to fully understand thing without being aware they will be explained in later chapters. There's some good stuff and some not so good stuff in here.The discussion about the refactoring principles and process are excellent It ties in well with the explicit mechanics of the refactoring, which is about being able to take small, behaviourpreserving steps.Some of the examples are suspect though The authors point out that the refactorings are not designed to demonstrate a business model, but some of the use of Mountain Bike classes just seem way off Also, while they don't fully factor all code in the catalogue, the example in chapter 1 is clearly unfinished It would have been a lotcompelling if they'd carried it on until all the duplication was removed.Some of the refactorings are hard to carry out without breaking behaviour I wrote RSpec examples for a few, and the order of the steps makes it hard to apply the refactorings without extended periods of test failure Unfortunately, while the authors repeatedly emphasise the importance of writing tests and running them frequently, they don't actually provide any (as far as I can tell, there are no downloads for the book).An annoyance is that there are lots of typos, in the code and text, and references to things that don't exist (eg the missing table inside the back cover).In terms of Ruby, there are some excellent examples of Rubyspecific steps to rescue badly/inappropriately metaprogrammed code, and some interesting uses of Ruby modules But the book is often biased towards inheritance I've found from experience that inheritance is very rarely needed in Ruby, and I'd be inclined to rip out all the examples that introduce it (or at least flag them as lastresort refactorings).Good stuff, but given it was written a decade after the first (Java) edition, it still feels like it could bepolished, uptodate, and Rubyspecific It needs a second edition to fix the typos and other simple errors, and hopefully tighten up the rest. Nothing revolutionary to any experienced programmer, but a nice confirmation of how to do refactoring Ruby style.It's a great book to have in the office for starting discussions about how a piece of code should look.I flew through the first 100 or so pages, but the catalogue of patterns stopped me dead That section of the book deserves to be read in small chunks as you find offending code in your own codebase.I read the original version in Java but I feel like I gotout of the Ruby version Perhaps it's experience and perspective.