My development makes extensive use of the robot legs binding problem. I know how to solve it with PrivateModule
in Guice, but it isn't clear how this would be done with Scala's cake pattern.
Could someone explain how this would be done, ideally with a concrete example based off of Jonas Boner's coffee example at the end of his blog post? Maybe with a warmer that could be configured for left and right sides, injected with an orientation and a def isRightSide
?
Cake pattern doesn't solve this problem in its original form. You have several choices how to deal with that. The solution I prefer is to create each "robot leg" by calling its constructor with appropriate parameter - code shows that better, than words.
I think the answer cited above is more readable, but if you are already familiar with Jonas' example, here is how you'd make Warmer configurable with an orientation: