<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-3466723300364899720.comments</id><updated>2012-02-07T08:01:22.500-05:00</updated><category term='ruby'/><category term='gender'/><category term='ood'/><title type='text'>Sandi Metz</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sandimetz.com/feeds/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/comments/default'/><link rel='alternate' type='text/html' href='http://sandimetz.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/comments/default?start-index=26&amp;max-results=25'/><author><name>Sandi Metz</name><uri>http://www.blogger.com/profile/13364323780338797977</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/-DpVpPSW2Guw/TzEhPNc7skI/AAAAAAAAAYI/ABtohVAnlNg/s220/me_twitter_broader.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>35</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-4265227949646714054</id><published>2012-02-07T08:01:22.500-05:00</published><updated>2012-02-07T08:01:22.500-05:00</updated><title type='text'>I&amp;#39;m certainly no testing expert, so the only a...</title><content type='html'>I&amp;#39;m certainly no testing expert, so the only advice I can tender is what I do myself.  During tests I try to tell a story about how the interface works, which means illustrating normal behavior, edge behavior and error behavior.  &lt;br /&gt;&lt;br /&gt;As a simple example, I would test a method that accepts a number between 2 and 999 by creating a test for inputs 1, 2, 999, 1000 and something random in between.  Since the output is determined by the input, as long as I test the normal, edge and error cases, I have everything covered.&lt;br /&gt;&lt;br /&gt;I&amp;#39;d be interested in other opinions. &lt;br /&gt;&lt;br /&gt;And no, thanks for asking, but I hadn&amp;#39;t planned on discussing this topic in the book.  I was uncertain about covering testing at all, even though (as is probably obvious) it turned out I had more to say about designing tests than I initially imagined.  There&amp;#39;s a fuzzy line between giving advice about design and giving advice about how to test and while I may have unintentionally ventured across it,  I really do mean to leave testing to the experts.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/544174703745012347/comments/default/4265227949646714054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/544174703745012347/comments/default/4265227949646714054'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2012/01/less-design-talk-at-goruco.html?showComment=1328619682500#c4265227949646714054' title=''/><author><name>Sandi Metz</name><uri>http://www.blogger.com/profile/13364323780338797977</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-Y8jYAwLgveU/TzEgZZ9q4EI/AAAAAAAAAXY/n4n7cB1TzRI/s220/me_twitter.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2012/01/less-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-544174703745012347' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/544174703745012347' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1574250197'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-5078009659577266251</id><published>2012-02-02T13:46:12.128-05:00</published><updated>2012-02-02T13:46:12.128-05:00</updated><title type='text'>I am enjoying the great book: Practical Object Ori...</title><content type='html'>I am enjoying the great book: Practical Object Oriented Design in Ruby. In the testing chapter you have the Interface tests but you have not discussed about testing the semantics of the public interface. How do we go about the output and the arguments that must be provided to the public interface? Will you be discussing this in the book?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/544174703745012347/comments/default/5078009659577266251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/544174703745012347/comments/default/5078009659577266251'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2012/01/less-design-talk-at-goruco.html?showComment=1328208372128#c5078009659577266251' title=''/><author><name>bparanj</name><uri>http://www.blogger.com/profile/02462346724508774212</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://www.geocities.com/bparanj/images/U4.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2012/01/less-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-544174703745012347' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/544174703745012347' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1627099000'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-2731976064841397217</id><published>2011-11-04T04:35:36.075-04:00</published><updated>2011-11-04T04:35:36.075-04:00</updated><title type='text'>NIce article, and yes I dont yet feel it in my bon...</title><content type='html'>NIce article, and yes I dont yet feel it in my bones. I guess need to really believe in what i am doing.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/2731976064841397217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/2731976064841397217'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html?showComment=1320395736075#c2731976064841397217' title=''/><author><name>Pankaj Doharey</name><uri>http://www.blogger.com/profile/12590695105739765705</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4607665665916970385' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4607665665916970385' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-554079458'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-4813683417104929419</id><published>2011-11-04T04:33:50.618-04:00</published><updated>2011-11-04T04:33:50.618-04:00</updated><title type='text'></title><content type='html'>This comment has been removed by the author.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/4813683417104929419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/4813683417104929419'/><author><name>Pankaj Doharey</name><uri>http://www.blogger.com/profile/12590695105739765705</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4607665665916970385' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4607665665916970385' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.contentRemoved' value='true'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-554079458'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-214559715454241730</id><published>2011-10-07T02:50:24.289-04:00</published><updated>2011-10-07T02:50:24.289-04:00</updated><title type='text'>Sandi, I just watched your presentation, &amp;quot;SOL...</title><content type='html'>Sandi, I just watched your presentation, &amp;quot;SOLID Object-Oriented Design&amp;quot;, at GoRuCo 2009.  I&amp;#39;m must say that I&amp;#39;m truly embarrassed because it was a great talk and you did an awesome job.  Next, I look forward to reading your forthcoming book because many projects that I have worked on may or may not do TDD.  Furthermore, most projects that I have worked on didn&amp;#39;t address the design aspects of crafting software systems.  Thus, I&amp;#39;m very excited to hear about your book which will talk about TDD, design, and Ruby.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/214559715454241730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/214559715454241730'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html?showComment=1317970224289#c214559715454241730' title=''/><author><name>Conrad Taylor</name><uri>http://www.blogger.com/profile/11401801639188304206</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4164543782589873917' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4164543782589873917' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-2135486924'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-2745370340627524448</id><published>2011-09-19T14:21:52.074-04:00</published><updated>2011-09-19T14:21:52.074-04:00</updated><title type='text'>what do rubyists think of DIP (depending on abstra...</title><content type='html'>what do rubyists think of DIP (depending on abstractions, not concretions?). Does this apply to Ruby at all?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/8333433746237112397/comments/default/2745370340627524448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/8333433746237112397/comments/default/2745370340627524448'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/03/solid-design-principles-dependency.html?showComment=1316456512074#c2745370340627524448' title=''/><author><name>Steve-o</name><uri>http://www.blogger.com/profile/15648501950093965704</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/03/solid-design-principles-dependency.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-8333433746237112397' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/8333433746237112397' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1333755544'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-5883311304729024137</id><published>2011-06-08T01:03:37.868-04:00</published><updated>2011-06-08T01:03:37.868-04:00</updated><title type='text'>thanks for the link. I didn&amp;#39;t know you present...</title><content type='html'>thanks for the link. I didn&amp;#39;t know you presented this year as well!&lt;br /&gt;&lt;br /&gt;I can&amp;#39;t wait for the video and the book. my expectations are really high but no pressure (-:&lt;br /&gt;&lt;br /&gt;my advice for the book - &lt;br /&gt;- real life examples, just like your talk (we already know this)&lt;br /&gt;- get it reviewed by many people as possible&lt;br /&gt;- create an online site / platform for people to discuss the different designs in the book, so it will be more dynamic and fun.&lt;br /&gt;&lt;br /&gt;it must be really hard to write a good book about design, but based on your presentation I am waiting for a delicious read.&lt;br /&gt;&lt;br /&gt;thanks again.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/5883311304729024137'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/5883311304729024137'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html?showComment=1307509417868#c5883311304729024137' title=''/><author><name>oren</name><uri>http://orengolan.myopenid.com/</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/openid16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4164543782589873917' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4164543782589873917' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1027961048'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-148462339700662869</id><published>2011-06-07T09:09:49.496-04:00</published><updated>2011-06-07T09:09:49.496-04:00</updated><title type='text'>Oren, 

