Ruby Science: thoughtbot's guide to building quality Ruby on Rails applications

    thoughtbot (with a small letter) is one of the leading American consulting firms focused on web development using Ruby on Rails. thoughtbot operates a business model common in this environment, and earns not only from consulting, but also from its large contributions to Open Source , active participation in the community (for example, the Giant Robots Smashing into Other Giant Robots podcast ), educational activities ( workshops , mentoring ), domestic products and literature .

    On their account to this day there were two full books: The Playbook- A comprehensive guide to thoughtbot's internal routines and labor tricks (free to learn on their website), and Backbone.js on Rails - an equally comprehensive guide to using the Backbone JS framework with Ruby on Rails.

    An interesting feature of their approach to publishing books. This is not a static work, written once, printed on paper and becoming obsolete over the years, but a product that supports versioning, develops under the influence of readers and is accompanied by various electronic buns, including an example code ready to use. The "source" books are stored on github, which means that at any time the reader has the opportunity to get the latest release, report a problem, discuss any part of the text, etc.

    Today theyannounced the start of work on a new book called Ruby Science. The reference for writing fantastic Rails applications. " Moreover, you can start reading the book and take part in its development right now. People come to Ruby on Rails in search of a framework that allows them to make really fast, interesting and supported applications. But over time, any project becomes overgrown with a thick layer of a wide variety of code, which is becoming more difficult, expensive and painful to maintain. The authors of the book offer you their view on the essence of such problems, as well as a collection of recipes for their detection, elimination and prevention. Content currently claimed is very, very






    a juicy selection of diverse best practices that can greatly help you and your team. Unwritten chapters are marked with an asterisk. A short preview of the book can be found here .

    Content


    Introduction

    Code Smells

    • Long method
    • Large class
    • Feature Envy *
    • Case statement
    • High Fan-out *
    • Shotgun surgery
    • Divergent Change *
    • Long parameter list
    • Duplicated code
    • Uncommunicative Name *
    • Parallel Inheritance Hierarchies *
    • Comments *
    • Mixin *
    • Callback *


    Solutions

    • Replace Conditional with Polymorphism
    • Replace conditional with Null Object
    • Extract method
    • Extract Class *
    • Extract Value Object *
    • Extract Decorator *
    • Extract partial
    • Extract Service Object *
    • Introduce Observer *
    • Introduce Parameter Object
    • Use class as Factory *
    • Move method *
    • Inline class *
    • Inject dependencies *
    • Replace mixin with composition *
    • Use convention over configuration *
    • Introduce Visitor *


    Principles

    • DRY *
    • Single responsibility principle *
    • Tell, Don't Ask *
    • Law of Demeter *
    • Composition over inheritance *
    • Open closed principle *
    • Dependency inversion principle *


    Thoughtbot's love of researching and documenting my own workflow has been affecting me for a very long time, and it started with a couple of their gems and reading Backbone.js on Rails. They are able to provide a dry squeeze from their daily work, allowing the reader not to step on various painful rakes. Therefore, I could not get past this announcement for no reason. I strongly recommend that all rubists follow this reading, and indeed the thoughtbot. By the way, until the end of January, a 20% discount will hang on the book.

    Also popular now: