Design Issue with calculated fields

Design Issue with calculated fields

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


LStevnesUK posted on Monday, September 29, 2008

I have at the moment the following

Project (BO)
ProjectTaskList (Editable child list)
ProjectTask

ProjectResourceList (Editable child list)
ProjectResource

ProjectAssignments (Editable child list)
ProjectAssignment


My problem lies with trying to create the calculated fields on each object, for instance a projecttask needs an actual work property which is the sum of all assignment.work for this task, and a projectresource also has an actual work property which is the sum of all resource assignment.work. There are further calculated fields between project and tasks etc.

I'd like to try and implement it so the user can undo any changes so they can see any price changes on a what if basis but as there can be hundreds of tasks is this asking to much if I start to add projectassignments, resourceassignments, taskassignments etc for my calculated fields? Or I have I got it all wrong?



triplea replied on Monday, September 29, 2008

Your object tree explanation seems a bit vague to me... In any case below are some points that hopefully will place you on the right track.

Hope this helps

LStevnesUK replied on Monday, September 29, 2008

Thanks for the reply triplea: Sorry for vague explanation as its still all a bit vague at the moment!

I like the idea of putting everything into the root object: If for instance I had a child ProjectTaskList and a child ProjectAssignmentList is it then ok to calculate each ProjectTask.ActualWork by finding the task assignments in the ProjectAssignmentList? Or should each task have its own AssignmentList loaded from the the main ProjectAssignmentList?

triplea replied on Monday, September 29, 2008

Well it all depends on your use case. Are these assumptions correct?

A project has a number of tasks. Each task can have a number of Resources and Assignments. This would make your object tree look like this:

Project (BO)
|--->ProjectTaskList (Editable child list)
         |--->ProjectTask
                  |--->ProjectResourceList (Editable child list)
                  |        |--->ProjectResource
                  |--->ProjectAssignments (Editable child list)
                           |--->ProjectAssignment

If that is the case then your calculations per Task should be easy as each task has got access to its child Resources and Assignments.

I think you are mixing up ProjectResourceList and ProjectAssignments (unless I did not get you right). The objects providing Resources and Assignments to a task (in the form of a picking list or whatever) should be read only lists (unless you need to specify these in the same screen in which case you would need a more complex structure).

LStevnesUK replied on Monday, September 29, 2008

thanks again that seems a much better idea, having the resources and assignments at the same level under the task (Just need to work out best way to load them all now!). They do need to see the resources on the same screen as the project as they can enter estimated values etc so would I also have an editable  projectresourcelist under the project?

LStevnesUK replied on Monday, September 29, 2008

Sorry just thought a resource can be used in many different tasks, so I think this object is getting quite complex.

ajj3085 replied on Monday, September 29, 2008

If a resource is used in different tasks (i.e., use cases) you should probably have multiple resource classes, one for each specific use case.  Only reuse a class if the behavior is to be identical in different use cases.

Copyright (c) Marimer LLC