I have been quietly working on a book, &amp;#3...</title><content type='html'>Oren, &lt;br /&gt;&lt;br /&gt;I have been quietly working on a book, &amp;#39;Practical Object Oriented Design with Ruby&amp;#39;, known affectionately as #poodr.  After my goruco talk last Saturday, well, I guess it&amp;#39;s not so quiet any longer. &lt;br /&gt;&lt;br /&gt;The book is about half done and it&amp;#39;ll be on Safari in the next couple of weeks.  It&amp;#39;s like the SOLID talk, only more so.  My LESS talk at this years goruco came directly from the book.  Video of the new talk will be online in the next couple of weeks, the &lt;a href="http://less-goruco.heroku.com" rel="nofollow"&gt;slides&lt;/a&gt; are available on heroku right now.&lt;br /&gt;&lt;br /&gt;I&amp;#39;ll post an update here when the book and the video are available.&lt;br /&gt;&lt;br /&gt;And, finally, thanks for your comment.  I love design but I&amp;#39;m the worlds slowest writer/presentation creator; it involves a lot of head-banging for me.  Feedback like yours tells me it&amp;#39;s all worthwhile.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/148462339700662869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/148462339700662869'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html?showComment=1307452189496#c148462339700662869' title=''/><author><name>Sandi Metz</name><uri>http://www.blogger.com/profile/13364323780338797977</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4164543782589873917' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4164543782589873917' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1574250197'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-1422300480166492173</id><published>2011-06-05T16:53:57.729-04:00</published><updated>2011-06-05T16:53:57.729-04:00</updated><title type='text'>This is the best talk I have ever seen on this top...</title><content type='html'>This is the best talk I have ever seen on this topic. the fact that you used a real life example made a big difference.&lt;br /&gt;&lt;br /&gt;I am reading &amp;#39;Design Patterns in Ruby&amp;#39; and love it as well for the same reason.&lt;br /&gt;http://www.amazon.com/Design-Patterns-Ruby-Russ-Olsen/dp/0321490452&lt;br /&gt;&lt;br /&gt;Do you have any books/blogs that uses ruby code with real life examples?&lt;br /&gt;&lt;br /&gt;Thanks!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/1422300480166492173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/1422300480166492173'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html?showComment=1307307237729#c1422300480166492173' title=''/><author><name>oren</name><uri>http://orengolan.myopenid.com/</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/openid16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4164543782589873917' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4164543782589873917' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1027961048'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-5538496518030756689</id><published>2011-02-12T09:38:14.935-05:00</published><updated>2011-02-12T09:38:14.935-05:00</updated><title type='text'>I loved this talk! Great contribution!
I would lov...</title><content type='html'>I loved this talk! Great contribution!&lt;br /&gt;I would love to ear you talking about inheritance, and about &amp;quot;Inheritance and Active Record&amp;quot;.&lt;br /&gt;&lt;br /&gt;&amp;quot;Inheritance is Overrated&amp;quot; is a common saying, but I bet it shouldn&amp;#39;t be used to justify bad design decisions... Maybe this topic could be properly approached by you one day.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/5538496518030756689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/5538496518030756689'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html?showComment=1297521494935#c5538496518030756689' title=''/><author><name>Петър Руло</name><uri>http://www.blogger.com/profile/16848568904206110099</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://lh6.google.com/denise.i.kern/RtMjlxTPdOI/AAAAAAAAA-M/XjD7ZdMPQzI/DSC02131.JPG?imgmax=512'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4164543782589873917' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4164543782589873917' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1256408677'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-3998688677964118939</id><published>2009-12-25T21:35:14.568-05:00</published><updated>2009-12-25T21:35:14.568-05:00</updated><title type='text'>I&amp;#39;m interested in the relation between TDD and...</title><content type='html'>I&amp;#39;m interested in the relation between TDD and SOLID principle. &lt;br /&gt;&lt;br /&gt;I&amp;#39;m writing a short paper about this and would you like to have your feedback.&lt;br /&gt;&lt;br /&gt;http://blogs.ugidotnet.org/luKa/</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/3998688677964118939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/3998688677964118939'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html?showComment=1261794914568#c3998688677964118939' title=''/><author><name>Luca</name><uri>http://www.blogger.com/profile/10323659202500871628</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4164543782589873917' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4164543782589873917' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-388739029'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-6588599548757837292</id><published>2009-09-16T08:12:03.688-04:00</published><updated>2009-09-16T08:12:03.688-04:00</updated><title type='text'>Jim,

