<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Pragmatic Forums | Posts in topic 'RSpec API - The Good and the Bad'</title>
    <link>/forums/95/topics/4862.rss</link>
    <language>en-us</language>
    <ttl>60</ttl>
    <item>
      <title>RSpec API - The Good and the Bad posted by David Chelimsky @ Fri, 17 Sep 2010 00:08:05 +0000</title>
      <description>&lt;p&gt;re: subjectivity, we simply disagree. I believe that you are recommending good guidelines, but guidelines, in my view, are just guidelines and need to be considered in context. Same applies to &amp;#8220;basics of good &lt;span class="caps"&gt;API&lt;/span&gt; design.&amp;#8221; The things that you complain about (parametric coupling, let, subject, etc) are the very things that many who prefer RSpec over other alternatives cite when asked why.&lt;/p&gt;


	&lt;p&gt;re: bubble words, I get what you&amp;#8217;re saying, but I wanted the &lt;code&gt;have&lt;/code&gt; matcher to be consistent whether specifying an object that owns a collection or an object that &lt;em&gt;is&lt;/em&gt; a collection. As things stand you can say &lt;code&gt;team.should have(5).players&lt;/code&gt; and &lt;code&gt;players.should have(5).items&lt;/code&gt;. What would you recommend for the latter, besides &lt;code&gt;players.length.should eq(5)&lt;/code&gt; (which might be the clearest alternative &amp;#8211; just want to see if you have any other suggestions).&lt;/p&gt;


	&lt;p&gt;re: the &lt;code&gt;render&lt;/code&gt; method, you &lt;em&gt;can&lt;/em&gt; pass it the path directly. If you don&amp;#8217;t, it uses the argument passed to &lt;code&gt;describe&lt;/code&gt; as a convenience. Many Rails devs prefer to not have to type the same thing over and over again, so that feature is provided as a convenience to them (and was requested initially by a Rails dev), but you are not bound by it.&lt;/p&gt;</description>
      <pubDate>Fri, 17 Sep 2010 00:09:33 +0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:95:4862:19836</guid>
      <author>David Chelimsky</author>
      <link>http://forums.pragprog.com/forums/95/topics/4862</link>
    </item>
    <item>
      <title>RSpec API - The Good and the Bad posted by Bala Paranj @ Sun, 12 Sep 2010 20:00:13 +0000</title>
      <description>&lt;p&gt;For example: have(1).items&lt;/p&gt;


	&lt;p&gt;items is a bubble word. Having the aim to write code like poetry is good. But having unnecessary things in the code that does not do anything adds to the learning curve. It is just noise, adds weight and does not simplify the &lt;span class="caps"&gt;API&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;I see this attitude a lot in the Ruby community: Just because Ruby is dynamic does not mean you should violate all the basics of object oriented design. Parametric coupling is one of the fundamental things to keep in mind, it is not about being subjective or objective. It&amp;#8217;s about applying good design principles.&lt;/p&gt;


	&lt;p&gt;Same thing can be said about constructs like let and subject. When you use those words what happens to the way a developer thinks vs how it needs to be expressed? I have to translate those constructs in my mind to code.&lt;/p&gt;


	&lt;p&gt;I think the RSpec library has the good and bad probably because only some contributors really get the basics of good &lt;span class="caps"&gt;API&lt;/span&gt; design.&lt;/p&gt;</description>
      <pubDate>Sun, 12 Sep 2010 20:00:51 +0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:95:4862:19750</guid>
      <author>Bala Paranj</author>
      <link>http://forums.pragprog.com/forums/95/topics/4862</link>
    </item>
    <item>
      <title>RSpec API - The Good and the Bad posted by David Chelimsky @ Thu, 29 Jul 2010 00:53:31 +0000</title>
      <description>&lt;p&gt;This is all very subjective. I&amp;#8217;ll bet there are some who think the operator expressions are voodoo and that it&amp;#8217;s great that they don&amp;#8217;t have to write the template name twice in order to get the output they want in view specs.&lt;/p&gt;


	&lt;p&gt;What are &amp;#8220;bubble words&amp;#8221;?&lt;/p&gt;</description>
      <pubDate>Thu, 29 Jul 2010 00:54:08 +0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:95:4862:17137</guid>
      <author>David Chelimsky</author>
      <link>http://forums.pragprog.com/forums/95/topics/4862</link>
    </item>
    <item>
      <title>RSpec API - The Good and the Bad posted by Bala Paranj @ Wed, 28 Jul 2010 17:56:11 +0000</title>
      <description>&lt;p&gt;The Good:&lt;/p&gt;


	&lt;p&gt;Operator Expressions : Good use of meta-programming&lt;/p&gt;


	&lt;p&gt;The Bad:&lt;/p&gt;


	&lt;p&gt;1. Have method has bubble words and it complicates the &lt;span class="caps"&gt;API&lt;/span&gt;. It increases the noise in the code. Make the &lt;span class="caps"&gt;API&lt;/span&gt; minimal.&lt;/p&gt;


	&lt;p&gt;2. Leaky &lt;span class="caps"&gt;API&lt;/span&gt; : render method is leaky because it depends on the argument passed in to the outer method. Basically it has parametric coupling. Developer has to &amp;#8220;remember&amp;#8221; the coupling in order to use the &lt;span class="caps"&gt;API&lt;/span&gt;. This is very annoying.&lt;/p&gt;</description>
      <pubDate>Wed, 28 Jul 2010 17:57:29 +0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:95:4862:17131</guid>
      <author>Bala Paranj</author>
      <link>http://forums.pragprog.com/forums/95/topics/4862</link>
    </item>
  </channel>
</rss>
