In the book Coders at work Joe Armstrong stated that:
I think the lack of reusability comes in object oriented languages, not in functional languages. Because the problem with object oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle
I do not quite get it here. If the problem is to get a banana, we can encapsulate all the logic behind the function 'getBanana'. How are monkey and jungle involved in this context. Could somebody write a code snippet that explains the problem in an easier to understand way, say, demonstrate the fact that the Banana
object requires the Monkey
and Jungle
objects to be initiated, please?