Tuesday, March 2, 2010

J.B. Rainsberger - Primitive Obsession

Note: I am in the process of working with the 5by5 network to begin a regular video and audio podcast. This podcast will contain the bulk of the interviews and videos that I'll be doing while I travel around on the coreyhaines coderetreat tour 2010. Until the details have been sorted out, I will be posting them on this blog, similar to how I did last year. fI you are new to the interviews, please check the archives of this blog to see other great content.

While in Romania, facilitating the Bucharest Coderetreat, I had the opportunity to teach a Test-Driven Development class with J.B. Rainsberger. We've talked about teaching together for many years, and I'm honored to have finally had the opportunity. If you have watched the videos that I did last summer with J.B., you'll know that he has an amazing amount of experience and insight into the development process. He has an ongoing blog called 'The Code Whisperer,' which has consistently thought-provoking content on design, testing and other coding techniques. If you haven't watched them, I urge you to look through the archives for them, as his thoughts on test-driven development are enlightening.

Whenever I have time with J.B., I do my best to get some videos recorded with him covering whatever might be of interest to us at the time. This past opportunity was a goldmine, as, not only did I get 3 videos, but we also used ustream to live-stream the interviews. While I was copying onto my computer, J.B. was kind enough to do impromptu Q&A sessions with the people viewing.

This is the first of those video interviews, focusing on the often-mentioned, more-often-misunderstood topic of 'Primitive Obsession' in design.

Enjoy! As always, constructive feedback is welcomed in the comments. If you are so inclined, please write a blog post with your thoughts.

Coming next week: Gary Bernhardt discusses some of the differences between the ruby and python cultures.

JB Rainsberger - Primitive Obsession from Corey Haines on Vimeo.

3 comments:

  1. Great interview as usual! Full response on my blog at http://silkandspinach.net/2010/03/03/primitive-obsession-or-open-secret/.

    ReplyDelete
  2. Great interview. I was a little confused when you brought up "the Type is not the Class" concept. It sounded almost like a contradiction of J. B.'s "Whole Value" concept. It seems to me that treating a string as a list of email addresses is not a good practice and that string really *should* be wrapped in a new class. Did I hear that wrong?

    ReplyDelete
  3. Jason,

    Good point.

    The concept is that the initializing class is just that, an initializing class. The type could be considered as the set of interactions that are allowed, how the other parts of the code deal with it.

    "Wrapping in a new class" is one technique for providing new behaviors to an existing object. Other languages, though, provide alternate mechanisms, such as mixins and prototypes.

    So, in this case, you aren't treating a 'string' as a list of email addresses, you are treating the object as a list of email addresses. The object's available behaviors can be shifted at runtime.

    In class-oriented languages, such as Java and C#, you have a much tighter coupling between the concept of 'class' and 'type' due to a limited set of object evolution mechanisms.

    ReplyDelete

Please don't post anonymously; I won't use your name/url for anything insidious.
Comments by Anonymous are not guaranteed to make it through moderation.
Constructive comments are always appreciated.