0

Hi,

I have a design issue and don;t have a clue how to proceed.

In one of my projects I have to develop a software framework. Users who use the framework should be able to define objects they want to use and their relationship (Similar to class hierarchy).

ex: A owns B
B can-have-a-opinion-on A
B can-have-a-opinion-on B

Where A,B.... will end up as classes in the system. Please note that classes as well as their relationships are defined at runtime (or rather configuration time).

Anyone has any idea how to do the class creation and relationship defining ....

Thanks in advance,
Ishan

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by ishanh
0

Sounds like a graph problem. You can use a graph, where each item (A, B, etc.) are nodes/vertices, and each one-directional link/edge implies a relationship (i.e. owns). There are a few ways to represent graphs in code, one way is with an adjacency list. Essentially this is a 2D list where the first dimension is a list of the objects (A, B, etc) and for each object, there is a list of all the objects it has edges to (owns).

I've never made a graph where there are multiple kinds of relationships, although you could have one graph for each relationship type if that is feasible.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.