On Jun 28, 2011, at 7:23 AM, László Török wrote:

> ...and a classic (not clojure specific)
> 
> http://codebetter.com/gregyoung/2008/02/13/mocks-are-a-code-smell/

One thing I'm trying to emphasize with Midje is that mocking in the context of 
a functional language is (can be) about the logical connections among functions 
in a system. That's why Midje avoids test terminology in favor of something 
that looks more logic/Prolog-ish. As a simple example: 

        (fact "ratings of movies with favorite actors are bumped a bit higher"
             (rating ...movie...) => (roughly (* 1.2 4.0))
             (provided
                 (critic-rating ...movie...) => 4.0
                 (intersection (actors ...movie...) (favorite-actors)) =not=> 
empty?)))

Mike Feathers and I will be having a presentation about "tests as a means of 
abstraction" at Agile2011 
http://program2011.agilealliance.org/event/873f7801c8b4f23fc1f0cfe0a45de2f5
and I've submitted a derivative session to Clojure Conj. 

[Besides sometimes allowing the removal of even more incidental complexity than 
straight clojure code does, another "means of abstraction" is deferring 
decisions about data structures. In the above, we don't have to know anything 
about what a "movie" is except that `critic-rating` and `actors` work with it, 
which is saying something like what `defprotocol` says.]

-----
Brian Marick, Artisanal Labrador
Contract programming in Ruby and Clojure
Occasional consulting on Agile
www.exampler.com, www.twitter.com/marick

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to