[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

relations diagram

Jim Newton

4/20/2016 8:49:00 AM

Has anyone used a ?UML? diagram creation tool? I'm not really sure UML is what I want.
I have a clos program, which I didn't write. At run-time it creates a bunch of objects with
inter-relations. E.g., obj-a (of class A) has a slot which is a list of objects of class B.
Some objects reference other single objects, and sometimes lists of objects.
Sometimes there are accessor functions, and sometimes just slot names.

I'd like to graphically visualise all the connections.

What I think I want is a declarative way of incrementally describing the relations.
As I better understand the relations, I'd like to update my declarative description, and ask
the program to draw a graph of it for me with single-headed and double-headed arrows
between the blocks, with accessor function names attached to the connecting lines.

I probably don't want something fully automatic as there are probably lots of relations
in the guts of the program which I don't care about.

Any suggestions?
4 Answers

Marco Antoniotti

4/20/2016 10:03:00 AM

0

On Wednesday, April 20, 2016 at 10:48:38 AM UTC+2, Jim Newton wrote:
> Has anyone used a ?UML? diagram creation tool? I'm not really sure UML is what I want.
> I have a clos program, which I didn't write. At run-time it creates a bunch of objects with
> inter-relations. E.g., obj-a (of class A) has a slot which is a list of objects of class B.
> Some objects reference other single objects, and sometimes lists of objects.
> Sometimes there are accessor functions, and sometimes just slot names.
>
> I'd like to graphically visualise all the connections.
>
> What I think I want is a declarative way of incrementally describing the relations.
> As I better understand the relations, I'd like to update my declarative description, and ask
> the program to draw a graph of it for me with single-headed and double-headed arrows
> between the blocks, with accessor function names attached to the connecting lines.
>
> I probably don't want something fully automatic as there are probably lots of relations
> in the guts of the program which I don't care about.
>
> Any suggestions?

The short answer is that UML is not what you want. 3:) 3:) 3:)

Cheers
--
MA

ram

4/20/2016 11:37:00 AM

0

Jim Newton <jimka.issy@gmail.com> writes:
>Any suggestions?

graphviz

Pascal J. Bourguignon

4/20/2016 8:11:00 PM

0

Jim Newton <jimka.issy@gmail.com> writes:

> Has anyone used a ?UML? diagram creation tool?

Yes.


> I'm not really sure UML is what I want.


> I have a clos program, which I didn't write. At run-time it creates a bunch of objects with
> inter-relations. E.g., obj-a (of class A) has a slot which is a list of objects of class B.
> Some objects reference other single objects, and sometimes lists of objects.
> Sometimes there are accessor functions, and sometimes just slot names.

And sometimes associations are implemented entirely outside of the
classes in relation. Notably, N-ary associations with N>2 are often
reifed. But they you'll say it's just another class.

The point is that in a UML diagram, you'd want to represent them as
associations, not as classes! Even 2-ary associations can be
represented as classes. And sometimes, when you have a 2-ary
association with attributes, the association attributes can be spread
amongst the classes in relation and the reified association class.

So the problem is that really there's a loss of information when you go
from a UML model to the code.

What you're up to, is to write a decompiler: analyze the classes and
object graphs, perform some pattern matching and infer some source
model.



> I'd like to graphically visualise all the connections.
>
> What I think I want is a declarative way of incrementally describing the relations.
> As I better understand the relations, I'd like to update my declarative description, and ask
> the program to draw a graph of it for me with single-headed and double-headed arrows
> between the blocks, with accessor function names attached to the connecting lines.
>
> I probably don't want something fully automatic as there are probably lots of relations
> in the guts of the program which I don't care about.
>
> Any suggestions?


I know of no UML (or otherwise) CASE tool able to take a complex model
and display good diagrams. They would need to include modules
performing some kind of "semantic" graph analysis, like determining
informal submodules (eg. from some cohesion or modularity measure,
identifying design patterns implemented (and design pattern
combinations)). They don't include anything like this. So at best, you
get class object diagrams (one class displayed in all details, along
with all its associations and related classes), with some dynamic
navigation features if you are lucky, and one big diagram with
everything on it, totally readable and unusable. Practical tools will
let you "draw" the diagrams yourself, having just loaded the "model"
from the sources. Also, you seem to be starting from actual instances,
that you want to represent in an object diagram, and perhaps then infer
interactively some class diagram from it. Using the MOP you could build
a partial class diagram directly, but indeed it is harder to identify
the associations from the classes than from the actual instance graph.
The only help you'd get would be if the slots used to implement the
associations are "typed".


