Subject: Re: long method signatures in uml class diagrams
Date: 13 Oct 2002 14:35:51 -0500
On Sun, 13 Oct 2002, James K. Lowden wrote:
> On 13 Oct 2002 09:35:35 -0500, Lars Clausen <lrclause@cs.uiuc.edu> wrote:
>> On Fri, 11 Oct 2002, Marco Craveiro wrote:
>> > basically i am using dia to
>> > document a fairly large and complex c++ project and a lot of the
>> > methods have really long signatures. what i want to know is: is it
>> > possible to insert line breaks on the rendering of the diagram? the
>> > classes are so large that the diagram is unreadable...
>>
>> It isn't, really. The only way would be to hack objects/UML/class.c to
>> insert, say, linebreaks after arguments if the line becomes too long.
>>
>> On the other hand, long signatures are a sign of an overly complex
>> system. Not that you may be able to do anything about that.
>
> Surely you don't mean that, Lars. Would you say the following is an
> example of "an overly complex system"?
>
> template <class charT, class traits, class Alloc>
> basic_string<charT, traits, Alloc>
> operator+(const basic_string<charT, traits, Alloc>& s1, charT c)
>
> The libstdc++ style guide recommends putting the template members, return
> type, and function signature each on a separate line.
Yes, I would, but that's really a gripe about C++, not about his system.
The fact that you need to specify three templates for basic strings is vile
beyond belief, IMNSHO. And putting that signature in a UML diagram doesn't
strike me as being a help in designing the system. But that's not the
issue here.
We obviously don't want to blindly insert linebreaks everywhere we can, as
then the objects would just be too tall rather than too wide. I could
probably cook up a little pretty-printer that has some idea about when it'd
be good to break lines.
-Lars
--
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| Hårdgrim of Numenor
"I do not agree with a word that you say, but I |----------------------------
will defend to the death your right to say it." | Where are we going, and
--Evelyn Beatrice Hall paraphrasing Voltaire | what's with the handbasket?