Autolab icon indicating copy to clipboard operation
Autolab copied to clipboard

Refactor annotations to use a modern JS framework

Open icanb opened this issue 8 years ago • 2 comments

Right now the code is not DRY at all and we're using weird libraries like elt to create DOM elements.

Tool of choice is open to comments, but I have two options in mind (or maybe combination of both):

  • Backbone: The model/collection structure seems very ideal considering the collection of annotations we have. We can have AnnotationCollection, AnnotationModel and AnnotationView. PageView would listen to changes on the instance of AnnotationCollection and render new annotations as they are inserted. As for rendering the view; we are not doing anything crazy, so I think _.template would work fine for us.
  • React: It's cool and is good rendering views. However, I feel like it might be an overkill, especially considering that we'd need some extra tooling to compile the JSX templates and such. But I've never used this in production, so I'm not entirely sure about the benefits.

@jez What do you think?

icanb avatar Aug 16 '15 11:08 icanb

Yeah I'm not sure.

If we pick one, I'm partial to React. I've used it at work in in a number of my own side projects now, and I really enjoy it. I haven't used Backbone, though. I hear it's pretty nice, and Backbone + React aren't mutually exclusive especially when you're using the Flux pattern.

That being said, I've only used React with respect to designing single-page apps. We certainly could make a move towards making Autolab a single-page app, but I don't know that the benefits in the long-run outweigh the time spent refactoring in the short term. If we were going to approach it just from the perspective of annotations, I'm not sure what benefit it would have. I'm also not that up to speed on the annotations code though.

jez avatar Aug 18 '15 06:08 jez

The only SPA I like are the ones that don't reload every static asset with each new page, instead reloading the body, or some portion of the site (a feature that Rails 5 is supposed to support). Also, I'm pretty sure we tried to write the gradesheet in bootstrap and ended up adding 100 lines of code. Also, elt is not a library, it's an 11-line function that does more than most libraries do.

dlbucci avatar Aug 18 '15 16:08 dlbucci