So a realistic example: `purchaseCardContents` cal...
# announcements
p
So a realistic example:
purchaseCardContents
calls
purchaseCardContents
which calls
toPurchaseCardContent
several times. Now I need a class
FormatSavings
in the last function
toPurchaseCardContent
. How do I get it there? When using a class for the whole logic, I just inject it through the constructor. The issue here is that
toPurchaseCardContent
doesn't know anything about
purchaseCardContents
so I would need to pass-through that class and everything else it needs. Maybe the better question is: How do I get / pass dependencies I don't want the caller to bother about in functional programming?
l
This code seems to have a quite narrow scope, I don't see how you could make something generic or apply some pattern I know (I don't know all of them though, far from this)
I think I'd have a
FormatParams
class if I had your use case