[Question][vw7.x][BASE] -- DependentsCollection is a collection not a set -- why?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Question][vw7.x][BASE] -- DependentsCollection is a collection not a set -- why?

Mark Ballard-2
In our application ported from vw2.5 to vw7, I recently noticed multiple
updates.  I traced it down to multiple entries of the same object in a
DependentsCollection.

In our vw2.5 version of our application, we had changed the behavior of
DependentsCollection to be a set, but had not ported that change to vw7.
  I now plan to make the change but wonder what in the standard system I
might be breaking.

So, what application or system tool would want to record multiple
entries of the same object in a DependentsCollection, and why?

Note 1:

The class comment for DependentsCollection reinforces this idea that the
object can be duplicated, but does not explain why.  It says:

"Note that the same dependent may appear more than once in the collection."


Note 2:

The change is to the method

DependentsCollect >> asDependentWith:

        ^(self includes: anObject)
                ifTrue: [self]
                ifFalse: [self copyWith: anObject]


instead of just

        ^self copyWith: anObject



--
[hidden email]
(503) 627-5890  Desk   (503) 627-1388  Fax


Reply | Threaded
Open this post in threaded view
|

RE: [Question][vw7.x][BASE] -- DependentsCollection is a collection not a set -- why?

Thomas Brodt
One argument is ordering of dependents which might be critical. You can
assure that you are the last dependent notified when you do a
removeDependent:self and then addDependent: self.

Thomas

> -----Original Message-----
> From: Mark Ballard [mailto:[hidden email]]
> Sent: Wednesday, May 17, 2006 11:25 PM
> To: [hidden email]
> Subject: [Question][vw7.x][BASE] -- DependentsCollection is a
> collection not a set -- why?
>
> In our application ported from vw2.5 to vw7, I recently
> noticed multiple
> updates.  I traced it down to multiple entries of the same
> object in a
> DependentsCollection.
>
> In our vw2.5 version of our application, we had changed the
> behavior of
> DependentsCollection to be a set, but had not ported that
> change to vw7.
>   I now plan to make the change but wonder what in the
> standard system I
> might be breaking.
>
> So, what application or system tool would want to record multiple
> entries of the same object in a DependentsCollection, and why?
>
> Note 1:
>
> The class comment for DependentsCollection reinforces this
> idea that the
> object can be duplicated, but does not explain why.  It says:
>
> "Note that the same dependent may appear more than once in
> the collection."
>
>
> Note 2:
>
> The change is to the method
>
> DependentsCollect >> asDependentWith:
>
> ^(self includes: anObject)
> ifTrue: [self]
> ifFalse: [self copyWith: anObject]
>
>
> instead of just
>
> ^self copyWith: anObject
>
>
>
> --
> [hidden email]
> (503) 627-5890  Desk   (503) 627-1388  Fax
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [Question][vw7.x][BASE] -- DependentsCollection is a collection not a set -- why?

Mark Ballard-2
Thanks, Thomas.

Ordering of dependents is not important in our application.

Does anyone know if any application or system tool needs multiple
entries in the DependentsCollection or needs to maintain order of
dependents?

Thomas Brodt wrote:

> One argument is ordering of dependents which might be critical. You can
> assure that you are the last dependent notified when you do a
> removeDependent:self and then addDependent: self.
>
> Thomas
>
>
>>-----Original Message-----
>>From: Mark Ballard [mailto:[hidden email]]
>>Sent: Wednesday, May 17, 2006 11:25 PM
>>To: [hidden email]
>>Subject: [Question][vw7.x][BASE] -- DependentsCollection is a
>>collection not a set -- why?
>>
>>In our application ported from vw2.5 to vw7, I recently
>>noticed multiple
>>updates.  I traced it down to multiple entries of the same
>>object in a
>>DependentsCollection.
>>
>>In our vw2.5 version of our application, we had changed the
>>behavior of
>>DependentsCollection to be a set, but had not ported that
>>change to vw7.
>>  I now plan to make the change but wonder what in the
>>standard system I
>>might be breaking.
>>
>>So, what application or system tool would want to record multiple
>>entries of the same object in a DependentsCollection, and why?
>>
>>Note 1:
>>
>>The class comment for DependentsCollection reinforces this
>>idea that the
>>object can be duplicated, but does not explain why.  It says:
>>
>>"Note that the same dependent may appear more than once in
>>the collection."
>>
>>
>>Note 2:
>>
>>The change is to the method
>>
>>DependentsCollect >> asDependentWith:
>>
>> ^(self includes: anObject)
>> ifTrue: [self]
>> ifFalse: [self copyWith: anObject]
>>
>>
>>instead of just
>>
>> ^self copyWith: anObject
>>
>>
>>
>>--
>>[hidden email]
>>(503) 627-5890  Desk   (503) 627-1388  Fax
>>
>>
>>
>
>


