Logo-small

3.1.3 Customizing and sending events as an Announcer

Announcer creation frequently uses the lazy initialization pattern:

MySession>>announcer
^ announcer ifNil: [announcer := Announcer new]

You can subclass Announcement for any interesting thing that might happen. The announcement subclass is the place to add any extra information about the specific announcement such as a context, the objects involved, etc. This is why announcement objects are both more powerful and simpler than using symbols.

 Announcement subclass: #RemoveChild
instanceVariableNames: 'child'
RemoveChild class>>child: aChild
^self new
child: aChild;
yourself
RemoveChild>>child: aChild
child := aChild
RemoveChild>>child
^child

User Contributed Notes

stephane.ducasse (5 February 2012, 12:00 am)

Pharo by example is fully and freely available.

http://www.pharobyexample.org

northlakestudio (3 February 2012, 3:57 pm)

I need to find something that has the basics in it. This book assumes that I already know a lot about the language. Why would this book assume that?

Add a Note

Licensed under Creative Commons BY-NC-SA | Published using Pier |