You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just tried to set up a hierarchy of Organisers and Interactors but it seems like one Organiser can't call another Organiser. Multiple organize calls in a single Organiser (#127) is vaguely similar but doesn't let me delegate responsibility to the "sub-Organiser".
Is this a sensible requirement or is calling one Organiser from another a code smell?
A contrived scenario (starting from the README example) is below:
class PlaceOrder
include Interactor::Organizer
organize CreateOrder, ChargeCard, SendThankYou
end
We add a feature for customers to prepay for recurring subscriptions. Each month we need to ship them their order but we don't need to charge their card again:
class RepeatSubscriptionOrder
include Interactor::Organizer
organize CreateOrder, SendThankYou
end
CreateOrder is getting a bit bloated so we want to split it into three Interactors (which apply to both regular and repeat orders); CheckStockLevels, CreateOrder, AddMysteryGift. We could just add both new Interactors to both Organisers but it doesn't feel very DRY.
If an Organiser could call another Organiser this would be a lot simpler:
class PlaceOrder
include Interactor::Organizer
organize ProcessOrder, ChargeCard, SendThankYou
end
class SubscriptionRepeatOrder
include Interactor::Organizer
organize ProcessOrder, SendThankYou
end
class ProcessOrder
include Interactor::Organizer
organize CheckStockLevels, CreateOrder, AddMysteryGift
end
Now any time we make changes to ProcessOrder they are inherited by both "parent" Organisers.
The text was updated successfully, but these errors were encountered:
I just created a brand new project and tested it out. You're absolutely right @denispasin, it does work. I've already deleted the branch I was experimenting with this on so I don't know for sure but I suspect I must have had some other bug in my code (misnamed file or class probably) and just leaped to conclusions.
I just tried to set up a hierarchy of Organisers and Interactors but it seems like one Organiser can't call another Organiser. Multiple organize calls in a single Organiser (#127) is vaguely similar but doesn't let me delegate responsibility to the "sub-Organiser".
Is this a sensible requirement or is calling one Organiser from another a code smell?
A contrived scenario (starting from the README example) is below:
We add a feature for customers to prepay for recurring subscriptions. Each month we need to ship them their order but we don't need to charge their card again:
CreateOrder is getting a bit bloated so we want to split it into three Interactors (which apply to both regular and repeat orders);
CheckStockLevels
,CreateOrder
,AddMysteryGift
. We could just add both new Interactors to both Organisers but it doesn't feel very DRY.If an Organiser could call another Organiser this would be a lot simpler:
Now any time we make changes to
ProcessOrder
they are inherited by both "parent" Organisers.The text was updated successfully, but these errors were encountered: