Let's take an example:
renderer := MORenderer new.
node1 := renderer node on: 'hello'.
node2 := renderer node on: 'world'.
edge := renderer edge from: node1 to: node2.
Here you are explicitly remembering the node references and you are passing them to the
edge creation. When you have a handful of these nodes, this can fit nicely what you want.
I see your point. It is true that having to explicitly manipulate nodes and edges may not
be always the best. Something that I had to struggle with in Mondrian is the interaction.
I have to explicitly lookup for nodes, which is really cumbersome time to time (cf the
mails stef send a few days ago about the interaction).
I think that we should not strive for the best API in the World. What I am interested in
is having a flexible architecture in which people can experiment with new DSL or language
extensions. This MondrianNew is just a try.
Regarding: "view edgeFromNode: node1 toNode: node2."
yes, it could work. But we already have "view edgeFromAssociations: { node1 ->
node2 }", which is shorter.
Cheers,
Alexandre
As soon as you have a multitude of nodes, it is no longer easy to make the mapping,
because you will have to manage the references manually.
In MOViewRenderer we have API that helps you lookup and match nodes only in terms of your
model (basically you never get to manipulate nodes or edges, unless you really really want
to). The idea behind this is that you should only think in terms of your model and never
get to manipulate the internals of Mondrian. This works in many cases, but you do not have
such a convenient way to work with explicit nodes and edges like above.
So, maybe a good thing would be to add finally some edgeFromNode:toNode: that provides a
creation of a node without any node lookup. So, you could have:
view := MOViewRenderer new.
node1 := view node: 'hello'.
node2 := view node: 'world'.
edge := view edgeFromNode: node1 toNode: node2.
What do you think?
Cheers,
Doru
On 20 Jun 2011, at 15:03, Alexandre Bergel wrote:
The package MondrianNew in the squeaksource
repository of Mondrian contains a bunch of classes we quickly defined:
MORenderer>>
addEdge:
addEdges:
addNode:
addNodes:
MOEdgeFactory>>
from:to:
MONodeFactory>>
on:
Cheers,
Alexandre
--
www.tudorgirba.com
"If you interrupt the barber while he is cutting your hair,
you will end up with a messy haircut."
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.