wilzbach / msa

Modular BioJS compoment for a multiple sequence alignment
http://msa.biojs.net
Boost Software License 1.0
168 stars 79 forks source link

first experiment with prereact to replace labels #173

Open wilzbach opened 8 years ago

wilzbach commented 8 years ago

Resurrected #165 after the great git purge event.

sillitoe commented 8 years ago

Had a chance to go through React tutorials - easier to see what this is doing now. Code certainly much cleaner and I'm very much in favour of that (JSX has my vote whatever the decision about Preact).

Looks like their philosophy aligns well to msa - essentially lightweight (3kb) and fast (http://developit.github.io/preact-perf/). Not sure whether this will be able to fully replace Backbone though (if that was the intention).

Is Preact more likely than Backbone to still be around in 3 years time? I guess even if it isn't, then React still will be.

Biggest test will be the one you already mentioned - getting existing (documented) events to play nicely with Preact - wouldn't be great to change the documented events model straight after a 1.0 release(!).

sillitoe commented 8 years ago

does this mean we can get our sequence alignments to do this?

http://codepen.io/developit/full/LpNOdm/

wilzbach commented 8 years ago

Had a chance to go through React tutorials - easier to see what this is doing now. Code certainly much cleaner and I'm very much in favour of that (JSX has my vote whatever the decision about Preact).

Excellent!

Looks like their philosophy aligns well to msa - essentially lightweight (3kb) and fast (http://developit.github.io/preact-perf/). Not sure whether this will be able to fully replace Backbone though (if that was the intention).

It will! And yes that's right - I want to kill backbone (with fire)!

Is Preact more likely than Backbone to still be around in 3 years time? I guess even if it isn't, then React still will be.

Obviously I can't guarantee this, but (1) React will be there in 3 years and the API is very similar (think about it as underscore and lodash), (2) such a small library is a lot easier to maintain than the current custom backbone solution, (3) my custom backbone solution hasn't been maintained since it's creation in 2014, because I admittedly made some major mistakes.

Biggest test will be the one you already mentioned - getting existing (documented) events to play nicely with Preact - wouldn't be great to change the documented events model straight after a 1.0 release(!).

Yes this will introduce a couple of breaking changes (once it's ready), but they are needed if we want to have a modern, light-weight, fast and flexible MSA Viewer, btw the "core" of the MSAViewer is the canvas which we don't need to touch. We shouldn't be afraid to completely rethink the MSA architecture - in the end we will always be able to add a compatibility layer for version 1.0 if needed (simple event proxy).

I am not entirely sure how to proceed, but I guess the best is that we start a develop branch for this upcoming change? It will take quite some time to spread the use of prereact over the MSA Viewer. Also we can easily backport fixes and features if wanted.

wilzbach commented 8 years ago

does this mean we can get our sequence alignments to do this? http://codepen.io/developit/full/LpNOdm/

Yes and no. What (Pre)-react provides is this fast virtual-DOM rendering based on a data store which we will use for all views. The sequences are currently drawn in a Canvas block which is currently pretty hard to update because it needs to know where to start and stop drawing. However (1) it means that we can have all those fancy animations etc. for the rest of the MSA and (2) I still have some plans to improve the rendering itself and make it more feasible to put your customizations (tooltips, labels, ...) to the canvas.

sillitoe commented 8 years ago

Sounds good. I've been using Backbone to write an app attempting to glue various components together and managing the relationships and events hasn't scaled well (in terms of complexity for my poor little brain). Probably my lack of experience more than anything else but (P)react keeps components simple and separate and that's generally good.

We shouldn't be afraid to completely rethink the MSA architecture

Agreed. I guess backwards-incompatible changes are precisely what major version releases are for...

(as you probably guessed I was kind of joking about the animated sequence alignments, however now you mention it...)

sillitoe commented 8 years ago

Presume you've seen this?

https://facebook.github.io/react/tips/use-react-with-other-libraries.html

wilzbach commented 8 years ago

Presume you've seen this?

Yep, that's how the Canvas will be a (Pre)-react component! Those {un,}mount events are really helpful!

Btw if you think about it Backbone is actually rather similar to (Pre)-React - the view is updated based on the data, but just a better, more efficient API for it. They both even name their central method render ;-)

jackparmer commented 6 years ago

Just wondering if there are still interest in a preact-msa or react-msa component?