traits icon indicating copy to clipboard operation
traits copied to clipboard

Rename ObserverGraph.node to ObserverGraph.observer

Open mdickinson opened this issue 3 years ago • 1 comments

Suggestion for readability and accessibility of the observe code to newcomers: rename ObserverGraph.node to ObserverGraph.observer. "node" is a generic term that doesn't describe well what it refers to. The object referred to is an IObserver instance, which doesn't always exist as a node on a graph - it's used by the ObserverExpression, too.

This would be backwards compatible change from the point of view of Traits users: ObserverGraph isn't directly accessible to users, and the ObserverGraph class is not part of any published API; it would only affect developers of Traits itself.

mdickinson avatar Sep 10 '21 08:09 mdickinson

Deferring this; this is not an urgent change, but should be made at some point before the 7.0.0 release.

The naming issue extends beyond that one attribute, and there may be a slightly larger rework that's useful here. What's really going on is that ObserverGraph itself is misnamed: ObserverGraph represents a node on the full graph. So a more comprehensive proposal would involve:

  • renaming the node attribute to observer, as in the original description
  • renaming ObserverGraph to ObserverNode
  • possibly reintroducing ObserverGraph as a collection of root ObserverNodes - the fundamental object that we're passing around everywhere is actually a list of ObserverGraph objects; that list possibly deserves to be a class in its own right.

mdickinson avatar Sep 15 '21 10:09 mdickinson