Modeling Connections
Source : Lion Kimbro's Blog
I’m surprised that more software platforms don’t cook in the concept of modeling connections. Not only do they not bake the concept of modeling connections into the language, they don’t even feature into API’s..! Modeling Connections What I mean by “modeling connections,” is– making it possible to say things like: “parent_child.connect(obj_a, obj_b)” …or perhaps even something as simple as:Â obj_a.connect(obj_b, “parent”, “child”) It’s just the concept of being able to make, sustain, and break bi-directional links between objects. Examples What kinds of things connect?
next-previous future-prior parent-child drags-dragged selects-selected class-instance enables-requires tension-tension (symmetric)
Really, wherever there’s a pointer from object to another object, there’s a possibility that “going backwards” and automating communications between the objects would be useful. Connecting, Severing, & Events Of course, if a bi-directional link is severed on one side, it naturally needs to be automatically severed on the other side, as well. This implies some sort of facility that says, “If my connection is severed, do X.” And there’s establishing connections as well: “If I suddenly find a connection established, do Y.” …and if you have that, why not just route events over connections, anyways? Automated Severance Another neat thing you can do, is automate connection maintenance chores. Say, for instance, that a given connection can only support one outgoing link. Traditionally, you have to sever the first link, manually, and then establish the new link. If you have automatic connection maintenance, then all you have to do is establish the connection to the new thing, and the old one is severed, automatically. Parent-Child Example So for example, say we have a “parent–child” relationship. A given child can have only one parent (traditional tree.) So when you say, “parent_child.connect(child, new_parent)”, any pre-existing parent of the child gets a severance call, and the new parent gets an attachment call [..]
Lion
le 09.06.07 à 16:09
dans Mind
-
Article précédent - Commenter - Article suivant -