[Rspec-devel] should_be_nil or should.be.nil

Evgeny evgeny.zislis at gmail.com
Tue Jun 6 19:39:55 EDT 2006


Oh, sorry for the typos.... drank a bit too much guinness i'm afraid.

On 6/7/06, Evgeny <evgeny.zislis at gmail.com> wrote:
> When I consider the dots-vs-underscore-vs-spaces question, I dont
> think in ruby. I think usability and catch-easy.
> Dots are easy, they are more intuitive, since I someone who is not
> well informed will be less inclined to make typos and mistakes and
> code that wont-work-the-first-time-its-run.
> Dots are continuation of whatever it is you are writing in that
> "should" sentance.
>
> For example.
>
> myfoo.bar is a method on an instance of a class.
>
> The two spec phrases would be thus :
> (1) myfoo.bar.should.not.be 10
> (2) myfoo.bar.should_not_be 10
>
> Since the second phrase is somewhat of a mixed-dot-underline (like in
> mixed-case), it will be much more prone to typos and mistakes - and
> thus less likely to be more intuitive. There is no such problem with
> the first example, this is why I fell in love with rSpec in the first
> place... it extends the sentance without bringing in its own rules
> that need to be followed (ie. counted intuitive)
>
> Actually, the best solution IMHO would be spaces, as in :
> (3) myfoo.bar should not be 10
>
> Number (3) is th best in intuitive/english-closeness that you can get
> -- and thus makes it the best of kind in this specification writing.
> [To prove my point, notice how many spaces you are using in your
> letter and weight that against
> whats-more-intuitive-spaces-or-dots-or-underscores]
>
> And underscores REQUIRE you to press two keys on your keyboard, both
> shift and the - key, while dots dont. [on english keyboards anyways]
>
> Choose DOTS! They are best! :)
>
> Regards all,
>
> Evgeny.
>
> On 6/7/06, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
> > On 6/6/06, Evgeny <evgeny.zislis at gmail.com> wrote:
> > > Dots! :)
> > >
> > > well, dots are more consistent anyways,
> > > since x.y.z.q.w.e.r.t.y is better than x.y.z_q_w_e_r_t.y
> > >
> >
> > Can you elaborate on why you think dots are better?
> >
> > And since I didn't elaborate on my own opinion when I voted, so here I go:
> >
> > Underscores mask the fact that we're dealing with several chained method calls.
> > This is - IMO - A Good Thing, since it allows the reader/writer of the spec code
> > to focus more on readability than implementation. Underscored methods is a
> > well-established convention in the Ruby community. Many dots is not - and it
> > reminds me of a kind of code I have a strong disliking for - code that
> > violates the
> > tell/don't ask principle. Also known as the Law of Demeter, or "more
> > periods than a girl's locker room". I'm concerned that if RSpec
> > advocates long dotted calls, people might
> > be less inclined to avoid it in their own code. By using dots we're on
> > a slippery slope - advocating a bad practice.
> >
> > Aslak
> >
> > > On 6/7/06, Michael Granger <ged at faeriemud.org> wrote:
> > > > On 6-Jun-06, at 2:28 PM, aslak hellesoy wrote:
> > > >
> > > > > RSpec supports both dotted and underscored syntax.
> > > > >
> > > > > While users can choose whichever they like, I think the documentation
> > > > > and examples we provide for RSpec should consistently use one style.
> > > > > Right now it's rather confusing.
> > > > >
> > > > > To avoid confusing the users.
> > > > >
> > > > > Shall ve vote? Please reply to the latest reply - that makes
> > > > > counting easier.
> > > >
> > > > Underscores.
> > > >
> > > > --
> > > > Michael Granger <ged at FaerieMUD.org>
> > > > Rubymage, Architect, Believer
> > > > The FaerieMUD Consortium <http://www.faeriemud.org/>
> > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > Rspec-devel mailing list
> > > > Rspec-devel at rubyforge.org
> > > > http://rubyforge.org/mailman/listinfo/rspec-devel
> > > >
> > > _______________________________________________
> > > Rspec-devel mailing list
> > > Rspec-devel at rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/rspec-devel
> > >
> > _______________________________________________
> > Rspec-devel mailing list
> > Rspec-devel at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-devel
> >
>


More information about the Rspec-devel mailing list