About
Hi! I'm Avdi Grimm, and this is my software development blog. More...
Books and Screencasts
Objects on Rails
A developer notebook on applying classic Object-Oriented principles to Ruby on Rails projects.
-
Subscribe
-
Recent Posts
Archives
Categories
Meta
Tag Archives: patterns
Modeling the World with Prototypes
This post started out as the second half of an article on prototype-based OO design for Gregory Brown’s Practicing Ruby. For an introduction to the prototyped view of the object world, and to follow along on an adventure in making … Continue reading
DisplayCase Gem Now Available
Announcing the display_case gem, an implementation of the Exhibit pattern described in (and extracted from) “Objects on Rails”. Continue reading
Posted in Announcements
Tagged design patterns, exhibit, gems, libraries, objects-on-rails, oor, patterns, Presenter Pattern, ruby
5 Comments
Making Little Classes out of Big Ones (video)
I recently visited the Hashrocket offices in Jacksonville, and while I was there I did a Lunch & Learn talk on the topic of of breaking down too-big classes into smaller pieces. In it I went over pros and cons … Continue reading
Posted in Presentations, Videos
Tagged composition, decomposition, decorators, modules, patterns, refactoring, ruby
Leave a comment
Decoration is best, except when it isn’t
I think by now we all know to prefer composition over inheritance. But in a language with a lot of options, what’s the best kind of composition to use? Composing an adventure Consider an adventure game, with objects representing player … Continue reading
SBPP #4: method Cascades
In Smalltalk, you can “cascade” side-effectful calls to the same object using the semicolon (;) operator. E.g.: If I understand it correctly, the semicolon is effectively a K-combinator or “Kestrel”. I am jealous. Sure, we have Object#tap, but that’s awfully … Continue reading
Posted in Smalltalk Best Practice Patterns
Tagged combinators, kestrel, patterns, ruby, smalltalk
7 Comments
SBPP #3: Reversing Method
I’m pleased to find Kent Beck shares my affinity for methods with a consistent cadence. In the next pattern I translate, he looks for a way to bring a uniform rhythm to a method that writes an object to a … Continue reading
SBPP #2: Smalltalk Patterns in Ruby
Smalltalk Best Practice Patterns continues from the introduction with a brief explanation of patterns. Some notable quotes: About leveraging commonality: “large-scale software re-use has not proven to be the answer”. A lot of the mid-90s OO PR centered around the … Continue reading
SBPP #1: Introduction
The Ruby Rogues are reading Smalltalk Best Practice Patterns for next month’s book club, so I finally got around to ordering a copy. It’s high time, considering that in my experience it’s one of the most consistently recommended programming books … Continue reading
Your Code is My Hell
It occurred to me recently that my experience as a Rails developer may be somewhat unique. I often get brought in to help preexisting Ruby/Rails projects evolve and mature in a sustainable way. As a result, the vast majority of … Continue reading
Posted in Rails, Rants, Ruby
Tagged architecture, design, legacy, maintenance, patterns, ruby. rails
125 Comments
Fowler on Rails
Projects using Ruby on Rails often lack strong distinctions in two main areas: The model/record conflation: Seeing “models” as strictly DB-backed resources. The view/template conflation: failing to draw a line between view objects and HTML templates. The conflations are encouraged … Continue reading
Posted in Ruby
Tagged activerecord, datamapper, Martin Fowler, patterns, Ruby on Rails, templates, two step view
18 Comments