One mocking hole I repeatedly dig and then m...</title><content type='html'>Jim,&lt;br /&gt;&lt;br /&gt;One mocking hole I repeatedly dig and then must climb out of involves testing across the boundary where my code interacts with an external api.&lt;br /&gt;&lt;br /&gt;My goal is to use testing to make my coding more productive and to use mocking to make my testing more productive.  In dealing with external libraries I kept failing at this; my testing turned into a high maintenance nightmare that cost more than it returned.  I would try to mock the external api but I always ended up writing a lot of fragile, non-intention revealing, test polluting code that wasn&amp;#39;t quite right.&lt;br /&gt;&lt;br /&gt;I felt stupid and inarticulate about this issue and then I read the excellent chapter on &lt;a href="http://www.mockobjects.com/book/third-party.html" rel="nofollow"&gt;Building on Third-Party Code&lt;/a&gt; in &lt;a href="http://www.blogger.com/profile/14771999065792016571" rel="nofollow"&gt;Steve Freeman&lt;/a&gt; and &lt;a href="http://www.blogger.com/profile/14593335423887511402" rel="nofollow"&gt;Nat Pryce&amp;#39;s&lt;/a&gt; book &lt;a href="http://www.mockobjects.com/book/index.html" rel="nofollow"&gt;Growing Object-Oriented Software, Guided by Tests&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Ah ha. The lightbulb comes on.  The idea that difficulty in writing tests reveals a design problem that should be listened to is exactly right in my case.  &lt;br /&gt;&lt;br /&gt;Their suggestion to write an adaptor that exposes only the relevant parts of the external api has many advantages.  It lets me simplify the interface as far as MY application is concerned.  It gives me a level of indirection that allows me to easily swap to a different external library.  I can mock my own adaptor and thus have very clear, intention revealing tests for my domain.  And then I can write one (possibly long running) integration test to prove that my adaptor correctly interacts with the external api.&lt;br /&gt;&lt;br /&gt;In short, everything gets easier.&lt;br /&gt;&lt;br /&gt;Having said this, all is relative and my statement that I should only mock my own code is a sound bite that&amp;#39;s overly broad.&lt;br /&gt;&lt;br /&gt;If I&amp;#39;m queen and I get to give out dispensations, I&amp;#39;d allow these:&lt;br /&gt;&lt;br /&gt;1) For reliable, simple and fast external libraries, don&amp;#39;t mock at all.  If you need the library in your test just instantiate it and use it.  I mean, I wouldn&amp;#39;t mock &amp;#39;String&amp;#39;, would I?&lt;br /&gt;&lt;br /&gt;2) For reliable and simple libraries that are slow, I&amp;#39;m inclined to directly mock them.  If the interface is simple enough so that my mock is cheap, why not?&lt;br /&gt;&lt;br /&gt;3) At the first sign of resistance, wrap the external library in a adaptor and mock my adaptor in my tests.&lt;br /&gt;&lt;br /&gt;What do you think?&lt;br /&gt;&lt;br /&gt;I&amp;#39;m on the stinkin&amp;#39; waiting list for RubyConf; I&amp;#39;m looking forward to getting lucky and being able to hear your talk in person.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/6588599548757837292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/6588599548757837292'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html?showComment=1253103123688#c6588599548757837292' title=''/><author><name>Sandi Metz</name><uri>http://www.blogger.com/profile/13364323780338797977</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4164543782589873917' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4164543782589873917' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1574250197'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-4512382922566109004</id><published>2009-09-15T19:15:42.389-04:00</published><updated>2009-09-15T19:15:42.389-04:00</updated><title type='text'>Hi Sandi.  I just saw the video of your SOLID talk...</title><content type='html'>Hi Sandi.  I just saw the video of your SOLID talk and really enjoyed it. (BTW, I&amp;#39;m doing a SOLID Ruby at RubyConf, but it goes a slightly different direction than yours).&lt;br /&gt;&lt;br /&gt;But, I have a question.  In passing you mentioned that you only mock your own code, not code belonging to others.  I would love to hear you elaborate on reasons for this.&lt;br /&gt;&lt;br /&gt;Thanks.&lt;br /&gt;&lt;br /&gt;-- Jim Weirich</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/4512382922566109004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/4512382922566109004'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html?showComment=1253056542389#c4512382922566109004' title=''/><author><name>jim</name><uri>http://jimweirich.myopenid.com/</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/openid16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4164543782589873917' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4164543782589873917' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-209070515'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-3291422860616015045</id><published>2009-09-06T05:20:22.312-04:00</published><updated>2009-09-06T05:20:22.312-04:00</updated><title type='text'>I&amp;#39;m new to ruby and OOP - your talk accelerate...</title><content type='html'>I&amp;#39;m new to ruby and OOP - your talk accelerated understanding - I wish there were an entire series of this kind of presentation. Seeing the code made ALL the difference. &lt;br /&gt;&lt;br /&gt;Thanks!!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/3291422860616015045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/3291422860616015045'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html?showComment=1252228822312#c3291422860616015045' title=''/><author><name>simpleyogurt</name><uri>https://me.yahoo.com/simpleyogurt</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/openid16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4164543782589873917' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4164543782589873917' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-964231596'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-6575792052572575329</id><published>2009-08-20T18:40:41.235-04:00</published><updated>2009-08-20T18:40:41.235-04:00</updated><title type='text'>Sandi,

