Thanks Richard for this explanation.
and I like also your idea of using #respondTo instead of asking a
object if its a collection or a item.
Roelof
Op 14-9-2020 om 14:28 schreef Richard O'Keefe:
"OOP is
"OOP is not asking an object what it is"? You've lost me.
I'm reminded of a joke exam question that goes something
like this:
Some things have ping nature and other things have pong nature.
Discuss, with examples.
Whatever else it is, OOP is a means to an end, not an end in itself.
It's not
Hi Roelof,
Polymorphism is the answer.
Object >> flattenInto: result
result nextPut: anObject
UndefinedObject >> flattenInto: result
^self
Collection >> flattenInto: result
self do: [ :item | item flattenInto: result ]
flatten: anObject
^ (OrderedCollection streamCo