This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
posted 7 years ago
Short answer: yep
An interesting pattern for code reuse that comes to mind is stealing (or borrowing) methods.
Imagine this object:
Now another object:
Now 'hoho' doesn't have a getName() method but it can borrow it from 'o':
This way getName() is invoked and 'hoho' is bound to 'this' inside getName()