--
[hidden email]
(503) 627-5890  Desk   (503) 627-1388  Fax


Reply | Threaded
Open this post in threaded view
|

Re: [Question][vw7.x][BASE] -- DependentsCollection is a collection not a set -- why?

Mark Ballard-2
Thanks, Dave.

I decided to change the behavior of addDependents: for our application
objects only so that a dependent is only added once.  We have an
abstract subclass of ApplicationModel where I change the behavior.


I'm still puzzled as to why DependentsCollection allows duplicates...





Dave Stevenson wrote:

> I know ordering of dependents of ObjectMemory was used for system
> startup, so that alone may explain why dependents were not initially
> implemented as a set.  In recent releases, the Subsystem hierarchy broke
> this reliance, but I don't think any effort was made to go through the
> system and find other such reliance on ordering of dependents, so
> suddenly changing to sets might break something.  Even if it doesn't, it
> would be a system override you would have to maintain from release to
> release.
>
> I would recommend finding out where the duplications are being made and
> eliminating the redundancy.  For example, temporarily edit
> Object>>addDependent: as follows:
>
> addDependent: anObject
>     "Add anObject as one of the receiver's dependents. If anObject is
> one of my application classes and it is already a dependent, debug."
>
>     (anObject class == MyClass
>         and: [self myDependents asDependentsAsCollection includes:
> anObject])
>             ifTrue: [self halt].
>     self myDependents: (self myDependents asDependentsWith: anObject).
>     ^anObject
>
> Dave
>
> Mark Ballard wrote:
>
>> Thanks, Thomas.
>>
>> Ordering of dependents is not important in our application.
>>
>> Does anyone know if any application or system tool needs multiple
>> entries in the DependentsCollection or needs to maintain order of
>> dependents?
>>
>> Thomas Brodt wrote:
>>
>>> One argument is ordering of dependents which might be critical. You can
>>> assure that you are the last dependent notified when you do a
>>> removeDependent:self and then addDependent: self.
>>>
>>> Thomas
>>>
>>>
>>>> -----Original Message-----
>>>> From: Mark Ballard [mailto:[hidden email]] Sent: Wednesday,
>>>> May 17, 2006 11:25 PM
>>>> To: [hidden email]
>>>> Subject: [Question][vw7.x][BASE] -- DependentsCollection is a
>>>> collection not a set -- why?
>>>>
>>>> In our application ported from vw2.5 to vw7, I recently noticed
>>>> multiple updates.  I traced it down to multiple entries of the same
>>>> object in a DependentsCollection.
>>>>
>>>> In our vw2.5 version of our application, we had changed the behavior
>>>> of DependentsCollection to be a set, but had not ported that change
>>>> to vw7.  I now plan to make the change but wonder what in the
>>>> standard system I might be breaking.
>>>>
>>>> So, what application or system tool would want to record multiple
>>>> entries of the same object in a DependentsCollection, and why?
>>>>
>>>> Note 1:
>>>>
>>>> The class comment for DependentsCollection reinforces this idea that
>>>> the object can be duplicated, but does not explain why.  It says:
>>>>
>>>> "Note that the same dependent may appear more than once in the
>>>> collection."
>>>>
>>>>
>>>> Note 2:
>>>>
>>>> The change is to the method
>>>>
>>>> DependentsCollect >> asDependentWith:
>>>>
>>>>     ^(self includes: anObject)
>>>>         ifTrue: [self]
>>>>         ifFalse: [self copyWith: anObject]
>>>>
>>>>
>>>> instead of just
>>>>
>>>>     ^self copyWith: anObject
>>>>
>>>>
>>>>
>>>> --
>>>> [hidden email]
>>>> (503) 627-5890  Desk          (503) 627-1388  Fax
>>>>
>>>>
>>>>
>>>
>>>
>>
>>


--
[hidden email]
(503) 627-5890  Desk   (503) 627-1388  Fax