I think slide 13 at his presentation (The Value of Values) helps to understand this:
- Don’t need methods
- I can send you values without code
and you are fine
My understanding is, Hickey suggests that if I need to, say, double the value you sent to me, I simply write code looking like
MyValue = Double(YourValue)
You see, above code is the same, no matter what kind value you sent - sort of a perfect reuse.
Now, how this would look like in the language having objects and interfaces?
Doublable MyValue = YourValue.Double()
oh wait! what if
YourValue doesn't implement
Doublable? not that it can't be doubled, it may perfectly be but... what if there's just no method
Double? (what if there's a method called say
Uh oh we've got a problem.
YourValue.Double won't work, it can't be reused anymore. Per my reading of above slide, this is about what Hickey meant when he said, "All those interfaces kill your reuse!"
You see, interfaces assume that objects are passed around "along with their methods", along with code that operates on these. To use objects, one need to understand how to invoke that code, what method to call.
When expected method is missing, there is a problem, even though semantically, desired operation makes perfect sense for an object. As stated in the presentation, values don't need methods ("I can send you values without code and you are fine"), allowing to write code dealing with them in a generic manner.
Side note: notion of passing around code-less values somehow reminds me of a Flyweight pattern in OOP.
an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory... Flyweight objects are by definition value objects. The identity of the object instance is of no consequence therefore two Flyweight instances of the same value are considered equal...
Flyweight usages I've seen typically followed the same approach of stripping off the code (methods, interfaces) from objects and passing stuff around around as, well, code-less values, expecting that receiving code has means necessary to operate on these.
This feels pretty much as at the slide, "values don’t need methods. I can send you values without code and you are fine".