Menu Sidebar
Menu

Avdi Grimm

Hacker; code documentarian.

Smalltalk Best Practice Patterns

Another Take on Smalltalk-Style Controll Flow (SBPP #6)

The latest Smalltalk-to-Ruby translation in my SBPPRB archive is “Dispatched Interpretation”. It’s one of the bigger ones I’ve tackled so far. I’m not going to go over the whole pattern here; for that you’ll just need to buy a copy of Smalltalk Best Practice Patterns :-) However, one potentially interesting snippet is this one: class […]

Declarative Keyword Parameters in Ruby (SBPP #5)

Reading SBPP has got me thinking about keyword parameters. Ruby doesn’t have keyword arguments, but it fakes them pretty well: def explain(options={}) “the #{options[:the]} says #{options[:says]}” end explain the: “pig”, says: “oink” # => “the pig says oink” explain the: “frog”, says: “ribbit” # => “the frog says ribbit” Which is fine, but it isn’t […]

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 verbose by comparison: (I’m using multiple taps in order to exactly mimic the semantics of […]

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 idea that we’d all build our apps out of reusable off-the-shelf objects. As Beck notes, […]

Older Posts

Virtuous Code

"The three virtues of a programmer: laziness, impatience, and hubris" — Larry Wall

Books and Screencasts

RubyTapas Screencasts

RubyTapas Screencasts

Small plates of gourmet Ruby code.

Confident Ruby

Confident Ruby cover

32 Patterns for joyful coding.

The Making of Cowsays.com

Confident Ruby cover

Watch me build an app in Sinatra and Rails

Objects on Rails

Objects on Rails

A developer notebook on applying classic Object-Oriented principles to Ruby on Rails projects.

Exceptional Ruby

Exceptional Ruby

The definitive guide to exceptions and failure handling in Ruby.

Archives

Categories