Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Whose turn is it?
Topic Summary: Timing and sequence of object processing in LayoutDXL?
Created On: 29-Mar-2007 14:34
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 29-Mar-2007 14:34
User is offline View Users Profile Print this message


Martin Erdelen

Posts: 15
Joined: 14-Aug-2006


Greetings,

here is a question about the "timing" and sequence in which objects are processed by LayoutDXL.

Example case:
 
In a multi-level object tree, every object is to accumulate the values of a certain attribute over all its "offspring" objects (i.e. children, grand-children, great-grand-children, etc.)
Think of summing up working time over all employees of a sub-department, then over all sub-departments of a department, etc., all of which are objects in the usual DOORS hierarchy.
The values for the lowest-level objects (a.k.a. employees, a.k.a. resources, a.k.a. grunts) can be changed, and then the accumulated values in the higher-level objects have to be adapted accordingly.

On first glance, this looked to me like a classical case for using a recursive function, which drills down to the lowest level objects, and then back up again, accumulating the values as it goes along.

In other words, the job is done in one go and "globally", i.e. in one recursive run for the whole tree, at all levels. And results in consistent, current, and correct values for all objects.
(With LayoutDXL, this might be a bit of a performance hit, though, esp. for large numbers of objects.)

However, in someone else's code I saw that he lets every object accumulate the value just over its immediate children (but not the grand- and great-grand-children etc.).
"Locally", so to speak. Much simpler than recursion (and easier on performance) !
And as every object does that (this is a LayoutDXL column), we eventually end up with the proper accumulated  value anyway.

Or do we? What about timing?

If an object updates its values from its children before  those children all have updated themselves from their children, wouldn't the higher-level object end up with a wrong ("stale") value? At least until the next round of running the code?

I made a small test module to test this, and the end results for the accumulated values were in fact correct. But that may depend on module size / object number.
Moreover, LayoutDXL will be re-run at the drop of a hat (with each screen display change), so most of the time there will be very quickly a "next round" of running the code, now collecting the correct current values.
 
But is it safe to rely on that?

Hence the question:
 
Are there any guarantees about the sequence and timing of how objects are processed in LayoutDXL?
 
(Or in stand-alone script DXL, for that matter; but there we have usually well-defined for-loops.)

Specifically, can we safely assume that upper level objects will always automatically and in a timely manner adapt their data to changes in their offspring (if there is a dependence)?

Or do we have to make sure through specific code that either these changes consider the whole object tree globally; or that at least local changes are explicitly kept in sync?

[ A straightforward alternative solution would of course be to handle this task "bottom-up":
Every lowest-level object which is changed, sends this change "up-tree" to its parent, which in turn sends it to its parent,etc. Simple and safe, but doesn't make for an interesting question to the forum.  Especially doesn't answer the question if the "just look at your direct kids" approach above is a safe solution or not. ]

Cheers,
Martin

PS. I also tried to get a picture of the object processing sequence by simple Print statements -- the result was unclear: sometimes different sequences in different runs, sometimes objects being processed twice before the next one's turn, sometimes less objects processed in one run than in the next one, etc.
But this may anyway just reflect "print"ing queue management, not necessarily object processing sequence.

Report this to a Moderator Report this to a Moderator
 29-Mar-2007 22:02
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Layout DXL recalculates each time the object is redisplayed. I presume the order is top down from what you see on the screen.

If you have layout DXL working as you suggest then the DXL code itself must be searching for the currently displayed column that contains that layout code, so it can get the value from its children. That looks tough. You probably are talking about Attribute DXL; in fact that's what I'm going to talk about...

Attribute DXL calculates the first time the value is retrieved, or whenever the value is null. That 'null' clause means that string AttrDXL should display a space instead of null if that's the result. integer AttrDXL should probably display zero.

The Attribute dxl could retrieve its own current Old Value value before it sums up the values of its children resulting in the New value. If the Old Value is different than the new value than this object could realize that its parent must be recalculated, so it could set its parent value to null (not to zero), which should force it to recalculate. I believe this algorithm doesn't presume any particular ordering of execution, but does force parents to be calculated whenever their children change values, which is what you want.

Attached is the psuedo code for that.

- Louie
Report this to a Moderator Report this to a Moderator
 30-Mar-2007 07:20
User is offline View Users Profile Print this message


Martin Erdelen

Posts: 15
Joined: 14-Aug-2006

Thanks, Louie, that's very helpful (as always, I might add  )

Martin

Edited: 30-Mar-2007 at 07:22 by Martin Erdelen
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 2 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.