I&amp;#39;ve watched the talk a few times now....</title><content type='html'>Sandi,&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve watched the talk a few times now. You did a fantastic job.&lt;br /&gt;&lt;br /&gt;Mark</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/6575792052572575329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/6575792052572575329'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html?showComment=1250808041235#c6575792052572575329' title=''/><author><name>Vita Rara</name><uri>http://www.blogger.com/profile/14237598315022861781</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4164543782589873917' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4164543782589873917' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-55217981'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-3688861666997504381</id><published>2009-08-19T11:41:03.552-04:00</published><updated>2009-08-19T11:41:03.552-04:00</updated><title type='text'>Hey, Michal!  It&amp;#39;s great to hear from you.

I ...</title><content type='html'>Hey, Michal!  It&amp;#39;s great to hear from you.&lt;br /&gt;&lt;br /&gt;I can really recommend the Nat Pryce and Steve  Freeman talk on InfoQ, &lt;a href="http://www.infoq.com/presentations/Mock-Objects-Nat-Pryce-Steve-Freeman" rel="nofollow"&gt;Mock Roles Not Object States&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If you get a chance to watch it, I&amp;#39;d be interested in your opinion...</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/3688861666997504381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/3688861666997504381'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html?showComment=1250696463552#c3688861666997504381' title=''/><author><name>Sandi Metz</name><uri>http://www.blogger.com/profile/13364323780338797977</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4164543782589873917' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4164543782589873917' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1574250197'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-8393489638606154568</id><published>2009-08-13T11:18:15.027-04:00</published><updated>2009-08-13T11:18:15.027-04:00</updated><title type='text'>I enjoyed the talk very much. Got any more or reco...</title><content type='html'>I enjoyed the talk very much. Got any more or recommended ones? :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/8393489638606154568'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4164543782589873917/comments/default/8393489638606154568'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html?showComment=1250176695027#c8393489638606154568' title=''/><author><name>Michal Hantl</name><uri>http://www.blogger.com/profile/14687733160956375731</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/08/solid-design-talk-at-goruco.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4164543782589873917' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4164543782589873917' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-679192617'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-8573050982428627236</id><published>2009-07-07T15:30:45.522-04:00</published><updated>2009-07-07T15:30:45.522-04:00</updated><title type='text'>Technically, you&amp;#39;re not dealing with a double-...</title><content type='html'>Technically, you&amp;#39;re not dealing with a double-dispatch problem here.  Double dispatch occurs when you have TWO objects which should determine which implementation of a method to call; &amp;quot;double&amp;quot; only depends on the type of its receiver (since it has no arguments).&lt;br /&gt;&lt;br /&gt;The &amp;quot;CollideWith&amp;quot; method in the Wikpedia article is a double-dispatch issue because to know which one of the four implementations to call, you need to examine BOTH the type of the asteroid AND and the type the spaceship.  C++ (and Java and Ruby) cannot do this on its own; it&amp;#39;ll handle a dispatch on the receiving object, but in the general cases, the programmer will have to handle dispatching on the argument.&lt;br /&gt;&lt;br /&gt;That being said, the visitor pattern IS a solution for this &amp;quot;double&amp;quot; method, and all the issues raised here are perfectly valid.  It&amp;#39;s just not technically a double-dispatch issue.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/8573050982428627236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/8573050982428627236'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html?showComment=1246995045522#c8573050982428627236' title=''/><author><name>Jeremy D. Frens</name><uri>http://www.blogger.com/profile/13179698525098485533</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp3.blogger.com/_7fOA1sUkarU/SFvGdEzS1-I/AAAAAAAAAAM/51V3Y4gGrwg/S220/me.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4607665665916970385' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4607665665916970385' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-14253258'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-6925366243602018102</id><published>2009-06-20T18:10:02.533-04:00</published><updated>2009-06-20T18:10:02.533-04:00</updated><title type='text'>@Aaron, modifying core classes in gems is somethin...</title><content type='html'>@Aaron, modifying core classes in gems is something I&amp;#39;m cautious of, but in application code I do it regularly without incident. And don&amp;#39;t forget that Ruby gives us the option of modifying an individual object, limiting the potential scope for error even further.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/6925366243602018102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/6925366243602018102'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html?showComment=1245535802533#c6925366243602018102' title=''/><author><name>feyeleanor</name><uri>http://feyeleanor.livejournal.com/</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/openid16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4607665665916970385' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4607665665916970385' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1790908147'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-7315959619878097316</id><published>2009-06-18T12:27:58.563-04:00</published><updated>2009-06-18T12:27:58.563-04:00</updated><title type='text'>Naming collisions don&amp;#39;t come up nearly as ofte...</title><content type='html'>Naming collisions don&amp;#39;t come up nearly as often as critics suggest.&lt;br /&gt;&lt;br /&gt;You could avoid reopening these classes if you wanted to, wrapping them with an object that implements double and then delegates the rest to the original object.&lt;br /&gt;&lt;br /&gt;Anyway, the principle at work here is the Open-Closed principle.  With the original case-based implementation, if you want to extend the behavior by adding a new type, you would have to modify the original code.  Bad.&lt;br /&gt;&lt;br /&gt;Nice post :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/7315959619878097316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/7315959619878097316'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html?showComment=1245342478563#c7315959619878097316' title=''/><author><name>Pat Maddox</name><uri>http://www.blogger.com/profile/08736213150610301698</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4607665665916970385' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4607665665916970385' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-324953442'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-1992277838803787532</id><published>2009-06-17T13:51:40.755-04:00</published><updated>2009-06-17T13:51:40.755-04:00</updated><title type='text'>Hopefully.  I could be wrong.  ;-)

