Closed Bug 975548 Opened 10 years ago Closed 10 years ago

make MV* infrastructure choice

Categories

(Hello (Loop) :: Client, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla33
backlog Fx32+

People

(Reporter: dmosedale, Assigned: abr)

References

Details

(Whiteboard: [needs-approval][est:a?][p=.25, s=mlpnightly1])

User Story

We need a decision on how to structure our front-end UI (but especially the chat conversation window).  Possible criteria list, in speculative priority order:

* Meet security/other constraints necessary for shipping in Firefox desktop
* Enable conversation view code to be shared with modern web browser tabs (initial target: Chrome)
* Something we can start moving with quickly
* Be suitable for code-sharing with mobile web apps

Attachments

(1 file)

      No description provided.
Niko has summarized the Talkilla stuff and various pros and cons at <https://webrtc-apps.etherpad.mozilla.org/109>.

We're going to talk to James Lal (a Gaia dev) Monday morning.
User Story: (updated)
Just had a long call with tofumatt, who's working in the apps team, and whose current focus is something like "work out best practices for web app development across mobile & desktop for recommendation both for the Mozilla community and the web at large.  It was long and super helpful.  If I don't get a chance to brain dump that info here before Monday, I'll do it then.
My personal opinion is that as we're doing an MLP first, any choice we make now could be easily reconsidered after we land it anyway.

So as most part of the frontend team is comfortable & productive using Backbone already, I'd keep it for now; maybe just switching from jQuery to Zepto and from underscore to lodash, to minimize weight and increases performances. Backbone.Native involves underscore and mocks a fake jQuery object which exposes an uncompatible API with jQuery, so I wouldn't personally vote for taking that path. 

Keeping using the tooling we already know, we'll feel "at home", take less risks and will be most likely to meet our deadline. After that, we'll obviously keep challenging that choice with feedback from real world, which is kinda really good if you ask me.

The only remaining question is the required security review for all these tools, which could take a bunch of time & could defeat the whole purpose of that strategy; though I have no idea how long this proccess can take, so any input is welcome here.
(In reply to Nicolas Perriault (:NiKo`) from comment #3)
> as we're doing an MLP first, any choice we make
> now could be easily reconsidered after we land it anyway.

I would challenge this. If you start without framework, it's easy to add one later if the need becomes obvious. On the other hand, if you include a framework for the first landing and then want to stop using it, you may have to rewrite most of the rest of the code to work without the framework.

Also, how much UI is needed for the MLP? IIRC text chat is out of the scope for now, so it seems you need only 2 <video> tags and a few buttons. How would using an existing MV* solution help for this?
(In reply to Florian Quèze [:florian] [:flo] from comment #4)
>

> I would challenge this. If you start without framework, it's easy to add one
> later if the need becomes obvious. On the other hand, if you include a
> framework for the first landing and then want to stop using it, you may have
> to rewrite most of the rest of the code to work without the framework.

My experience quite agrees with the above statement when it comes to libraries or frameworks that are designed to be mixed in (e.g. CSS, jQuery)

It’s also been my experience that other sorts of libraries have different characteristics.  Particularly germaine to this case, libraries that make non-trivial assertions about  code-structure and organization (Backbone is one example, Dojo is a more extreme one) don’t seem to work quite the same way.  If you start without them and then add them in later, it can be easy to make the code more confusing and hard to follow.

> Also, how much UI is needed for the MLP? IIRC text chat is out of the scope
> for now, so it seems you need only 2 <video> tags and a few buttons. How
> would using an existing MV* solution help for this?

I do see the point that MLP itself is somewhat oversimplified.  I suspect that that actually works for us in combination with the above.  What I mean is that I’d expect it to be able to be fairly similar amounts of work to either pull in an MVC framework or get rid of one: e.g. a code-refactoring or re-org that would require some work.  My gut says that because of the simplicity here, that work wouldn’t be trivial, but it wouldn’t be overly huge either.

While it's possible that my gut is leading me astray, MLP is just the sort of place where we want to fail our proposals fast, rather than finding out problems much later.
Niko and I had a super helpful discussion with James Lal (a long-time Gaia dev, and a long-time web dev before that), which yielded a whole variety of info.  I'll file a few more bugs on the non-MVC-related stuff early next week.

The main MVC takeaway from that discussion other was this: There's no particular standard for code organization in Gaia apps. Some stuff tries to roll its own MVC, other apps do other things.  One of the things that James mentioned felt significantly missing from not having real MVC setus was event emitters.
(In reply to Dan Mosedale (:dmose) from comment #2)
> Just had a long call with tofumatt, who's working in the apps team, and
> whose current focus is something like "work out best practices for web app
> development across mobile & desktop for recommendation both for the Mozilla
> community and the web at large.  It was long and super helpful.

Some key points from that discussion:

He's written multiple apps in Backbone (with lodash and zepto)for mobile.  The most substantial of these was a foursquare app (which is a bit buggy, but can be played with at http://around.vegan.com/).  His experiences included

* backbone appears to perform as well or better than gaia apps on FirefoxOS 1.1 running on a very low-end phone
* zepto and lodash seem to work fine on Firefox (a concern Niko had expressed, so I asked)
* on an iPhone 5s, his app was faster to start and faster to use than the iOS native app

After discussing our constraints with him for awhile, his suggestion was just to go with either Backbone or something hand-rolled (we talked about a bunch of other frameworks, but narrowed it down these).
Make no mistake, I think there is more risk around this choice than around most of the other ones, but given our constraints of "get something this group can move fast" and "has a decent chance of proving suitable to propose for uplift", this choice has the best shot from what I can see.

Note that one thing that will need to be figured out pretty quickly is how webl10n is likely to interact with any lodash templating that we want to do here.  Probably worth a short spike of somebody's time early this weekend.
QA Contact: dmose
> so it seems you need only 2 <video> tags and a few buttons

Are you sure we don't actually need a bit more than that?
(In reply to Nicolas Perriault (:NiKo`) from comment #9)
> > so it seems you need only 2 <video> tags and a few buttons
> 
> Are you sure we don't actually need a bit more than that?

Do you have the mockup of the UI you are going to implement?
The only unofficial piece I had access to is this: http://people.mozilla.org/~jboriss/temp/instant_sharing_drafts/interface_parts_and_share_0_4.png

But it still misses a bunch of pieces (eg. incoming call window, etc.)
I'd be happy to have the full list of the expected UI components, layouts and view states in order to make a decision.
In the interest of getting something stood up this weekend, we're going to stick with Dan's suggestions (backbone, zepto, lodash). If it turns out that our reliance on an MVC library isn't as necessary as we think at this time, we can revisit that decision.
I hesitated to comment as I'm just an interested observer and not working on Talkilla myself. But I was surprised at the prospect of frameworks and libraries landing on mozilla-central. 

Shouldn't mozilla code demonstrate by example the power of web standards? Landing frameworks rather undermines the claim that you can do what you need with standard JS and HTML.
Attachment #8384151 - Flags: review?(nperriault)
Some of the files included in this pull request seem to have custom licenses:

Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE

/* Zepto v1.1.3 - zepto event ajax form ie - zeptojs.com/license */
Comment on attachment 8384151 [details] [review]
Minimal framework libraries

Looks good to me
Attachment #8384151 - Flags: review?(nperriault) → review+
Sorry Florian your comment went while I was writing mine. Both seem to be MIT, I can see any problem but maybe I'm missing something?
(In reply to Florian Quèze [:florian] [:flo] from comment #15)
> Some of the files included in this pull request seem to have custom licenses:
> 
> Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2
> underscorejs.org/LICENSE
> 
> /* Zepto v1.1.3 - zepto event ajax form ie - zeptojs.com/license */

Thanks for the heads up. I'll ping Gerv for review, but all three of those are stock MIT licenses, so I don't anticipate any issues.

Gerv: can you comment on the importation of javascript code under the MIT licenses cited above?
Flags: needinfo?(gerv)
Adam/Dan -- I expect the three of us to make this decision together, but I wanted this bug to have an owner since so much depends on this decision.
Assignee: nobody → adam
http://zeptojs.com/license and http://underscorejs.org/LICENSE are both fine. 

Gerv
Flags: needinfo?(gerv)
Zepto actually behaves quite differently from jQuery when it comes to DOM events, and some bits are not 100% compatible when combined with Backbone, so I had to switch to regular jQuery (2.10 stable). 

jQuery license information is available here: https://jquery.org/license/ (MIT). Gerv, can you confirm it's okay?
Flags: needinfo?(gerv)
If this code is going into Firefox, the different MIT licenses used need to be added to about:license. That goes for jQuery too if it's not already there.

Gerv
Flags: needinfo?(gerv)
Priority: -- → P2
Whiteboard: [needs-approval]
backlog: --- → mlp+
Whiteboard: [needs-approval] → [needs-approval][est:a?]
backlog: mlp+ → Fx32+
Priority: P2 → P1
Target Milestone: --- → mozilla32
Whiteboard: [needs-approval][est:a?] → [needs-approval][est:a?][p=.25, s=mlpnightly1]
See Also: → 1019924
I'm closing this bug, based on the fact that we clearly have our first cut at the MVC setup, and the corresponding libraries are now all landed on elm. For clarity, they are:

  * Backbone
  * jQuery
  * Lodash
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: mozilla32 → mozilla33
Untracking for QA. Please needinfo me to request specific testing.
Whiteboard: [needs-approval][est:a?][p=.25, s=mlpnightly1] → [needs-approval][est:a?][p=.25, s=mlpnightly1][qa-]
Flags: qe-verify-
Whiteboard: [needs-approval][est:a?][p=.25, s=mlpnightly1][qa-] → [needs-approval][est:a?][p=.25, s=mlpnightly1]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: