Pawel Duda github twitter

Practical Object Oriented Design in London

30 June 2014

Between 25-27 June 2014 I had the pleasure of attending a 3-day course of Practical Object Oriented Design facilitated by Sandi Metz (@sandimetz) and Matt Wynne (@mattwynne).

Here’s what I learned.

##DAY 1 In the morning, we were given red tests and asked to implement a solution without worrying too much about the design (“shameless green”)

In the next exercises we started with a dirty, simple and green solution (the state we called “shameless green”) and worked on refactoring to remove the duplication

Horizontal vs Vertical Refactoring (http://www.threeriversinstitute.org/blog/?p=594)

Names

Other

##DAY 2

Squint test

Small pieces

When to extract classes

e.g.

def next_number_of_bottles(number_of_bottles)

…refactor into…

number_of_bottles_object = NumberOfBottles.new(number_of_bottles)
number_of_bottles_object.next

How to extract classes from the small methods created by “Find the things most alike, make them more alike”

Now that all the methods arguments are gone, we can replace conditionals with polymorphism:

Inheritance

Inheritance doesn’t cause problems when

##DAY 3 SOLID principles

Refactoring

Inheritance

Roles in ruby

is_a (inheritance) behaves_like (duck types) has_a (composition)

##RELATED LINKS

##SUMMARY If you get a chance to attend this course, do not hesitate!

ps: please know that all the points made in this post mirror my understanding of what we practised in the course and may not fully represent Sandi’s and Matt’s thoughts on the subject