hypothesis / product-backlog

Where new feature ideas and current bugs for the Hypothesis product live
118 stars 7 forks source link

Canvas app isn't production code quality #340

Closed seanh closed 7 years ago

seanh commented 7 years ago

See also

Problem

There is a Canvas app for Hypothesis currently deployed at https://lti.hypothesislabs.com (git repo). I believe the server behind this is a Digital Ocean droplet run by @judell, it's not on the main Hypothesis infrastructure. This app is currently being used by more than 20 schools for classroom annotation assignments.

TODO: Insert short feature-list of app.

Although it's now in production use, the app was originally intended as a prototype and followed a minimalistic development strategy convenient for rapid iteration, deferring code organization decisions and expecting to be rewritten and hardened before becoming a standard Hypothesis product. For example the server code, HTML templates and JavaScript mostly all exist in a single file. The app:

In its current state this app can't be maintained by the dev team - we can't help if the app or server goes down, fix bugs in the app, make changes to it, or add new features to it.

Without adding any new features or changing the app from the user's point of view, the app needs to be brought to similar coding practices as other Hypothesis production software, such as h and bouncer, so that the dev team can maintain and extend the app in the future.

By having developers from the dev team do this work they'll also learn a lot about Canvas and the Canvas app, and so be in a good position to work on it in the future, or to be a resource for other developers who're working on it.

Solution

More detail can be added once we get started (and have had a good look through the code) but broadly speaking I think the strategy will be:

There'll likely be other issues that we notice as we work on the code that we should fix.

We should prioritise which parts of the code to concentrate on first. For example working on parts that seem crucial to the app's functionality first, and working on parts that we expect to want to change in the future (e.g. to add Canvas -> Hypothesis accounts integration and groups integration) first.

Other solutions we considered and rejected

  1. Write a new Canvas app from scratch. Starting from a list of problems that we want to solve, design and implement solutions to those problems, using the existing Canvas app only as a reference.

    We rejected this approach because it would take too long. In particular, it won't be possible to match the existing Canvas app's feature set within a single six week "feature teams" delivery cycle. At the end of the delivery cycle the old Canvas app would probably remain in use in production, the new app lacking the full set of features needed to replace it, and the new app would be "dead code" until we get more time to finish it.

  2. Copy the design of the Canvas app (from the user's point of view) but rewrite the code from scratch.

    We rejected this for the same reason as (1) above. If we choose to iterate on and improve the existing Canvas app, rather than rewriting it, then we avoid the problem of having dead (un-shipped) code at the end of the delivery cycle. However far we get with improving the existing app we should be able to ship that improved version.

judell commented 7 years ago

Sounds good, Sean, thank you. Note that while I did put up a local install of Canvas in the early going, and used it a few times to insert debugging statements into Canvas while working out the OAuth and assignment submission flows, it wasn't really necessary and I haven't needed to use it in a long time, I do all testing against an instance that Instructure provided for us at hypothesis.instructure.com, to which you'll have access.

seanh commented 7 years ago

Update: we've made good progress on this but I think we're still working on it. The remaining functions in app.py still need to be split out into separate files and to have unit tests written for them. The biggest of these is the lti_setup() function that needs to broken up into several separate functions. It looks to me like probably another week of solid work to finish this.