Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Model <---> View-model contract #97

Merged
merged 8 commits into from
Jan 27, 2021

Conversation

danielballan
Copy link
Member

@danielballan danielballan commented Jan 27, 2021

This is a major refactor and API change of the lower-level entities. It does not break any high-level APIs. The user code that I know of will not need any changes to account for this.

Description

  • Bind Line and Image and in general our Artist model to an opaque callable that returns data instead of to a BlueskyRun.
  • Reduce the API of Axes. Instead of keeping separate lists axes.lines and axes.images, as well as a view of their union, artists, just keep one heterogeneous list of artists and let the Views sort out what is what based on type. We were already relying on types in various places in the Views. It was not immediately clear to me that this "simplification" was a good one, but I am convinced by the result that it is.
  • Rename FigureSpec -> Figure, AxesSpec -> Axes, etc. in response to considered feedback. See commit message for details.

Motivation and Context

  • A line should not have a 1:1 correspondence with a BlueskyRun. It may represent data aggregated from multiple BlueskyRuns. Or, perhaps in the future, from something that isn't a BlueskyRun at all.
  • This simpler contract between Model and View-model makes it much easier to build new View-models to support new Views. We have near-term plans for a View that uses PIL, a proper napari View (going beyond the demo/example), and a Vega Lite one. This is a good time to refactor the contract to make that easier.

How Has This Been Tested?

  • More test parameterization to test models against all views

I have two motivations for this:

1. Within the context of user code, what we have been calling
   FigureSpec is the complete user-facing description of "the figure".
   Thus, I am in the habit of using the local variable name `figure`
   for instances of FigureSpec. @jklynch pointed out that this is
   confusing. If we just call the call Figure, this inconsistency goes
   away.
2. I want to shorten the names in preparation for potentially adding
   varieties.
- Make Artists aware only on update(), not BlueskyRun details.
- Make Axes know about Artists, not separating specific types.
@danielballan
Copy link
Member Author

This addresses #65 in large part but does not close it. It does as much of that as I think we should do for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants