Posted by kyle on August 2, 2006 3:18 PM | bookmark / share: |
I put together some diagrams to describe the JSViz 0.2a design. I'm looking for comments to guide the design of the 0.2 release. Please let me know what you think:
The core of the design is a traditional Model / View / Controller (MVC). I'm not going to go into detail about MVC here, but Wikipedia has plenty of detail here. MVC offers an elegant means to recycle and swap implementations of the principle components of a system. Here's a high level view of JSViz 2.0a:
Our components are:
- GraphModel: Representation of nodes and edges in a graph, and also the algorithms used to position these objects in space. JSViz 0.2a supports "Force Directed" and "Tree" models.
- GraphView: Produces a displayable representation of the model. JSViz 0.2a includes "DOM" and "SVG" views.
- GraphController: Handles events that modify the model and view. In the current design, an implementation of GraphController is required for each model / view combination.
The abstract classes define a minimum set of functionality that must be included in each concrete implementation. For example, an implementation of GraphModel must enable a client to add nodes and edges, and update the positions of objects in the graph. And a GraphView must enable a client to draw nodes and edges as their positions change. The diagram below adds in some concrete classes.
Most of your application's interactions with the graph will take place through a concrete implementation of GraphController. This is better illustrated with code, so I'm going to follow up with a usage walk-through. If you have any comments in the meantime, please leave 'em below.