Looking at your examples, I think none of them quite separate the two concerns.
There are two things we're trying to do here;
1. create a comment
2. notify Facebook if this is successful
and these should be separate.
--
You received this message because you are subscribed to the Google Groups "Objects on Rails" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objects-on-rai...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Decorators differ from Service Objects because they layer on responsibilities to existing interfaces. Once decorated, collaborators just treat theFacebookCommentNotifierinstance as if it were aComment
--
You received this message because you are subscribed to the Google Groups "Objects on Rails" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objects-on-rai...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I respectively disagree. You can create a comment elsewhere without also posting to Facebook (since AR callbacks are not used).
Using one of the techniques described the Facebook part is not coupled to Comment creation globally only within a localised context.
--
You received this message because you are subscribed to the Google Groups "Objects on Rails" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objects-on-rai...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
The main reason the hexagonal stuff is harder to follow is because (in rails) a controller has the responsibility of handling many different types of request for both the collection and items. If instead each HTTP method for every URL pattern in your app had its own handler object then the flow control would be obvious.
Rails defaults are making that painful, not hexagonal architecture.
Cheers,
M
The main reason the hexagonal stuff is harder to follow is because (in rails) a controller has the responsibility of handling many different types of request for both the collection and items. If instead each HTTP method for every URL pattern in your app had its own handler object then the flow control would be obvious.
Rails defaults are making that painful, not hexagonal architecture.
If you have a real app with real pain, the pain will guide you. Don't go shopping for a design pattern for the sake of using a design pattern, solve real pain.
I think decorator in this context is not view related, it is decorating the saving of a comment with extra functionality
--
You received this message because you are subscribed to the Google Groups "Objects on Rails" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objects-on-rails+unsubscribe@googlegroups.com.
I think decorator in this context is not view related, it is decorating the saving of a comment with extra functionalityI agree decorator here is used for adding functionality to existing object and keep the same interface from original object.
--On Tue, Sep 17, 2013 at 3:25 PM, Kris Leech <kris....@gmail.com> wrote:
Mike Moore wrote:I think decorator in this context is not view related, it is decorating the saving of a comment with extra functionality. Presenter on the other hand to me always makes me think view, probably because that is the presentation layer.
To me, this class of problem is opposite of what Decorators and Presenters are useful for. We aren't communicating the state of the domain to the View Layer, we are processing user actions. Perhaps a different abstraction would be useful for thinking about this. Matt Wynne's Hexagonal Rails presentation inverted the control flow like following:
--
You received this message because you are subscribed to the Google Groups "Objects on Rails" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objects-on-rails+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--H.P (+855)16 701 721
Website: http://wowkhmer.com
Twitter: http://twitter.com/samnangchhunLinkedIn: http://www.linkedin.com/in/samnangchhun
You received this message because you are subscribed to the Google Groups "Objects on Rails" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objects-on-rai...@googlegroups.com.