^ manveru
module Books # books as a resource
class Search < ReifiedOperation # Books::Search represents a book search operation
on_post
def create_search_query
# ...
end
on_get
def execute_query
#
end
end
class AnotherBookOperation < ReifiedOperation
# ...
end
end
>
> I have a couple of questions/thoughts/ramblings that are kind of
> related, and I'd appreciate your views.
>
Seems like a good idea. Such an architecture certainly would have
helped quite a bit in a couple of our apps.
On Jun 25, 2008, at 9:20 AM, Dan North wrote:
while you're at it how aboutpost 'path' do |params|endget 'path' do |params|endaction 'path' do |params|endwhich would completely eliminate the private vs public method issue on controllers - only things declared to have an http interface would. which suggests possiblyhttp :action_name do |params|endhttp :action_name, :get do |params|endhttp :action_name, :posrt do |params|endor something similar.
Which raises a question I've been wondering about. Do the things
defined by "post" etc. have to be methods? Can they be Command objects?
Why, you ask?
Well, I've noticed that "business-facing" or "acceptance" tests are
too hard to write, whether you use a TDD/BDD framework like test:unit,
Fit, Selenium, tests drawn in OmniGraffle <http://www.exampler.com/blog/2007/07/13/graphical-workflow-tests-for-rails/
>, or whatever.
I've come to think they won't get easy enough to write unless
frameworks are changed to make it so. I've also come to think much of
that change would also help manual exploratory testers (who are
becoming respectable again even in the automated testing world). (Just
the ability to undo --- the canonical justification for a Command
object --- would be immensely handy.)
One of my goals is to change a web framework in those directions, and
I've tentatively settled on Ramaze, but I haven't done anything more,
though it's possible Laurent Bossavit and I will take a hack at it the
Monday of the Agile2008 conference in Toronto.
For more on what I'm aiming at, my summary of my keynote at the last
Google testing conference:
<http://www.exampler.com/blog/2008/03/23/an-alternative-to-business-facing-tdd/
>
(Note shameless name-dropping.)
-----
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick