473,503 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with circular references in OO

hi,

I have a few objects that won't work together : user, task & tasks.

The object "tasks" contains the "task" objects of 1 "user".
A User has a tasklist eg "tasks" (which contains task objects)
And one task is assigned to a user.

So, in theory you het this:
tasks[1].user.tasks.[1].user.tasks[1].user.tasks[1].user. ...

There must be a way possible to 'stop the loop'

thankee :)
Nov 16 '05 #1
4 994
Rapataa,

I do not see the problem.

I understand that every user object has a property "tasks" which is a
collection from "tasks".

In the "task" object you have a property wich is a collection from users
who do that "task"

The task can never be a subclass from users, as that is what you want to do,
because there is not a real fysical relation between those two.

To give another example
A room is a part of a building, so that has a relation.
A pencil on a desk has only a temporaly relation with that desk.

I hope this helps.

Cor
Nov 16 '05 #2
I don't see this as a problem.

Is this not like the a real world example (ish) of two Brothers. Where
a brothers.Brother.Brother... etc.

Adam
Nov 16 '05 #3
RCS
I agree with these guys.

If you have this sort of setup in a treeview for example, the worst that
will happen is some silly user will go down like 4 iterations and realize it
will keep repeating - and that's it, no harm done.

I did have an app that had this setup (and had a treeview) and what I did
was whenever you went to a known level (like "person", or "task"), instead,
I would automagically open up the right part of the treeview and make that
selected, in other words:

Toplevel
--Users
----Doe, John
--------Tasks for John Doe
------------Task 1 (this shows the same thing as TopLevel\Tasks\Task 1)
------------Task 2
------------Task 3
--Tasks
----Task 1 (click on a user at this level auto-redirects you to
TopLevel\Users\Doe, John)
----Task 2
----Task 3

In the above example, if you saw that Tasks for John Doe\Task 1 has a link
or whatever to John Doe again, don't open another branch below it, instead,
re-select TopLevel\Users\Doe, John.

So in essence, you sort of "get" what they are trying to do and keep the
tree pruned back as far as you can - just for usabilities sake. But
technically, there isn't anything wrong with what you are doing, the only
issue is if you want to make it a little more managable for your users.
"rapataa" <dg@rapataa.frup> wrote in message
news:a7**************************@msgid.xenosite.n et...
hi,

I have a few objects that won't work together : user, task & tasks.

The object "tasks" contains the "task" objects of 1 "user".
A User has a tasklist eg "tasks" (which contains task objects)
And one task is assigned to a user.

So, in theory you het this:
tasks[1].user.tasks.[1].user.tasks[1].user.tasks[1].user. ...

There must be a way possible to 'stop the loop'

thankee :)

Nov 16 '05 #4
Just to add to these answers, the XmlNode object in the framework has the
ability to refer to Parent and Child nodes, and can produce this same
effect. Drill down in the debugger some time. It's fun to loop back on
yourself...

I, too, see nothing wrong with it.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"rapataa" <dg@rapataa.frup> wrote in message
news:a7**************************@msgid.xenosite.n et...
hi,

I have a few objects that won't work together : user, task & tasks.

The object "tasks" contains the "task" objects of 1 "user".
A User has a tasklist eg "tasks" (which contains task objects)
And one task is assigned to a user.

So, in theory you het this:
tasks[1].user.tasks.[1].user.tasks[1].user.tasks[1].user. ...

There must be a way possible to 'stop the loop'

thankee :)

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
20672
by: Covad | last post by:
Hi all, For some reason my change() function is only called when the page loads. I'd much rather it gets called when the select changes. Here's the code: window.onload = init; function...
2
410
by: Vera | last post by:
I have two assemblies that each consist of several classes. Each object instantiated from those classes can have one or more child- and/or parentobjects that are also instantiated from those...
2
7952
by: Earth Worm Jim | last post by:
I have been able to get simple circular references to be serialized in xml by using the ImportTypeMapping method on the SoapReflectionImporter class. But I am unable to serialise circular...
5
6838
by: Gos | last post by:
Hi, It is known that .NET does not allow us to add circular references. Is there a way to workaround this problem by late-binding the objects at run time? Will this create any other problems? ...
3
3629
by: Solution Seeker | last post by:
Hi All, I am here with a Query and need a Solution for it. The Query is as Follows, We have 3 Projects in a Solution - Say UI, CMN and PRD First One Deals with UI Forms Second One Deals...
12
1845
by: Joel Byrd | last post by:
I am making an AJAX call when any one of a number of inputs in a form (search criteria) are clicked, checked, changed, etc. When the user clicks, checks, whatever, I am trying to display a...
2
2800
by: Lapu-Lapu | last post by:
I have authored a web service using ASP 2.0. The web services return objects that use generics and that also contain circular references. Programmatically, everything works well, as long as you...
14
1683
by: Cylix | last post by:
I have a array to store some student information, eg var s = new Array('2006001', 'Apple Joker', '5B'); normally, We get the data using s, s,s ... How can I define them more readable like s, s,...
5
3788
by: Madhur | last post by:
Hello If I define two classes in the same cs file. And in each class, I define the object of other class as a member. Can anyone explain me how .NET or its compiler will resolve this kind of...
2
1847
by: Dansk | last post by:
Hi all, I am currently writing some code that explores assemblies dependencies. I start loading the first assembly with Assmebly.LoadFrom which gives me an Assembly instance. Then, I...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7084
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7458
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5013
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.