473,657 Members | 2,535 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 1000
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.Brothe r.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.fru p> wrote in message
news:a7******** *************** ***@msgid.xenos ite.net...
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.fru p> wrote in message
news:a7******** *************** ***@msgid.xenos ite.net...
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
20691
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 init() {
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 classes. Most relationships exist within one assembly, but relationships between assemblies may sometimes occur. For each relationship, I have to make sure that an object from Class1 knows that it can have an object from Class2 as one of its children....
2
7974
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 references when the circular reference is contained with in a collection class, specifically I am using a custom ArrayList object. I keep getting a StackOverFlow Exception from the XmlSerializer class when attempting the serialisation. The classes...
5
6845
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? One solution to the problem is to re-architect the solution. But, I dont want to do this as there are many modules in the project which are already developed and nearing the release.
3
3645
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 with Common Functions that are needed for the Solution
12
1869
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 "Retrieving results..." text. This should be really simple, but in IE, it does not work. Here's the code that is not executing in IE: And here is the context of that code, which is the AJAX function that is called when a radio button is clicked,...
2
2816
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 use the web service proxy client generated by visual studio. However, the default test harness provided by the .asmx file errors out because it seems to use XmlSerialization and cannot handle circular references. I understand that the...
14
1699
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, s ? Thank you
5
3797
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 reference since one class would not be compiled unless other is compiled. This is kind of a deadlock. Isnt it ?
2
1853
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 enumerate the AssemblyNames from the GetReferencedAssemblies() collection.
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8726
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8603
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.