I am trying to port some statically typed OOP code over to Smalltalk which performs some kind of event sourcing. I think it will in the end look a bit like this if I continue the way I do.
EventAgg>>processEvent: anEvent
"I can process an event"
(anEvent isKindOf: Discarded)
ifTrue: [ self discard ]
ifFalse: [ "...." ]
```
Pharo's built-in linter complains about usage of isKindOf
("Sends 'Questionable' message"). I can understand the reasons, most of the time one would want to use polymorphism instead of explicit conditionals. But since the processing code accesses private states of the EventAgg
class it doesn't make much sense to call out to the event, only to send an event-specific message back to the EventAgg
class to process the event.
Are there any patterns for this in Smalltalk that I don't know about?