[Catalyst] An MVC logic separation conundrum

Aristotle Pagaltzis pagaltzis at gmx.de
Fri Mar 11 00:03:56 GMT 2016


* Chris Welch <welch.chris at gmail.com> [2016-03-10 15:45]:
> My original question was not about passing the method call in per se,
> but the return value from that method call

You could do that of course.

The question I’d ask is, does the caller have to know which values from
the match object it needs to pick out and put together to produce the
required value?

If yes, then that would leak responsibility from generate_ical_data back
into its caller – which means e.g. if you want to change exactly how the
iCal data is generated then you also have to change the caller, not just
generate_ical_data.

If not, such as if the values you pass to uri_for_action depend on the
action only, then you can just pass the return value without causing
problems, sure. And if you *can* do that, then it’s the better choice,
because the code will be more readable that way – not just the caller
but more importantly generate_ical_data itself. Callbacks will be quite
a bit more clunky than simple values there.

Like I said, it depends on the exact specifics.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list