Here is a simp...</title><content type='html'>Hopefully.  I could be wrong.  ;-)&lt;br /&gt;&lt;br /&gt;Here is a simplified implementation of the double dispatch / visitor pattern I typically use:&lt;br /&gt;&lt;br /&gt;http://gist.github.com/131378&lt;br /&gt;&lt;br /&gt;When it calls &amp;quot;send&amp;quot;, it&amp;#39;s still examining the type in order to figure out which method to dispatch.  IIRC, if I was doing this in Java, I would have to implement a &amp;quot;visit&amp;quot; method for each type I expect to receive.  In ruby I cheat by using the class name in the method call, but I&amp;#39;m still asking the object for it&amp;#39;s type.&lt;br /&gt;&lt;br /&gt;Are we talking about the same thing?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/1992277838803787532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/1992277838803787532'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html?showComment=1245261100755#c1992277838803787532' title=''/><author><name>Aaron</name><uri>http://www.blogger.com/profile/13090795422716976149</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4607665665916970385' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4607665665916970385' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1578293407'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-1206514317403739806</id><published>2009-06-17T13:38:02.620-04:00</published><updated>2009-06-17T13:38:02.620-04:00</updated><title type='text'>Hmm, I see double-dispatch as &lt;i&gt;avoiding&lt;/i&gt; the ...</title><content type='html'>Hmm, I see double-dispatch as &lt;i&gt;avoiding&lt;/i&gt; the problem of having to examine the type of any object.  Are we talking about the same thing?  Can you post an example to help me understand what you&amp;#39;re saying?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/1206514317403739806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/1206514317403739806'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html?showComment=1245260282620#c1206514317403739806' title=''/><author><name>Sandi Metz</name><uri>http://www.blogger.com/profile/13364323780338797977</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4607665665916970385' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4607665665916970385' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1574250197'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-3803533527044458442</id><published>2009-06-17T13:27:51.573-04:00</published><updated>2009-06-17T13:27:51.573-04:00</updated><title type='text'>Yes.  I use double dispatch heavily for writing vi...</title><content type='html'>Yes.  I use double dispatch heavily for writing visitors, usually when dealing with ASTs.  It would be nice if all objects had an &amp;quot;accept&amp;quot; method for doing this pattern.  The only problem is, we have to examine the type, and isn&amp;#39;t that what we&amp;#39;re trying to avoid?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/3803533527044458442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/3803533527044458442'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html?showComment=1245259671573#c3803533527044458442' title=''/><author><name>Aaron</name><uri>http://www.blogger.com/profile/13090795422716976149</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4607665665916970385' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4607665665916970385' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1578293407'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-1364677483297875521</id><published>2009-06-17T12:57:39.726-04:00</published><updated>2009-06-17T12:57:39.726-04:00</updated><title type='text'>Smalltalk has a pattern which allows adding this k...</title><content type='html'>Smalltalk has a pattern which allows adding this kind of behavior while avoiding method naming collisions.&lt;br /&gt;&lt;br /&gt;It&amp;#39;s called &lt;a href="http://www.mimuw.edu.pl/~sl/teaching/00_01/Delfin_EC/Patterns/DoubleDispatch.htm" rel="nofollow"&gt;double-dispatch&lt;/a&gt; and basically it involves creating somewhat ugly, but unique, method names by using a namespace (usually something about the original receiver) to make the method names unique.&lt;br /&gt;&lt;br /&gt;The technique is used extensively in Smalltalk.  It works.  I&amp;#39;d like to think we can use it in Ruby to make our code more OO and save us some pain.&lt;br /&gt;&lt;br /&gt;Would some form of double-dispatch solve the problem you see?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/1364677483297875521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/1364677483297875521'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html?showComment=1245257859726#c1364677483297875521' title=''/><author><name>Sandi Metz</name><uri>http://www.blogger.com/profile/13364323780338797977</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4607665665916970385' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4607665665916970385' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1574250197'/></entry><entry><id>tag:blogger.com,1999:blog-3466723300364899720.post-5889619403095504012</id><published>2009-06-17T12:39:33.591-04:00</published><updated>2009-06-17T12:39:33.591-04:00</updated><title type='text'>Name collisions in particular.  To me, adding meth...</title><content type='html'>Name collisions in particular.  To me, adding methods to core classes is like modifying a global variable.  It&amp;#39;s especially painful when your implementation of &amp;quot;double&amp;quot; doesn&amp;#39;t agree with mine.  Take your modification of the Array class for example.  Array responds to &amp;quot;*&amp;quot;, so it may be perfectly reasonable to think that the implementation of Array#double would be &amp;quot;self * 2&amp;quot;.  Which one is right?  IMHO, neither should be added.&lt;br /&gt;&lt;br /&gt;Take it one step further.  What if I packaged my implementation of Array#double in a gem, and my gem depended on that functionality but you didn&amp;#39;t know that!  Redefining that method could have unexpected results.  A prime example of this problem would be the native YAML gem vs. ActiveSupport&amp;#39;s YAML generator.  They both extend core classes, and have slightly different API&amp;#39;s.  Because of that do not play nicely together at all.&lt;br /&gt;&lt;br /&gt;Switching on class type seems like a hack because we really should be duck typing, but extending core classes seems dangerous.  Unfortunately I don&amp;#39;t have a &amp;quot;good&amp;quot; solution.  Subclasses or module extension maybe?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/5889619403095504012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3466723300364899720/4607665665916970385/comments/default/5889619403095504012'/><link rel='alternate' type='text/html' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html?showComment=1245256773591#c5889619403095504012' title=''/><author><name>Aaron</name><uri>http://www.blogger.com/profile/13090795422716976149</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://sandimetz.com/2009/06/ruby-case-statements-and-kindof.html' ref='tag:blogger.com,1999:blog-3466723300364899720.post-4607665665916970385' source='http://www.blogger.com/feeds/3466723300364899720/posts/default/4607665665916970385' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1578293407'/></entry></feed>
