[Pharo-project] Announcement real problems - please read and comment.
Henrik Sperre Johansen
henrik.s.johansen at veloxit.no
Sat Apr 2 17:19:05 CEST 2011
On 02.04.2011 13:04, Igor Stasenko wrote:
> On 1 April 2011 22:36, Henrik Sperre Johansen
> <henrik.s.johansen at veloxit.no> wrote:
>> On 01.04.2011 21:07, Stéphane Ducasse wrote:
>>> Hi guys
>>> We found a problem with ben and RPackage.
>>> Here is the scenario and may be you can help us finding the right
>>> Nautilus renames a class
>>> the class got renamed
>>> -> an announcement is raised
>>> - nautilus gets notified, it asks rpackageOrganizer (which
>>> also listens to the same event)
>>> -> rpackageOrg breaks because the class if
>>> was referting to does not exist anymore.
>> This sounds like mess in logic.
>> You ask package of class that is in the process of being renamed?
>> Why would you expect this to work?
>> Use more announcements to represent multiple steps in renaming process, for
>> example both ClassRenaming and ClassRenamed.
>> Changing it's package is something you do as an action that should be _part_
>> of renaming, while updating it's location is something you would do _after_
>> renaming is complete.
> I want to add that there should be single place handling this event.
Why? If multiple different systems are interested in the same
announcement, that is definately not the case, you want to keep the
listeners separate for modularity.
> And if there multiple subscribers, they should not operate with same
> data. Otherwise you will have many problems.
Immutability would come in handy here :)
In other words, don't mess with the contents of an Announcements when
you handle it.
More information about the Pharo-project