One difficulty with UML tools will be to import the data. Happily,
there's a XML DTD for UML, so it would be possible to use it to generate
lisp tools to generate UML XML files representing the model of a lisp
application. Unfortunately, I know of no finished tools to do that
(when I had to work with some UML CASE tool, of course I worked on such
lisp tools, but since the free time / constrained time ratio is always
so bad, we never have enough time to make good tools). Anyways, 1- the
UML XML DTD is not a simple DTD; 2- CASE tools usually use non trivial
extensions of the DTD; 3- models for (not that big) real applications
lead to big XML files (order of 100 MB).

It may seems simplier to generate just an input file for a graph
visualization program (eg. GraphViz, or Omnigraffle). I've not tried
recently Omnigraffle, it is possible that it's able to generate
automatically usable diagrams (and the Pro version is able to do it
directly from Xcode project from Objective-C code). But I think, it
only does the hiearchical class diagram, not the associations (I may be
wrong). In any case, using a non-UML graph tool has the problem that
you are generating not an object model, but a lower level graph
representation. You would lose a lot of feature you'd get in CASE
tools such as navigation in the model, derivation of alternate diagrams
(alternate views), etc. So while this may seem an easy solution
(generating dot files is rather easy), in practice it's often not that
useful.

Back to UML CASE tools, one of the problems with them nowadays, is that
they are often specialized for Java or C++ code. The implications are
that 1- they're often are not too good to display the slots and methods
signatures in a lispy syntax (or Objective-C / Smalltalk syntax or
anything not C++ or Java); 2- more importantly, that breaks the
round-trip features if any of the CASE tool (where you're able to
generate source code from the program model, and to create the program
model from the source code). It should not be a big problem for
you, since you're already processing lisp code generated at run-time, so
you don't really need this feature. But you won't get help from
existing software to incrementally build the model.


There are a lot of small free-software UML tools, most often they are
rather limited. I find ArgoUML to be the most usuable (and this is not
a lot! but compared to the other free tools); but as I said, it's
written in Java and targets mainly java programs. Otherwise, you have
Modelio https://www.m... which is the successor of Objecteering,
rewritten entirely in Java; if I had to do some serious UMLing this is
what I would use, unless you have the time to implement your own tools
in lisp.


And this is what would be the best solution and give you the best
results: implement your own tool, and implement it entirely in lisp.
Probably it won't be as full featured as Modelio (it's got 30 years
development (or "legacy")!), but you could still beat it by implementing
some more specific or smarter analysis modules, and by implementing the
features you want with the ergonomy you want.


There is some old "demo" code around, where you could inspect and
navigate lisp objects graphically. IIRC, it was in CLIM or McCLIM. In
any case, this is rather easy to write, if you didn't need to deal with
a big graph and a need to put some order into it.



(I've got some old code about the UML DTD for Objecteering (the
precursor of Modelio), and some other old code to analyze the class
hierarchy graph and generate it in ASCII art, but nothing ready for
use).

+-------------+
+--|c-mn-view-mod|
+--------------+ | +-------------+
+--|c-mus-not-view|--+
| +--------------+ | +--------------------+
| +--|c-chord-mus-not-view|
| +--------------------+
|
| +----------------+
| +--|c-multi-bpf-view|
| +----------+ | +----------------+
+--|c-bpf-view|--+
+-------+ +--------+ | +----------+ | +--------------+
--|control|--|scroller|--+ +--|c-bpf-view-ins|
+-------+ +--------+ | +--------------+
|
| +---------------------+
+--|c-pw-help-window-view|
| +---------------------+
|
| +-------------------+
| +--|c-mn-panel-chordbox|
| +----------------------+ | +-------------------+
+--|c-music-notation-panel|--+
+----------------------+ | +--------------+
+--|c-mn-panel-mod|
+--------------+


--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk

Kaz Kylheku

4/20/2016 9:33:00 PM

0

On 2016-04-20, Pascal J. Bourguignon <pjb@informatimago.com> wrote:
> So the problem is that really there's a loss of information when you go
> from a UML model to the code.

Only in crap languages.

In Lisp, we can extend the language to formalize every silly thing that
the feeble imaginations of the UML people have come up with.

For instance, I made a few macros once for declaring association
classes. Given two classes, you could declare an association, along
with properties (given in defclass slot syntax). The macro would
create an anonymous class to hold the associations between A and B.

That's pretty much how UML wants it.