RE: [Doxygen-users] Class collaboration
Brought to you by:
dimitri
|
From: Prikryl,Petr <PRI...@sk...> - 2001-09-14 06:06:53
|
Dimitri wrote:
> Anthony Yuen wrote:
> >
> > [...] In the class collaboration diagram that is generated,
> > I think something is not quite right. Let me give an example:
> >
> > class A { /* some methods */ };
> > class B { std::vector<A *> vec; };
> >
> > [...] I'm interested to know if this is the intended behaviour. If
> > so, what is the reason behind? If not, maybe this is a bug?
>
> Currently this is intended behaviour, but I would like
> to hear what other people think about this. Should
> template arguments, such as in the example above, be
> visualised in collaboration diagrams? and if so, how?
> [...]
Shortly, I think that this behaviour is correct.
No so shortly, I feel that it is more philosophic problem
than the technical one (I may be wrong). So I would
reformulate the question:
"Should only direct relations be considered in the
collaboration diagram?"
If the answer is no, then main() (for example) is a
function that is indirectly related to almost everything
in the program -- except the part hidden in
implementation parts (.c, .cpp). If I use here some
object of the class that hides inside the whole
functionality of the application, then the collaboration graph
of that class would be very complex and it would contain almost
every class of the application. (Well, this is rather
simplified, but I hope you understand the point.)
If the above were accepted, then the only reasonable
solution would be to define the maximum level of indirect
relations. Say, 1 (one) is the level when we think only
about direct relations.
Now, std::vector<A> is a vector of instances of class A.
The mentioned example of std::vector<A *> is vector of
pointers to such instances. Even when you know how
std::vector<whatever> may look like inside---from the abstract
point of view---you should agree that the "whatever" is hidden
inside something lager. If "vec" is the object of that class, then
"whatever" is somehow hidden inside. So, I would mark
the level of collaboration between B and "whatever" using
at least value 2. Moreover, if the "whatever" is a
pointer to "something-else", I would mark the level of
collaboration between B and "something-else" using at
least the value 3.
Even more serious problem is that the argument of any
template is used textually inside the body of the
template. This also means that you do not exactly know
how it is used.
To conclude, I guess that generally it would be very
difficult to build the collaboration diagram correctly if
the template arguments should be followed.
On the other hand, the life is not only that much
scientific. It could probably be useful to include some
internal knowledge about standard containers into doxygen.
But then, you have to know whether "vector<something>"
means _some_ vector or std::vector<>, etc. In other words,
the parser would be probably more complicated.
So, the final question is:
"Is the result of a solution of the problem worth of the
complexity of the solution?"
With regards,
Petr
--
Petr Prikryl, SKIL, spol. s r.o., pri...@sk...
|