views:

252

answers:

2

Imagine you have a bunch of components and subcomponents in your web application. You want to keep track of how all the custom events you added behave. Are there established ways to diagram or document these behaviors?

Here are some things the documentation should show:

  1. The actual nesting of relevant DOM elements of the various components.
  2. The names of events and where they're fired from.
  3. Any payloads that are attached to the custom events (e.g. the contents of memo in a Prototype custom event.)
  4. The places where events are observed.
  5. Indications of what events are fired in response to other events.
  6. Where events are allowed to bubble, and where they are stopped.
+2  A: 

I've never heard of an established documentation standard for web application front-ends.

That said, since you've identified the different aspects of your application that you want to track, you could keep this info in a docblock for each event handler, and use the jsdoc toolkit to generate some inline docs.

IMHO, I think that since you know what it is that you want to document already, you should feel free to create documentation in whatever format makes the most sense for you, even if its completely unique to your app/organization. 8 hours on stackoverflow with no answers must mean there is no standard answer ;)

Steve Goodman
Okay, thanks. I may try to adapt a UML diagram of some sort, or come up with something novel. I'll share here, regardless.
Eric Nguyen
+2  A: 

Honestly I used to LOVE visual modeler, and when MS dumped it for Visio I was somewhat disappointed.

That said, Visio is still a great tool, and you can use it for creating object models of components and defining events, properties, methods etc. It has some built in functionality for UML designs and all.

But I have to say in the end, I usually end up with notepad or MS word. Depending on how verbose you want to be with your documentation, typing up notes or a description for a component never really fits nicely into any kind of DOM tool, but you can bold, tab, list and italicize like a madman inside a Word doc.

Sounds sad, but it's true!

Mxyzptlk
This sounds promising. Is there a specific type of UML diagram that would work well, and can you link to an example? One thing that's specific to the web frontend world is how events bubble; this seems beyond most simple object model diagrams I've seen.
Eric Nguyen
Component Diagrams seem to come close, but don't model the bubbling aspects: http://advanceduml.wordpress.com/the-unified-modeling-language/component-diagrams/
Eric Nguyen
I don't know of a good site with screenshots or anything, but the "UML Model Diagram" (Visio 2007) is the one with all the events, properties and methods.
Mxyzptlk