Skip to content

Instantly share code, notes, and snippets.

@tooky
Created October 5, 2012 15:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tooky/3840466 to your computer and use it in GitHub Desktop.
Save tooky/3840466 to your computer and use it in GitHub Desktop.
BritRuby Talk Proposal - East Oriented Rails

Steve Tooke: East Oriented Rails

James Ladd proposes a compass that we can use to navigate our object-oriented designs. We move North as we travel up a layer, South as we travel down a layer. West will take us away from the object, and East moves us towards another object.

James suggests that we orient our code so that we are always travelling East. In practice this means that code should follow these rules:

  1. All public methods return nil, boolean or return a reference to the current object (self).
  2. Objects that implement the Factory or Builder pattern or similar are an exception.
  3. East is better suited to composite objects, not primitive objects (James doesn’t make this distinction).

Join me as I learn what happens if you build a rails application that is completely East oriented. Does it produce a code base that's easy to change and easy to reason about? What affect does it have on the normal rails MVC architecture? Does it make testing harder?

I will present examples from a real code base that is built using this approach. I'll share the lessons I learned from taking this approach and some practical tips for moving an existing code base east.

Steve Tooke

Steve has been getting paid to write software since 1997. Since then he's always been looking for ways to help him do it better. This led him to discover Ruby and Rails 2005. In 2011 Steve co-founded Heavies Limited with Spencer Turner to help other companies and teams build better software. Steve occasionally blogs at http://tooky.co.uk, and tweets as @tooky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment