Complement of Lists

Complement of Lists

Old forum URL: forums.lhotka.net/forums/t/2940.aspx


Brad posted on Thursday, May 24, 2007

Hi,

 

I have a problem with a set of use cases I'm working on. The object model for this set of use cases is very similar to that of the Project Tracker sample application.

Translating my objects into Project Tracker objects, the problem I am having is as follows:

1) User edits a resource

2) User presses the "Assign" button

3) The user is presented with the complete list of projects that they may be assigned to. However, this list does not take into account any projects that have already been assigned to the user.

 

My issue is that I would like to show the user only the valid projects to assign to the resource; this equates to any project that has been assigned and saved, plus any project that has been assigned and not saved.

My first (naive) attempt went back to the database to get the list of projects that were not assigned to the resource. However, as you can probably see, it would be possible for the user to select a project that has been assigned in memory (just not persisted to the database).

So, I concluded that I'm going to have to get the complement of the two lists. In my case, that means getting the complement of a ReadOnlyList and a EditableChildList. Has anyone got any suggestions on how one might go about this task cleanly and efficently?

 

Cheers,

-Brad

Q Johnson replied on Thursday, May 24, 2007

I would reconisder your use case a bit here; but maybe I'm just too lazy.

It doesn't seem reasonable to me to expect the program to know about assignments that haven't been Saved (persisted to the DB) by users either at this workstation or any other.  When you make this clear to the users, they might be more aggresive about saving them right away, too.

So I think your first solution is not naive.  Just do it with your database work in DP_Fetch. 

And if you're afraid there will be collisions here because of a stale list of available projects, just offer a Refresh List button in the UI that re-creates your ReadOnlyList.  It shouldn't take much time to re-create that list and a user will surely be willing to look at the hour glass for a second or two after they've intentionally requested the re-population process.

Just my two cents.

 

Copyright (c) Marimer LLC