[Pharo-project] Announcer methods are bloated

Henrik Sperre Johansen henrik.s.johansen at veloxit.no
Wed Apr 20 01:22:14 CEST 2011


On 20.04.2011 00:00, DougEdmunds wrote:
> I'd vote to keep the subscribe:do: and subscribe:send:to methods, since that
> seems to most clearly identify what they are doing.  Maybe better would be
> subscribeTo:do: and subscribeTo:send:to:
>
> A good example is the instance var 'announcer' in PragmaCollector which
> holds requests to receive (subscriptions to) 'PragmaAnnouncement' and to
> 'PragmaCollectorReset' announcements.
>
> subscribe: anAnnouncement send: aSelector to: anObject
> 	"see Announcements packages"
> 	self announcer subscribe: anAnnouncement send: aSelector to: anObject
>
>
> whenChangedSend: aSelector to: anObject
> 	"record a change listener"
> 	self subscribe: PragmaAnnouncement send: aSelector to: anObject
>
> whenResetSend: aSelector to: anObject
> 	"record a change listener"
> 	self subscribe: PragmaCollectorReset send: aSelector to: anObject
>
In my eyes, an issue with subscribeTo: is that it kind of encourage 
giving announcement classes noun names rather than using verbs, if you 
want subscriptions to read naturally.
on:  does not have that problem to the same extent, and when: certainly 
doesn't.
subscribe: reads awkwardly no matter what you name them, imo :)

Of course, subscribe:'s big advantage is that it's not polymorphic with 
any existing system.

Cheers,
Henry



More information about the Pharo-project mailing list