Discussion:
Moving ahead to the new architectutre
Marcus Cavanaugh
2015-11-13 21:52:12 UTC
Permalink
What kind of timeline are we aiming for? Given that it's a sorted priority
list, what kind of progress would we need to see for 2.6, 2.7, and beyond
to consider this effort a success?

Nearly half of these key apps are understaffed at best: contacts, calendar,
calculator, and clock have no full-time engineers allocated afaik. We'll
need to actively dedicate people to this project for this to be successful.
(We're hiring, but I wouldn't expect any meaningful acceleration from
hiring efforts until the start of 2.7 development at best.)
Hi all,
Given the Music app splitting we have done in time for 2.5 we want to move
ahead - I think it makes sense to be executed in a “train model” fashion.
We should start from the top of the list and work through the list.
When I say splitting of the apps, we are looking for the following
1. FE/BE split
2. Split views
3. Page transition
Why did I choose the priority below? - for now we have 2 products that we
work on: smartphone and TV, but moving forward we need to investigate what
are the products that make sense for us and when we enter the connected
devices market 3rd party developers need to be able to develop differing
views for our core apps.
With this is mind we went through some exercise to define a priority for
the apps to be ported to the updated architecture.
- *Settings* - this is a key app for any product mozilla may be
planning to release; different apps will have different needs to display
information to the user in the settings
- *Camera *- again a key app for a lot of the modern devices
- *Contacts* - everyone wants to have contacts on their devices - but
they need different level of information - creating differing views is
going to key here
- *Calendar* - as with contacts its critical to have differing views
but not as high priority as contacts
- *Gallery* - another core app that every connected device may need
to have
- *E-mail* - typing emails on smaller devices will be a problem and
therefore creating readable email view may be needed for some connected
deviceds
- *Calculator *- table stake app
- *Clock *- table stake app
- *Browser *- one of core mozilla apps but a table stake app for some
of the connected devices
Some of the engineering teams, who have already worked on this split, will
be reaching out in smaller teams to discuss best practices and quick wins
for this activity.
BR
Wilfred
---
FxOS Product Management
Mozilla Corp., UK
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Wilfred Mathanaraj
2015-11-13 22:50:49 UTC
Permalink
I would like to have all the apps I listed below to be on the new architecture when we hit May 2016.

But I doubt we will be able to achieve this if we don't change the way we look at the activities we need have ready for a release.

We should resource these apps with the engineers we have to make this a success. And we should staff it in the priority order with some experts from those specific apps.

BR
Wilfred

-
What kind of timeline are we aiming for? Given that it's a sorted priority list, what kind of progress would we need to see for 2.6, 2.7, and beyond to consider this effort a success?
Nearly half of these key apps are understaffed at best: contacts, calendar, calculator, and clock have no full-time engineers allocated afaik. We'll need to actively dedicate people to this project for this to be successful. (We're hiring, but I wouldn't expect any meaningful acceleration from hiring efforts until the start of 2.7 development at best.)
Hi all,
Given the Music app splitting we have done in time for 2.5 we want to move ahead - I think it makes sense to be executed in a “train model” fashion.
We should start from the top of the list and work through the list.
1. FE/BE split
2. Split views
3. Page transition
Why did I choose the priority below? - for now we have 2 products that we work on: smartphone and TV, but moving forward we need to investigate what are the products that make sense for us and when we enter the connected devices market 3rd party developers need to be able to develop differing views for our core apps.
With this is mind we went through some exercise to define a priority for the apps to be ported to the updated architecture.
Settings - this is a key app for any product mozilla may be planning to release; different apps will have different needs to display information to the user in the settings
Camera - again a key app for a lot of the modern devices
Contacts - everyone wants to have contacts on their devices - but they need different level of information - creating differing views is going to key here
Calendar - as with contacts its critical to have differing views but not as high priority as contacts
Gallery - another core app that every connected device may need to have
E-mail - typing emails on smaller devices will be a problem and therefore creating readable email view may be needed for some connected deviceds
Calculator - table stake app
Clock - table stake app
Browser - one of core mozilla apps but a table stake app for some of the connected devices
Some of the engineering teams, who have already worked on this split, will be reaching out in smaller teams to discuss best practices and quick wins for this activity.
BR
Wilfred
---
FxOS Product Management
Mozilla Corp., UK
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Michael Henretty
2015-11-16 08:53:27 UTC
Permalink
*Browser *- one of core mozilla apps but a table stake app for some of
the connected devices
What does it mean for the browser app to be split? What was the reason
behind this decision? From the smartphone side I see little value, so I'd
love to hear about it from the connected devices side.
Wilfred Mathanaraj
2015-11-16 09:00:09 UTC
Permalink
Yes - for smartphone this may be of little value but as we move towards a connected devices world the browser will been to have different look and feel for different screen sizes.
e.g. - please don't take this as the areas we are already planning on - We can not have the same browser on TV, Smartphone, watches, car, WoT devices etc

We have not yet defined which devices we may have but its worth keeping our options open and our platform flexible.

BR
Wilfred


---
FxOS Product Management
Mozilla Corp., UK
Browser - one of core mozilla apps but a table stake app for some of the connected devices
What does it mean for the browser app to be split? What was the reason behind this decision? From the smartphone side I see little value, so I'd love to hear about it from the connected devices side.
David Scravaglieri
2015-11-16 09:01:54 UTC
Permalink
I think that Browser needs a specific attention. We need to find a way for not duplicating code and have a Browser that is form factor agnostic. It might be already the case but we need a status and a plan from the team in charge.

Michael, your input is more than welcome.

--
David Scravaglieri
Mozilla - Firefox OS
Post by Wilfred Mathanaraj
Yes - for smartphone this may be of little value but as we move towards a connected devices world the browser will been to have different look and feel for different screen sizes.
e.g. - please don't take this as the areas we are already planning on - We can not have the same browser on TV, Smartphone, watches, car, WoT devices etc
We have not yet defined which devices we may have but its worth keeping our options open and our platform flexible.
BR
Wilfred
---
FxOS Product Management
Mozilla Corp., UK
Browser - one of core mozilla apps but a table stake app for some of the connected devices
What does it mean for the browser app to be split? What was the reason behind this decision? From the smartphone side I see little value, so I'd love to hear about it from the connected devices side.
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
David Scravaglieri
2015-11-16 09:17:23 UTC
Permalink
Just to be clear.

It’s well understood that Browser is not an app. But there is UI involved when using the Browser. So, what I am asking for, is a status and a specific plan for the Browser to be form factor agnostic and to not duplicate code for every and each type of device.

--
David Scravaglieri
Mozilla - Firefox OS
Post by David Scravaglieri
I think that Browser needs a specific attention. We need to find a way for not duplicating code and have a Browser that is form factor agnostic. It might be already the case but we need a status and a plan from the team in charge.
Michael, your input is more than welcome.
--
David Scravaglieri
Mozilla - Firefox OS
Post by Wilfred Mathanaraj
Yes - for smartphone this may be of little value but as we move towards a connected devices world the browser will been to have different look and feel for different screen sizes.
e.g. - please don't take this as the areas we are already planning on - We can not have the same browser on TV, Smartphone, watches, car, WoT devices etc
We have not yet defined which devices we may have but its worth keeping our options open and our platform flexible.
BR
Wilfred
---
FxOS Product Management
Mozilla Corp., UK
Browser - one of core mozilla apps but a table stake app for some of the connected devices
What does it mean for the browser app to be split? What was the reason behind this decision? From the smartphone side I see little value, so I'd love to hear about it from the connected devices side.
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Michael Henretty
2015-11-16 09:55:31 UTC
Permalink
On Mon, Nov 16, 2015 at 10:17 AM, David Scravaglieri <
Post by David Scravaglieri
It’s well understood that Browser is not an app. But there is UI involved
when using the Browser. So, what I am asking for, is a status and a
specific plan for the Browser to be form factor agnostic and to not
duplicate code for every and each type of device.
This sounds like a good plan. We can take a look into what it would require
to separate the UI from the browser app window logic. It would make sense
to coordinate with the TV team here, since they likely have already done
some of that work.
Benjamin Francis
2015-11-16 18:01:32 UTC
Permalink
Post by David Scravaglieri
Just to be clear.
It’s well understood that Browser is not an app. But there is UI involved
when using the Browser. So, what I am asking for, is a status and a
specific plan for the Browser to be form factor agnostic and to not
duplicate code for every and each type of device.
FWIW on the browser item I'm not sure why we'd single out the browser
chrome vs. any other part of the system UI like the status bar, task
manager or notifications tray? As you say, the "browser" in Firefox OS is
no longer an app, it's just one state of a window in the window manager.
With the Alopex experience the browser stands to be even less like an app
(there may not even be a browser icon on the homescreen).

It's possible we could apply the front end/back end split to the search
"app" as it stands, but it seems quite arbitrary to pick out the browser
chrome part of the system UI. We need to take a more holistic look at how
the whole of the system UI can be made more responsive to different form
factors, and whether the new architecture for built-in apps has the same
benefits when applied to the system UI (which I'm guessing probably won't
use the new app format for the foreseeable future).

Note that currently TV uses a completely separate browser app (which
actually is a separate app from tv-system) and the same had been planned
for the smart feature phone UI. We should probably address that
inconsistency first and look at this as part of the wider proposed merger
of the smartphone and TV system apps.

Ben
Joe Cheng
2015-11-17 09:59:28 UTC
Permalink
with regard to TV, merging the system app definitely is something we need
to do (being planned) and also the browser.

some other apps (with obvious front end work) would also need to consider
for TVs are

- Settings
- Software keyboard
- Media apps
- First time experience

Will need to figure out the priorities for each of those and tackle them
one by one

Re,
Joe Cheng
——————————
Mozilla Corp.
On 16 November 2015 at 09:17, David Scravaglieri <
Post by David Scravaglieri
Just to be clear.
It’s well understood that Browser is not an app. But there is UI involved
when using the Browser. So, what I am asking for, is a status and a
specific plan for the Browser to be form factor agnostic and to not
duplicate code for every and each type of device.
FWIW on the browser item I'm not sure why we'd single out the browser
chrome vs. any other part of the system UI like the status bar, task
manager or notifications tray? As you say, the "browser" in Firefox OS is
no longer an app, it's just one state of a window in the window manager.
With the Alopex experience the browser stands to be even less like an app
(there may not even be a browser icon on the homescreen).
It's possible we could apply the front end/back end split to the search
"app" as it stands, but it seems quite arbitrary to pick out the browser
chrome part of the system UI. We need to take a more holistic look at how
the whole of the system UI can be made more responsive to different form
factors, and whether the new architecture for built-in apps has the same
benefits when applied to the system UI (which I'm guessing probably won't
use the new app format for the foreseeable future).
Note that currently TV uses a completely separate browser app (which
actually is a separate app from tv-system) and the same had been planned
for the smart feature phone UI. We should probably address that
inconsistency first and look at this as part of the wider proposed merger
of the smartphone and TV system apps.
Ben
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Sam Foster
2015-11-17 16:25:15 UTC
Permalink
Splitting out the front and backend of Settings might allow us to re-think
the FTE. The first, non-tutorial part of the (phone) FTU app is basically
another front-end on settings and I've long wanted to reduce the amount of
duplicated code involved.

/Sam
Post by Joe Cheng
with regard to TV, merging the system app definitely is something we need
to do (being planned) and also the browser.
some other apps (with obvious front end work) would also need to consider
for TVs are
- Settings
- Software keyboard
- Media apps
- First time experience
Will need to figure out the priorities for each of those and tackle them
one by one
Re,
Joe Cheng
——————————
Mozilla Corp.
On 16 November 2015 at 09:17, David Scravaglieri <
Post by David Scravaglieri
Just to be clear.
It’s well understood that Browser is not an app. But there is UI
involved when using the Browser. So, what I am asking for, is a status and
a specific plan for the Browser to be form factor agnostic and to not
duplicate code for every and each type of device.
FWIW on the browser item I'm not sure why we'd single out the browser
chrome vs. any other part of the system UI like the status bar, task
manager or notifications tray? As you say, the "browser" in Firefox OS is
no longer an app, it's just one state of a window in the window manager.
With the Alopex experience the browser stands to be even less like an app
(there may not even be a browser icon on the homescreen).
It's possible we could apply the front end/back end split to the search
"app" as it stands, but it seems quite arbitrary to pick out the browser
chrome part of the system UI. We need to take a more holistic look at how
the whole of the system UI can be made more responsive to different form
factors, and whether the new architecture for built-in apps has the same
benefits when applied to the system UI (which I'm guessing probably won't
use the new app format for the foreseeable future).
Note that currently TV uses a completely separate browser app (which
actually is a separate app from tv-system) and the same had been planned
for the smart feature phone UI. We should probably address that
inconsistency first and look at this as part of the wider proposed merger
of the smartphone and TV system apps.
Ben
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
David Scravaglieri
2015-11-17 16:51:37 UTC
Permalink
Right !

I'd like to hear about Fred on that. We should re-think Settings from the
ground and take FTE in account.

---
David Scravaglieri
Mozilla - Firefox OS
Post by Sam Foster
Splitting out the front and backend of Settings might allow us to re-think
the FTE. The first, non-tutorial part of the (phone) FTU app is basically
another front-end on settings and I've long wanted to reduce the amount of
duplicated code involved.
/Sam
Post by Joe Cheng
with regard to TV, merging the system app definitely is something we need
to do (being planned) and also the browser.
some other apps (with obvious front end work) would also need to consider
for TVs are
- Settings
- Software keyboard
- Media apps
- First time experience
Will need to figure out the priorities for each of those and tackle them
one by one
Re,
Joe Cheng
——————————
Mozilla Corp.
On 16 November 2015 at 09:17, David Scravaglieri <
Post by David Scravaglieri
Just to be clear.
It’s well understood that Browser is not an app. But there is UI
involved when using the Browser. So, what I am asking for, is a status and
a specific plan for the Browser to be form factor agnostic and to not
duplicate code for every and each type of device.
FWIW on the browser item I'm not sure why we'd single out the browser
chrome vs. any other part of the system UI like the status bar, task
manager or notifications tray? As you say, the "browser" in Firefox OS is
no longer an app, it's just one state of a window in the window manager.
With the Alopex experience the browser stands to be even less like an app
(there may not even be a browser icon on the homescreen).
It's possible we could apply the front end/back end split to the search
"app" as it stands, but it seems quite arbitrary to pick out the browser
chrome part of the system UI. We need to take a more holistic look at how
the whole of the system UI can be made more responsive to different form
factors, and whether the new architecture for built-in apps has the same
benefits when applied to the system UI (which I'm guessing probably won't
use the new app format for the foreseeable future).
Note that currently TV uses a completely separate browser app (which
actually is a separate app from tv-system) and the same had been planned
for the smart feature phone UI. We should probably address that
inconsistency first and look at this as part of the wider proposed merger
of the smartphone and TV system apps.
Ben
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Fred Lin
2015-11-18 13:38:09 UTC
Permalink
Hi Sam,

In current Settings practice, we put code that could be reused between
panels into js/modules[1]
Those modules are independent from UI and we handle 9 wifi related panels
UI in js/panel[2].
Bluetooth app already reuse same modules to handle bluetooth APIs [2].

Though currently Settings use AMD module, therefore it needs some tweaking
for FTU to adapt it. (Or it might be the time to discuss about apply ES6
module on Gaia for future prove code reuse?)
We can discuss more about how to improve the code reusability between gaia
apps (expecially Settings and FTU) during workweek.

1. https://github.com/mozilla-b2g/gaia/tree/master/apps/settings/js/modules
2. https://github.com/mozilla-b2g/gaia/tree/master/apps/settings/js/panels
3. https://github.com/mozilla-b2g/gaia/tree/master/apps/bluetooth#warning.

--
Fred
Post by Sam Foster
Splitting out the front and backend of Settings might allow us to re-think
the FTE. The first, non-tutorial part of the (phone) FTU app is basically
another front-end on settings and I've long wanted to reduce the amount of
duplicated code involved.
/Sam
Post by Joe Cheng
with regard to TV, merging the system app definitely is something we need
to do (being planned) and also the browser.
some other apps (with obvious front end work) would also need to consider
for TVs are
- Settings
- Software keyboard
- Media apps
- First time experience
Will need to figure out the priorities for each of those and tackle them
one by one
Re,
Joe Cheng
——————————
Mozilla Corp.
On 16 November 2015 at 09:17, David Scravaglieri <
Post by David Scravaglieri
Just to be clear.
It’s well understood that Browser is not an app. But there is UI
involved when using the Browser. So, what I am asking for, is a status and
a specific plan for the Browser to be form factor agnostic and to not
duplicate code for every and each type of device.
FWIW on the browser item I'm not sure why we'd single out the browser
chrome vs. any other part of the system UI like the status bar, task
manager or notifications tray? As you say, the "browser" in Firefox OS is
no longer an app, it's just one state of a window in the window manager.
With the Alopex experience the browser stands to be even less like an app
(there may not even be a browser icon on the homescreen).
It's possible we could apply the front end/back end split to the search
"app" as it stands, but it seems quite arbitrary to pick out the browser
chrome part of the system UI. We need to take a more holistic look at how
the whole of the system UI can be made more responsive to different form
factors, and whether the new architecture for built-in apps has the same
benefits when applied to the system UI (which I'm guessing probably won't
use the new app format for the foreseeable future).
Note that currently TV uses a completely separate browser app (which
actually is a separate app from tv-system) and the same had been planned
for the smart feature phone UI. We should probably address that
inconsistency first and look at this as part of the wider proposed merger
of the smartphone and TV system apps.
Ben
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Sam Foster
2015-11-18 19:20:34 UTC
Permalink
I'm fine with migrating FTU to use AMD, or ES6 or whatever module standard
we agree on. But we'll need to either move that modules directory to
shared, or come up with some other config/build magic to make them
accessible to the FTU app. Or, move FTU to the Settings app to actually be
a view on Settings. That may conflict with the expectations of FtuLauncher
though, which wants an origin for the FTU app. We used this same mechanism
for the B2GDroid FTU.

/Sam
Post by Fred Lin
Hi Sam,
In current Settings practice, we put code that could be reused between
panels into js/modules[1]
Those modules are independent from UI and we handle 9 wifi related panels
UI in js/panel[2].
Bluetooth app already reuse same modules to handle bluetooth APIs [2].
Though currently Settings use AMD module, therefore it needs some tweaking
for FTU to adapt it. (Or it might be the time to discuss about apply ES6
module on Gaia for future prove code reuse?)
We can discuss more about how to improve the code reusability between gaia
apps (expecially Settings and FTU) during workweek.
1.
https://github.com/mozilla-b2g/gaia/tree/master/apps/settings/js/modules
2. https://github.com/mozilla-b2g/gaia/tree/master/apps/settings/js/panels
3. https://github.com/mozilla-b2g/gaia/tree/master/apps/bluetooth#warning.
--
Fred
Post by Sam Foster
Splitting out the front and backend of Settings might allow us to
re-think the FTE. The first, non-tutorial part of the (phone) FTU app is
basically another front-end on settings and I've long wanted to reduce the
amount of duplicated code involved.
/Sam
Post by Joe Cheng
with regard to TV, merging the system app definitely is something we
need to do (being planned) and also the browser.
some other apps (with obvious front end work) would also need to
consider for TVs are
- Settings
- Software keyboard
- Media apps
- First time experience
Will need to figure out the priorities for each of those and tackle them
one by one
Re,
Joe Cheng
——————————
Mozilla Corp.
On 16 November 2015 at 09:17, David Scravaglieri <
Post by David Scravaglieri
Just to be clear.
It’s well understood that Browser is not an app. But there is UI
involved when using the Browser. So, what I am asking for, is a status and
a specific plan for the Browser to be form factor agnostic and to not
duplicate code for every and each type of device.
FWIW on the browser item I'm not sure why we'd single out the browser
chrome vs. any other part of the system UI like the status bar, task
manager or notifications tray? As you say, the "browser" in Firefox OS is
no longer an app, it's just one state of a window in the window manager.
With the Alopex experience the browser stands to be even less like an app
(there may not even be a browser icon on the homescreen).
It's possible we could apply the front end/back end split to the search
"app" as it stands, but it seems quite arbitrary to pick out the browser
chrome part of the system UI. We need to take a more holistic look at how
the whole of the system UI can be made more responsive to different form
factors, and whether the new architecture for built-in apps has the same
benefits when applied to the system UI (which I'm guessing probably won't
use the new app format for the foreseeable future).
Note that currently TV uses a completely separate browser app (which
actually is a separate app from tv-system) and the same had been planned
for the smart feature phone UI. We should probably address that
inconsistency first and look at this as part of the wider proposed merger
of the smartphone and TV system apps.
Ben
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
a***@gmail.com
2015-11-17 17:11:58 UTC
Permalink
As ever one of the contributors of the system app, where the browser 'app' live in, I am not convinced by applying NGA in system app. Or let's say I am not convinced by NGA.

Today we benefits from NGA is because we are living in the mobile world: nearly all apps are panel-based architecture. This means you could easily think of the panel is an iframe. But system app is the first exception. Generally speaking, system app is not panel based. It's more complex and I call this 'two-dimensional' application architecture. A new "panel" could come from left side(new appWindow) to replace the active "panel" (current AppWindow), or coming from to side (new attention window) without changing anything except visibility of the active 'panel'. It's impractical to treat this kind of transition as what we have in a normal webapp. We definitely don't want any closing AppWindow to be 'swapped out' from memory right away.

However I agree that we should split UI-related, or DOM related logic from data model related logic, and I believe this could be done without NGA.

Back to the browser 'app' case, regardless the portal page (which is part of search app), it's not difficult to create different browser chrome look and feel for mobile and TV. But what needs to do here is not applying NGA. It will bring us too much trouble, for instance, we will see browser iframe in iframe created by NGA, and it's difficult to maintain the state between the three iframes(system, iframe of NGA, app itself in browser iframe). We just need a TVBrowserChrome submodule and make AppWindow to instantiate it either using build time solution or run time solution.
Fred Lin
2015-11-16 10:49:12 UTC
Permalink
I agree we do need to address the request for easier customize settings to
display information to the user on connecting devices.
But I have some concern about the conclusion (FE/BE split).

I've checked what we already have (TV settings and Smart feature phone
settings) to figure out what connecting devices may use settings.
I found Settings customization (if they want reuse existing Settings) could
be filed into 5 categories:

1. remove unused panels
2. new panel with new settings items
3. new panel with current settings items
4. current panel with removed settings items
5. current panel with new settings items

The FE/BE split might help 4, but can't fulfill the rest of requests.
From my point of view, It might bring more value (for connect device
developers) to deal with following items:

1. wrap features under preprocessor flag (to fullfil 1, 4), which B2Gdroid
already starting to deal with some of them.
2. Make better documentation and helper classes to easy write a new panel
(to fullfil 2, 3. And 5: we may not want to maintain some vendor specific
feature settings inside of Gaia)
2.1. or go further, create definition based panel class to auto generate
simple settings panel (to fullfil 2, 3), which works like android's
PreferenceActivity


regards
--
Fred
Post by Marcus Cavanaugh
What kind of timeline are we aiming for? Given that it's a sorted priority
list, what kind of progress would we need to see for 2.6, 2.7, and beyond
to consider this effort a success?
Nearly half of these key apps are understaffed at best: contacts,
calendar, calculator, and clock have no full-time engineers allocated
afaik. We'll need to actively dedicate people to this project for this to
be successful. (We're hiring, but I wouldn't expect any meaningful
acceleration from hiring efforts until the start of 2.7 development at
best.)
Hi all,
Given the Music app splitting we have done in time for 2.5 we want to
move ahead - I think it makes sense to be executed in a “train model”
fashion.
We should start from the top of the list and work through the list.
When I say splitting of the apps, we are looking for the following
1. FE/BE split
2. Split views
3. Page transition
Why did I choose the priority below? - for now we have 2 products that we
work on: smartphone and TV, but moving forward we need to investigate what
are the products that make sense for us and when we enter the connected
devices market 3rd party developers need to be able to develop differing
views for our core apps.
With this is mind we went through some exercise to define a priority for
the apps to be ported to the updated architecture.
- *Settings* - this is a key app for any product mozilla may be
planning to release; different apps will have different needs to display
information to the user in the settings
- *Camera *- again a key app for a lot of the modern devices
- *Contacts* - everyone wants to have contacts on their devices - but
they need different level of information - creating differing views is
going to key here
- *Calendar* - as with contacts its critical to have differing views
but not as high priority as contacts
- *Gallery* - another core app that every connected device may need
to have
- *E-mail* - typing emails on smaller devices will be a problem and
therefore creating readable email view may be needed for some connected
deviceds
- *Calculator *- table stake app
- *Clock *- table stake app
- *Browser *- one of core mozilla apps but a table stake app for some
of the connected devices
Some of the engineering teams, who have already worked on this split,
will be reaching out in smaller teams to discuss best practices and quick
wins for this activity.
BR
Wilfred
---
FxOS Product Management
Mozilla Corp., UK
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
David Scravaglieri
2015-11-16 11:12:50 UTC
Permalink
Hi Fred,

Thanks for the status.
I think that Settings is maybe the only app that is going to be needed in
any type of device. But I agree with you not all the panels are going to be
useful.
Beyond having a dedicated front-end for every form-factor, when it makes
sense, settings must be more modular to allow customization regarding the
features it presents.
On top of that, the architecture must allow the garbage collector to do its
work, the memory must be managed and released when a view is not needed
anymore.

Smartphone and TV are our current real use case.

Happy to hear about your suggestions for not duplicating code, have a
dedicated front-end for any form factor and manage the memory footprint.

Best,
---
David Scravaglieri
Mozilla - Firefox OS
Post by Fred Lin
I agree we do need to address the request for easier customize settings to
display information to the user on connecting devices.
But I have some concern about the conclusion (FE/BE split).
I've checked what we already have (TV settings and Smart feature phone
settings) to figure out what connecting devices may use settings.
I found Settings customization (if they want reuse existing Settings)
1. remove unused panels
2. new panel with new settings items
3. new panel with current settings items
4. current panel with removed settings items
5. current panel with new settings items
The FE/BE split might help 4, but can't fulfill the rest of requests.
From my point of view, It might bring more value (for connect device
1. wrap features under preprocessor flag (to fullfil 1, 4), which B2Gdroid
already starting to deal with some of them.
2. Make better documentation and helper classes to easy write a new panel
(to fullfil 2, 3. And 5: we may not want to maintain some vendor specific
feature settings inside of Gaia)
2.1. or go further, create definition based panel class to auto generate
simple settings panel (to fullfil 2, 3), which works like android's
PreferenceActivity
regards
--
Fred
Post by Marcus Cavanaugh
What kind of timeline are we aiming for? Given that it's a sorted
priority list, what kind of progress would we need to see for 2.6, 2.7, and
beyond to consider this effort a success?
Nearly half of these key apps are understaffed at best: contacts,
calendar, calculator, and clock have no full-time engineers allocated
afaik. We'll need to actively dedicate people to this project for this to
be successful. (We're hiring, but I wouldn't expect any meaningful
acceleration from hiring efforts until the start of 2.7 development at
best.)
Hi all,
Given the Music app splitting we have done in time for 2.5 we want to
move ahead - I think it makes sense to be executed in a “train model”
fashion.
We should start from the top of the list and work through the list.
When I say splitting of the apps, we are looking for the following
1. FE/BE split
2. Split views
3. Page transition
Why did I choose the priority below? - for now we have 2 products that
we work on: smartphone and TV, but moving forward we need to investigate
what are the products that make sense for us and when we enter the
connected devices market 3rd party developers need to be able to develop
differing views for our core apps.
With this is mind we went through some exercise to define a priority for
the apps to be ported to the updated architecture.
- *Settings* - this is a key app for any product mozilla may be
planning to release; different apps will have different needs to display
information to the user in the settings
- *Camera *- again a key app for a lot of the modern devices
- *Contacts* - everyone wants to have contacts on their devices -
but they need different level of information - creating differing views is
going to key here
- *Calendar* - as with contacts its critical to have differing views
but not as high priority as contacts
- *Gallery* - another core app that every connected device may need
to have
- *E-mail* - typing emails on smaller devices will be a problem and
therefore creating readable email view may be needed for some connected
deviceds
- *Calculator *- table stake app
- *Clock *- table stake app
- *Browser *- one of core mozilla apps but a table stake app for
some of the connected devices
Some of the engineering teams, who have already worked on this split,
will be reaching out in smaller teams to discuss best practices and quick
wins for this activity.
BR
Wilfred
---
FxOS Product Management
Mozilla Corp., UK
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
z***@mozilla.com
2015-11-19 21:39:55 UTC
Permalink
As you are moving your app to "NGA", please follow those rules as well:

1) No l10n on back-end. All l10n on front-end[0].
2) No mozL10n.get. All data-l10n-id/args, in very rare cases - mozL10n.formatValue
3) If you are reworking UI, use shared/intl/l20n.js, not shared/l10n.js
4) If you have split views, use shared/intl/l20n-service|client.js

Thanks!
zb.






[0] Exceptions may exist, they are rare. You case is probably not one of them. When in doubt, ni? me or stas :)
Andrew Sutherland
2015-11-19 21:52:29 UTC
Permalink
Post by z***@mozilla.com
1) No l10n on back-end. All l10n on front-end[0].
[0] Exceptions may exist, they are rare. You case is probably not one of them. When in doubt, ni? me or stas :)
What's the plan for this and service-workers? Specifically,
background-y APIs are all moving to targeting service workers, replacing
our system message mechanism that wakes up content pages directly.
Specifically, it seems like the push API
(https://w3c.github.io/push-api/), background sync API
(https://wicg.github.io/BackgroundSync/spec/), and others are intended
to be processed in service workers and notifications generated
(https://notifications.spec.whatwg.org/) without necessarily waking
up/creating a front-end/content page.

It's not a problem right now for most of the special cases because we
always have to have a content-page around, but it seems like it will be
an architectural problem if we need to spin-up content pages once
service workers are more fleshed out and we start to move over to
standardized APIs.

Andrew
Staś Małolepszy
2015-11-26 13:32:06 UTC
Permalink
On Thu, Nov 19, 2015 at 10:52 PM, Andrew Sutherland <
Post by z***@mozilla.com
1) No l10n on back-end. All l10n on front-end[0].
[0] Exceptions may exist, they are rare. You case is probably not one of
them. When in doubt, ni? me or stas :)
What's the plan for this and service-workers? Specifically, background-y
APIs are all moving to targeting service workers, replacing our system
message mechanism that wakes up content pages directly. Specifically, it
seems like the push API (https://w3c.github.io/push-api/), background
sync API (https://wicg.github.io/BackgroundSync/spec/), and others are
intended to be processed in service workers and notifications generated (
https://notifications.spec.whatwg.org/) without necessarily waking
up/creating a front-end/content page.
It's not a problem right now for most of the special cases because we
always have to have a content-page around, but it seems like it will be an
architectural problem if we need to spin-up content pages once service
workers are more fleshed out and we start to move over to standardized APIs.
Thanks for bringing this up, Andrew. I don't have specific answers right
now, but we've been thinking about this for a while now. We've also run
into this problem in some capacity when migrating the Music app to NGA:
the localized name of the current view comes from the view itself but needs
to be shown in the container's gaia-header. In such scenario we need to
send the localized string from the view to the container, because the
container doesn't have the necessary strings to make do with an l10n id.

There are two main reasons for preferring the l10n id approach over the
'send the translation and let the consumer code insert it into the DOM':

- l10n/l20n.js is generally better at inserting things into the DOM: it
knows how to handle localizable attributes and also supports some HTML in
the translation in a secure manner,
- by using the l10n-id we can make sure the element is re-translated
automatically when the user changes the language.

With system messages, the second benefit isn't very important: we'll
usually want to just show the notification once and be done with it. It's
still interesting to consider the question of the language in which the
notification should be displayed. If we're sending the translation
verbatim, we need to know the user's preferred language upfront, when the
payload is created.

As for the first benefit, I filed
https://bugzilla.mozilla.org/show_bug.cgi?id=1228021 to explore an API that
would allow us to apply a resolved translation value to an element, using
the same logic that is used when the localization is done declaratively
with data-l10n-id or with l10n.translateFragment.

-stas
z***@mozilla.com
2015-11-20 08:17:01 UTC
Permalink
Post by Andrew Sutherland
Post by z***@mozilla.com
1) No l10n on back-end. All l10n on front-end[0].
[0] Exceptions may exist, they are rare. You case is probably not one of them. When in doubt, ni? me or stas :)
What's the plan for this and service-workers? Specifically,
background-y APIs are all moving to targeting service workers, replacing
our system message mechanism that wakes up content pages directly.
I don't know!

Let's find out together. I believe that it's an uncharted territory that we have to yet discover.

My naive guess here is that we should think of code that "sends" data to third-party services like notifications/alarms etc. should handle l10n the same way as front-end does.

I'm a bit afraid of getting this mingled with real back-end and ending up with back-end that resolves localization strings because they need them for notifications but then, slowly expands to store localized strings for its front-end as well, so I'd love to see this back-end "front-end" code that sends notifications and alarms somehow isolated, but unless there's other reason to do that, we'll have to just be mindful. :)

zb.
Andrew Sutherland
2015-11-21 01:52:57 UTC
Permalink
Post by z***@mozilla.com
I'm a bit afraid of getting this mingled with real back-end and ending up with back-end that resolves localization strings because they need them for notifications but then, slowly expands to store localized strings for its front-end as well, so I'd love to see this back-end "front-end" code that sends notifications and alarms somehow isolated, but unless there's other reason to do that, we'll have to just be mindful. :)
A thing we've been doing in the email app conversations branch (which
uses require.js-style AMD modules) is to have the back-end require()
modules provided by the front-end. For example, the back-end does
require('app_logic/conv_churn') to get the front-end-provided helper
method that decides what (extra) information goes in the conversation
summary object.

And this is what I plan to do for the periodic sync implementation on
the conversations branch. The front-end gets to decide what it wants
the notifications to look like, so it provides the logic and the strings
and formats them.

But this is where we get into a terminology problem. What would be
desired is for that front-end provided logic to be running in the
back-end's Worker/SharedWorker/ServiceWorker. So it is front-end logic,
but in a back-end context, in a way. And it looks like all the code in
https://github.com/mozilla-b2g/gaia/blob/master/shared/js/intl/ is
assuming that it's operating in a Window, not a *Worker. (Or maybe
that's misleading and a side-effect of an overzealous transpiler/bundler?)

So I guess my question is: Is it currently possible or eventually
planned to allow the l20n.js code to run in a worker context?

Andrew

PS: Relatedly, after looking at that directory: It is possible to put a
README.md in gaia/shared/js/intl that explains that the code is
transpiled from https://github.com/l20n/l20n.js or wherever it comes
from? That's likely to save intrepid explorers a lot of headaches!
Staś Małolepszy
2015-11-26 15:39:45 UTC
Permalink
On Sat, Nov 21, 2015 at 2:52 AM, Andrew Sutherland <
Post by Andrew Sutherland
But this is where we get into a terminology problem. What would be
desired is for that front-end provided logic to be running in the
back-end's Worker/SharedWorker/ServiceWorker. So it is front-end logic,
but in a back-end context, in a way. And it looks like all the code in
https://github.com/mozilla-b2g/gaia/blob/master/shared/js/intl/ is
assuming that it's operating in a Window, not a *Worker. (Or maybe that's
misleading and a side-effect of an overzealous transpiler/bundler?)
So I guess my question is: Is it currently possible or eventually planned
to allow the l20n.js code to run in a worker context?
Currently it's not possible to run the l20n "service" in a worker context,
but the client/service split is recent and we're definitely working towards
the goal of making that possible!

The reason we currently refer to document and window is that we store the
state of the language negotiation in the l20n service and to set the
initial value we need to read the list of available languages from the
document's <head>, and also need a way to react to the language changes on
the window's languagechange event. This is currently done in
l20n-service.js but I have an idea how to move this to the client. With
that change, we should be able to run the service in a worker context, and
that's something I really really want because I'd like to move l20n into a
service worker in the future.

I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1228348 to track this.

-stas
r***@mozilla.com
2015-11-21 03:38:21 UTC
Permalink
Post by Andrew Sutherland
Post by z***@mozilla.com
I'm a bit afraid of getting this mingled with real back-end and ending up with back-end that resolves localization strings because they need them for notifications but then, slowly expands to store localized strings for its front-end as well, so I'd love to see this back-end "front-end" code that sends notifications and alarms somehow isolated, but unless there's other reason to do that, we'll have to just be mindful. :)
A thing we've been doing in the email app conversations branch (which
uses require.js-style AMD modules) is to have the back-end require()
modules provided by the front-end. For example, the back-end does
require('app_logic/conv_churn') to get the front-end-provided helper
method that decides what (extra) information goes in the conversation
summary object.
And this is what I plan to do for the periodic sync implementation on
the conversations branch. The front-end gets to decide what it wants
the notifications to look like, so it provides the logic and the strings
and formats them.
But this is where we get into a terminology problem. What would be
desired is for that front-end provided logic to be running in the
back-end's Worker/SharedWorker/ServiceWorker. So it is front-end logic,
but in a back-end context, in a way. And it looks like all the code in
https://github.com/mozilla-b2g/gaia/blob/master/shared/js/intl/ is
assuming that it's operating in a Window, not a *Worker. (Or maybe
that's misleading and a side-effect of an overzealous transpiler/bundler?)
So I guess my question is: Is it currently possible or eventually
planned to allow the l20n.js code to run in a worker context?
Andrew
PS: Relatedly, after looking at that directory: It is possible to put a
README.md in gaia/shared/js/intl that explains that the code is
transpiled from https://github.com/l20n/l20n.js or wherever it comes
from? That's likely to save intrepid explorers a lot of headaches!
Thinking about the API discussions on this thread, I have come to a place similar to what Andrew has just communicated. My thought is that it's too early in the "NGA conversion process" to choose a specific API mechanism for making the front-end/back-end separation. I believe it would be extremely useful to have practical experience with both the implementations being discussed (it seems most of the conversations are regarding HTTP vs. javascript) to better understand their value to us. We already have the benefit of the music app using an HTTP API; it seems likely that in the 2.6 timeframe there could be a gallery app with a javascript-based API supporting its front/back-end separation. Having actual implementations using a couple of known, popular API mechanisms will help us make informed decisions as we continue to evolve the platform and apps.

-Russ
Justin D'Arcangelo
2015-11-21 04:24:33 UTC
Permalink
Post by r***@mozilla.com
Post by Andrew Sutherland
Post by z***@mozilla.com
I'm a bit afraid of getting this mingled with real back-end and ending up with back-end that resolves localization strings because they need them for notifications but then, slowly expands to store localized strings for its front-end as well, so I'd love to see this back-end "front-end" code that sends notifications and alarms somehow isolated, but unless there's other reason to do that, we'll have to just be mindful. :)
A thing we've been doing in the email app conversations branch (which
uses require.js-style AMD modules) is to have the back-end require()
modules provided by the front-end. For example, the back-end does
require('app_logic/conv_churn') to get the front-end-provided helper
method that decides what (extra) information goes in the conversation
summary object.
And this is what I plan to do for the periodic sync implementation on
the conversations branch. The front-end gets to decide what it wants
the notifications to look like, so it provides the logic and the strings
and formats them.
But this is where we get into a terminology problem. What would be
desired is for that front-end provided logic to be running in the
back-end's Worker/SharedWorker/ServiceWorker. So it is front-end logic,
but in a back-end context, in a way. And it looks like all the code in
https://github.com/mozilla-b2g/gaia/blob/master/shared/js/intl/ is
assuming that it's operating in a Window, not a *Worker. (Or maybe
that's misleading and a side-effect of an overzealous transpiler/bundler?)
So I guess my question is: Is it currently possible or eventually
planned to allow the l20n.js code to run in a worker context?
Andrew
PS: Relatedly, after looking at that directory: It is possible to put a
README.md in gaia/shared/js/intl that explains that the code is
transpiled from https://github.com/l20n/l20n.js or wherever it comes
from? That's likely to save intrepid explorers a lot of headaches!
Thinking about the API discussions on this thread, I have come to a place similar to what Andrew has just communicated. My thought is that it's too early in the "NGA conversion process" to choose a specific API mechanism for making the front-end/back-end separation. I believe it would be extremely useful to have practical experience with both the implementations being discussed (it seems most of the conversations are regarding HTTP vs. javascript) to better understand their value to us. We already have the benefit of the music app using an HTTP API; it seems likely that in the 2.6 timeframe there could be a gallery app with a javascript-based API supporting its front/back-end separation. Having actual implementations using a couple of known, popular API mechanisms will help us make informed decisions as we continue to evolve the platform and apps.
-Russ
To be extra clear here about the back-end API in the Music app, the HTTP API we expose is nothing more than a thin wrapper around a bridge.js “JavaScript” API. But, we chose to impose certain limitations on our “JavaScript” API so that every method was handled via an async call and response in order to make it possible for such a thin HTTP wrapper to exist easily.

Therefore, these HTTP API methods:

https://github.com/mozilla-b2g/gaia/blob/master/apps/music/js/view.js#L10-L54 <https://github.com/mozilla-b2g/gaia/blob/master/apps/music/js/view.js#L10-L54>

map up to these bridge.js API methods:

https://github.com/mozilla-b2g/gaia/blob/master/apps/music/js/endpoint.js#L17-L67 <https://github.com/mozilla-b2g/gaia/blob/master/apps/music/js/endpoint.js#L17-L67>

We should already have a pretty clear understanding of what the pros and cons of both approaches are. For example, with traditional HTTP APIs, you expect to send a request to the back-end and get an async response in a single shot. However, this means that certain types of API calls involving enumeration must be thought about differently. One such example is the way the Music app used to enumerate MediaDB was to pass a callback function to the query which would get called iteratively for each record in the results. This implies a stream-like behavior that is not currently supported over HTTP through ServiceWorkers AFAIK.

One valid reason I’ve heard from Jim in favor of this type of iterator callback API is that it would allow the first few records of data in a given query to be put on-screen faster. That being said, there are several ways to solve the “get data on-screen fast” problem with an HTTP API, one of which is to have paginated calls so you can get the first 10-20 records super-fast and defer the query for the remaining items. Another solution is “better caching” which can be solved any number of various ways via ServiceWorkers or other means.
Post by r***@mozilla.com
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Jim Porter
2015-11-22 20:52:33 UTC
Permalink
One valid reason I’ve heard from Jim in favor of this type of iterator
callback API is that it would allow the first few records of data in a
given query to be put on-screen faster. That being said, there are
several ways to solve the “get data on-screen fast” problem with an HTTP
API, one of which is to have paginated calls so you can get the first
10-20 records super-fast and defer the query for the remaining items.
Another solution is “better caching” which can be solved any number of
various ways via ServiceWorkers or other means.
One of the benefits of a callback-based API over pagination/batching
results into groups is that it's simpler. Obviously, indexedDB already
works like this (indeed, so do many database APIs). Designing the APIs
that will sit "on top" of indexedDB to work in a similar way as
indexedDB keeps minimizes complexity and removes one source of possible
bugs or performance issues. If the Music backend's API used one callback
call per item, our glue code could be quite a bit simpler compared to
code that paginated the results.

This underscores one of my main issues with parts of the NGA work. While
we can still achieve good performance (e.g. by paginating results or
taking advantage of caching at another level, like in gaia-fast-list),
it requires us to be smarter. For the most part, OGA allowed us to write
"dumb" code and still achieve good performance. We did have
"advancedEnumerate", but that's just a regular enumeration where we skip
the first N results. A hypothetical version of OGA Music that used
gaia-fast-list might not even need that.

In my experience, the best APIs are the ones that don't force users to
write complex/clever code to get good performance. Good APIs should try
to hide complexity from the user and make it obvious how to get the best
results from it. Then we can spend our effort on other hard problems.

All of this doesn't mean that Service Workers will never be a good idea,
but I think we'd have to show that they're better for a particular app
than bridge.js (or even than a single-document app). Currently, I think
Service Workers are strictly worse than bridge.js, since the former has
worse performance and fewer features compared to the latter. While being
able to flip a switch and use Service Workers in the Music app is a nice
way to test them out, I don't think this benefits the Music app today.

Given the choice, I'd rather take advantage of all the niceties that
bridge.js has to offer and then tell the people working on Service
Workers, "here are the things we need in order for Service Workers to
provide value for us." If and when those things are supported, we can
switch to Service Workers, which hopefully will be a relatively simple
task if we've designed our codebase well.

- Jim
Vivien Nicolas
2015-11-23 10:00:47 UTC
Permalink
Folks,

The discussion between using a js based API or an HTTP API has a lot of
values and for my part I see advantages in both. But this is a technical
discussion that will better suited its own dedicated thread, no ?

Vivien.
Post by Jim Porter
Post by Justin D'Arcangelo
One valid reason I’ve heard from Jim in favor of this type of iterator
callback API is that it would allow the first few records of data in a
given query to be put on-screen faster. That being said, there are
several ways to solve the “get data on-screen fast” problem with an HTTP
API, one of which is to have paginated calls so you can get the first
10-20 records super-fast and defer the query for the remaining items.
Another solution is “better caching” which can be solved any number of
various ways via ServiceWorkers or other means.
One of the benefits of a callback-based API over pagination/batching
results into groups is that it's simpler. Obviously, indexedDB already
works like this (indeed, so do many database APIs). Designing the APIs
that will sit "on top" of indexedDB to work in a similar way as
indexedDB keeps minimizes complexity and removes one source of possible
bugs or performance issues. If the Music backend's API used one callback
call per item, our glue code could be quite a bit simpler compared to
code that paginated the results.
This underscores one of my main issues with parts of the NGA work. While
we can still achieve good performance (e.g. by paginating results or
taking advantage of caching at another level, like in gaia-fast-list),
it requires us to be smarter. For the most part, OGA allowed us to write
"dumb" code and still achieve good performance. We did have
"advancedEnumerate", but that's just a regular enumeration where we skip
the first N results. A hypothetical version of OGA Music that used
gaia-fast-list might not even need that.
In my experience, the best APIs are the ones that don't force users to
write complex/clever code to get good performance. Good APIs should try
to hide complexity from the user and make it obvious how to get the best
results from it. Then we can spend our effort on other hard problems.
All of this doesn't mean that Service Workers will never be a good idea,
but I think we'd have to show that they're better for a particular app
than bridge.js (or even than a single-document app). Currently, I think
Service Workers are strictly worse than bridge.js, since the former has
worse performance and fewer features compared to the latter. While being
able to flip a switch and use Service Workers in the Music app is a nice
way to test them out, I don't think this benefits the Music app today.
Given the choice, I'd rather take advantage of all the niceties that
bridge.js has to offer and then tell the people working on Service
Workers, "here are the things we need in order for Service Workers to
provide value for us." If and when those things are supported, we can
switch to Service Workers, which hopefully will be a relatively simple
task if we've designed our codebase well.
- Jim
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
David Flanagan
2015-11-20 04:38:40 UTC
Permalink
I've been thinking a lot about this thread in the context of Ari's talk at
the All Hands meeting yesterday. We're working on an OS that has to run on
smartphones, smart tv's and other form factors tbd. Ari asked us to focus
on portability, and that obviously will be key to our ability to run on
different form factors.

I had something of an epiphany today: In the future, teams inside and
outside of Mozilla will build devices that run FirefoxOS and will create
products that provide true user value and delight. At this moment we don't
know what those products will be. So for core FirefoxOS developers, our
users are these future product development teams. We need to be building an
OS that is so fast and flexible, so portable and performant that product
developers will feel delight using our platform.

With that in mind, I'd like to suggest that we'd be better served by
focusing on web components than by working on NGA.

Converting our building blocks to web components and then refactoring our
apps to use those components and to be based on higher-level web components
will give us much of the modularity and portability that we're seeking from
NGA, but at the same time, it will also create a high-quality library of
reusable UI components that third party app authors (including those who
are embedding FirefoxOS in new products) can use to more easily create apps.

David
Hi all,
Given the Music app splitting we have done in time for 2.5 we want to move
ahead - I think it makes sense to be executed in a “train model” fashion.
We should start from the top of the list and work through the list.
When I say splitting of the apps, we are looking for the following
1. FE/BE split
2. Split views
3. Page transition
Why did I choose the priority below? - for now we have 2 products that we
work on: smartphone and TV, but moving forward we need to investigate what
are the products that make sense for us and when we enter the connected
devices market 3rd party developers need to be able to develop differing
views for our core apps.
With this is mind we went through some exercise to define a priority for
the apps to be ported to the updated architecture.
- *Settings* - this is a key app for any product mozilla may be
planning to release; different apps will have different needs to display
information to the user in the settings
- *Camera *- again a key app for a lot of the modern devices
- *Contacts* - everyone wants to have contacts on their devices - but
they need different level of information - creating differing views is
going to key here
- *Calendar* - as with contacts its critical to have differing views
but not as high priority as contacts
- *Gallery* - another core app that every connected device may need
to have
- *E-mail* - typing emails on smaller devices will be a problem and
therefore creating readable email view may be needed for some connected
deviceds
- *Calculator *- table stake app
- *Clock *- table stake app
- *Browser *- one of core mozilla apps but a table stake app for some
of the connected devices
Some of the engineering teams, who have already worked on this split, will
be reaching out in smaller teams to discuss best practices and quick wins
for this activity.
BR
Wilfred
---
FxOS Product Management
Mozilla Corp., UK
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Justin D'Arcangelo
2015-11-20 05:19:01 UTC
Permalink
First off, I agree with David that we should be focusing on web components. Having worked with them extensively over the past few months, they add tremendous value in terms of code reuse and general code cleanliness and encapsulation.

However, web components only solve our problems on the surface in the UI of our apps. The Gaia apps contain an enormous amount of complexity and business logic that is not in the UI. For instance, the Music app needs to use a complex metadata parser in conjunction with DeviceStorage and IndexedDB to scan and store the contents of a user’s music library. What NGA brings to the table, in this regard, is the ability to craft an easy-to-consume developer API for the app. When we talk about separating the front-end from the back-end in terms of “NGA”, we are really talking about defining this developer API for the back-end and exposing it via an HTTP API. This allows a traditional web developer, who is used to working with server-side HTTP APIs, to jump right in and get up and running.

In the case of the Music app, you can see the full list of HTTP APIs here:

https://github.com/mozilla-b2g/gaia/blob/master/apps/music/js/view.js#L10-L54 <https://github.com/mozilla-b2g/gaia/blob/master/apps/music/js/view.js#L10-L54>

As for the front-end of things with NGA, our “views” are simply mini-apps themselves. A single “view", at the very least, is just an HTML file to define the view’s markup end a JS file to wire up the DOM and call the HTTP API in the back-end.

This past week I started experimenting with adapting the Music app to work on TV. Within an hour, I was able to just drop in a couple new “views” that were TV-friendly versions of what we have in the regular phone version of the app. Specifically, the Music app normally launches to the “tiles” view and is obviously reliant on touch events for tapping on albums to start playing them. This needed to be wired up a little differently for TV because we needed to be able to use the arrow keys on the TV remote to move the highlighting “cursor” around from album-to-album. In a very simplified nutshell, here’s what the “tiles” view needs to do:

- Perform an HTTP request to the back-end URL “/api/albums”
- Loop over the response from the back-end and generate the HTML
- Attach an “onclick” event handler for the tiles to start playing the album
- To play the album, we perform an HTTP request to the back-end URL “/api/queue/album/{album_id}"

As you can see, these look very much like things your average web developer would be familiar with. So, to do a TV version of this “tiles” view, I simply created a copy of the phone “tiles” view into another folder called “tiles-tv”. For the TV version of the “tiles” view, the operations I needed to do were very similar:

- Perform an HTTP request to the back-end URL “/api/albums”
- Loop over the response from the back-end and generate the HTML
- Attach a “keydown” event handler for moving the focus highlighting around between tiles
- When the user presses [Enter], we perform an HTTP request to the back-end URL “/api/queue/album/{album_id}”

I was also able to provide a completely different CSS stylesheet for my TV-optimized “tiles” view. This was also extraordinarily easy because the regular phone version of the “tiles” view has its own CSS file that only deals with styles related to just that one view.

The key takeaway here is that defining a clear and easy-to-use HTTP back-end for our apps is extremely helpful in achieving a very clear separation of logic between front-end and back-end. It also provides a way for regular web developers to jump in and customize the front-ends of our apps without having to understand all the complexity that we deal with in the back-end. The other important point to note is that the NGA method of separating our “views” in the front-end allows us to swap out entire screens in our apps wholesale. Our “views” are really just simple “mini-apps” themselves and because of this, I firmly believe that this architecture will help us take on unknown form factors in the future.

-Justin
I've been thinking a lot about this thread in the context of Ari's talk at the All Hands meeting yesterday. We're working on an OS that has to run on smartphones, smart tv's and other form factors tbd. Ari asked us to focus on portability, and that obviously will be key to our ability to run on different form factors.
I had something of an epiphany today: In the future, teams inside and outside of Mozilla will build devices that run FirefoxOS and will create products that provide true user value and delight. At this moment we don't know what those products will be. So for core FirefoxOS developers, our users are these future product development teams. We need to be building an OS that is so fast and flexible, so portable and performant that product developers will feel delight using our platform.
With that in mind, I'd like to suggest that we'd be better served by focusing on web components than by working on NGA.
Converting our building blocks to web components and then refactoring our apps to use those components and to be based on higher-level web components will give us much of the modularity and portability that we're seeking from NGA, but at the same time, it will also create a high-quality library of reusable UI components that third party app authors (including those who are embedding FirefoxOS in new products) can use to more easily create apps.
David
Hi all,
Given the Music app splitting we have done in time for 2.5 we want to move ahead - I think it makes sense to be executed in a “train model” fashion.
We should start from the top of the list and work through the list.
1. FE/BE split
2. Split views
3. Page transition
Why did I choose the priority below? - for now we have 2 products that we work on: smartphone and TV, but moving forward we need to investigate what are the products that make sense for us and when we enter the connected devices market 3rd party developers need to be able to develop differing views for our core apps.
With this is mind we went through some exercise to define a priority for the apps to be ported to the updated architecture.
Settings - this is a key app for any product mozilla may be planning to release; different apps will have different needs to display information to the user in the settings
Camera - again a key app for a lot of the modern devices
Contacts - everyone wants to have contacts on their devices - but they need different level of information - creating differing views is going to key here
Calendar - as with contacts its critical to have differing views but not as high priority as contacts
Gallery - another core app that every connected device may need to have
E-mail - typing emails on smaller devices will be a problem and therefore creating readable email view may be needed for some connected deviceds
Calculator - table stake app
Clock - table stake app
Browser - one of core mozilla apps but a table stake app for some of the connected devices
Some of the engineering teams, who have already worked on this split, will be reaching out in smaller teams to discuss best practices and quick wins for this activity.
BR
Wilfred
---
FxOS Product Management
Mozilla Corp., UK
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos <https://lists.mozilla.org/listinfo/dev-fxos>
Vivien Nicolas
2015-11-20 10:18:09 UTC
Permalink
Post by Justin D'Arcangelo
First off, I agree with David that we should be focusing on web
components. Having worked with them extensively over the past few months,
they add tremendous value in terms of code reuse and general code
cleanliness and encapsulation.
It is not a big surprise that I agree with many things Justin says. But I
want to pile a bit on Web Components beeing a magic answer.

As stated in the Architecture Proposal
<https://wiki.mozilla.org/Gaia/Architecture_Proposal#Disclaimers> since the
beginning:

"This model is not about using x, y or z. It is technology agnostic and
uses very basic primitives of the Web. Various technologies can be put on
top of that (module UI, React, Web Components, etc.) and can actually be
benchmarked with real data from users using Telemetry."

The goal of the architectural changes which are proposed is *not* to
enforce a UI solution. So it sounds strange to be able to replace all the
proposal, which is a set of different pieces (aka Service Workers, Data
Sync, Telemetry, ...) by a single answer. Especially one that is so highly
UI related.

Now if we want to dive in the UI world, yes, a component system is
definitively something we should all be looking at for *consistency*,
*maintainability* and *performance*.

What this component system should be, is not part of the proposal,
specifically to avoid the confusion between what components are used for,
and what the proposal is about.

Now, it is understandable that Web Components is the default choice of many
Gaia developers as a component mechanism.
I would even validate the choice, if we do have dedicated raptor tests to
validate their performance and ensure they do not regress over time (which
is often the fate of a code that starts small and slowly by slowly get more
features).
Without raptor test it could not be proven that they will answer the
*performance* criteria over time.

Having a dedicated set of people that works on it, is definitively part of
the plan that nobody knows but is the companion of the new architecture
proposal: Architecture Transition Plan
<https://wiki.mozilla.org/Gaia/Architecture_Transition_Proposal#Toolkit_Team>

But it would be a shame to focus all our efforts in something that a third
party may not even consider.

If someone wants to ship a FirefoxOS powered device, it may rewrite all the
UI, or just some parts, to please itself or its own UI/UX team. This custom
solution may use a completely different framework, like React for example.
If all our efforts has been focused on Web Components, all our work will
basically be garbage for them (even for us if one day someone prove that a
new UI framework is way more modular and performant).

This is why defining a clear backend API that can be easily documented is
important. Beeing able to prove that the backend is not tied to the UI at
all is important too (this is one of the reason of beeing able to run it in
a Worker, you can prove it does not rely on DOM apis or front-end specific
logic).

This is why offering caching APIs via Service Worker, not tied to a
specific UI framework too, is important as well. To ensure that whatever
framework is choosen, people can benefit from caching to help performance.

This is why Data Sync is important. Whatever UI framework is used, users
will get their datas.

Etc...

Vivien.
Post by Justin D'Arcangelo
However, web components only solve our problems on the surface in the UI
of our apps. The Gaia apps contain an enormous amount of complexity and
business logic that is not in the UI. For instance, the Music app needs to
use a complex metadata parser in conjunction with DeviceStorage and
IndexedDB to scan and store the contents of a user’s music library. What
NGA brings to the table, in this regard, is the ability to craft an
easy-to-consume developer API for the app. When we talk about separating
the front-end from the back-end in terms of “NGA”, we are really talking
about defining this developer API for the back-end and exposing it via an
HTTP API. This allows a traditional web developer, who is used to working
with server-side HTTP APIs, to jump right in and get up and running.
https://github.com/mozilla-b2g/gaia/blob/master/apps/music/js/view.js#L10-L54
As for the front-end of things with NGA, our “views” are simply mini-apps
themselves. A single “view", at the very least, is just an HTML file to
define the view’s markup end a JS file to wire up the DOM and call the HTTP
API in the back-end.
This past week I started experimenting with adapting the Music app to work
on TV. Within an hour, I was able to just drop in a couple new “views” that
were TV-friendly versions of what we have in the regular phone version of
the app. Specifically, the Music app normally launches to the “tiles” view
and is obviously reliant on touch events for tapping on albums to start
playing them. This needed to be wired up a little differently for TV
because we needed to be able to use the arrow keys on the TV remote to move
the highlighting “cursor” around from album-to-album. In a very simplified
- Perform an HTTP request to the back-end URL “/api/albums”
- Loop over the response from the back-end and generate the HTML
- Attach an “onclick” event handler for the tiles to start playing the album
- To play the album, we perform an HTTP request to the back-end URL
“/api/queue/album/{album_id}"
As you can see, these look very much like things your average web
developer would be familiar with. So, to do a TV version of this “tiles”
view, I simply created a copy of the phone “tiles” view into another folder
called “tiles-tv”. For the TV version of the “tiles” view, the operations I
- Perform an HTTP request to the back-end URL “/api/albums”
- Loop over the response from the back-end and generate the HTML
- Attach a “keydown” event handler for moving the focus highlighting
around between tiles
- When the user presses [Enter], we perform an HTTP request to the
back-end URL “/api/queue/album/{album_id}”
I was also able to provide a completely different CSS stylesheet for my
TV-optimized “tiles” view. This was also extraordinarily easy because the
regular phone version of the “tiles” view has its own CSS file that only
deals with styles related to just that one view.
The key takeaway here is that defining a clear and easy-to-use HTTP
back-end for our apps is extremely helpful in achieving a very clear
separation of logic between front-end and back-end. It also provides a way
for regular web developers to jump in and customize the front-ends of our
apps without having to understand all the complexity that we deal with in
the back-end. The other important point to note is that the NGA method of
separating our “views” in the front-end allows us to swap out entire
screens in our apps wholesale. Our “views” are really just simple
“mini-apps” themselves and because of this, I firmly believe that this
architecture will help us take on unknown form factors in the future.
-Justin
I've been thinking a lot about this thread in the context of Ari's talk at
the All Hands meeting yesterday. We're working on an OS that has to run on
smartphones, smart tv's and other form factors tbd. Ari asked us to focus
on portability, and that obviously will be key to our ability to run on
different form factors.
I had something of an epiphany today: In the future, teams inside and
outside of Mozilla will build devices that run FirefoxOS and will create
products that provide true user value and delight. At this moment we don't
know what those products will be. So for core FirefoxOS developers, our
users are these future product development teams. We need to be building an
OS that is so fast and flexible, so portable and performant that product
developers will feel delight using our platform.
With that in mind, I'd like to suggest that we'd be better served by
focusing on web components than by working on NGA.
Converting our building blocks to web components and then refactoring our
apps to use those components and to be based on higher-level web components
will give us much of the modularity and portability that we're seeking from
NGA, but at the same time, it will also create a high-quality library of
reusable UI components that third party app authors (including those who
are embedding FirefoxOS in new products) can use to more easily create apps.
David
Hi all,
Given the Music app splitting we have done in time for 2.5 we want to
move ahead - I think it makes sense to be executed in a “train model”
fashion.
We should start from the top of the list and work through the list.
1. FE/BE split
2. Split views
3. Page transition
Why did I choose the priority below? - for now we have 2 products that we
work on: smartphone and TV, but moving forward we need to investigate what
are the products that make sense for us and when we enter the connected
devices market 3rd party developers need to be able to develop differing
views for our core apps.
With this is mind we went through some exercise to define a priority for
the apps to be ported to the updated architecture.
- *Settings* - this is a key app for any product mozilla may be
planning to release; different apps will have different needs to display
information to the user in the settings
- *Camera *- again a key app for a lot of the modern devices
- *Contacts* - everyone wants to have contacts on their devices - but
they need different level of information - creating differing views is
going to key here
- *Calendar* - as with contacts its critical to have differing views
but not as high priority as contacts
- *Gallery* - another core app that every connected device may need
to have
- *E-mail* - typing emails on smaller devices will be a problem and
therefore creating readable email view may be needed for some connected
deviceds
- *Calculator *- table stake app
- *Clock *- table stake app
- *Browser *- one of core mozilla apps but a table stake app for some
of the connected devices
Some of the engineering teams, who have already worked on this split,
will be reaching out in smaller teams to discuss best practices and quick
wins for this activity.
BR
Wilfred
---
FxOS Product Management
Mozilla Corp., UK
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Wilson Page
2015-11-20 11:08:35 UTC
Permalink
I think a single backend with many, light, replaceable front-end parts is
critical to us building a portable OS.

(Web) Components will help us to:

- Ensure visual consistency across our core apps
- Abstract away complexity to allow app peers to get on with their business
logic
- Optimize UI performance once and benefit everywhere
- Provide a starting block for third-party developers to compose fast,
polished web-applications
- Prototype new ideas quickly

Arguable we could use a JS framework (eg. React) instead of the built-in
browser APIs, but:

- Frameworks come and go. What's next year's trendy framework? Should we
wait for that?
- Components can't be used unless the user is happy to load the framework
dependency too (React > 300KB) [1]
- Browser APIs will tend to be/become faster than a JS framework equivalent.
- We're Mozilla, we should be supporting the platform we're building :)

---

In Summary:

*We need both :)*[1] https://aerotwist.com/blog/the-cost-of-frameworks/


*W I L S O N P A G E*

Front-end Developer
Firefox OS (Gaia)
London Office

Twitter: @wilsonpage
IRC: wilsonpage
On Fri, Nov 20, 2015 at 6:19 AM, Justin D'Arcangelo <
Post by Justin D'Arcangelo
First off, I agree with David that we should be focusing on web
components. Having worked with them extensively over the past few months,
they add tremendous value in terms of code reuse and general code
cleanliness and encapsulation.
It is not a big surprise that I agree with many things Justin says. But I
want to pile a bit on Web Components beeing a magic answer.
As stated in the Architecture Proposal
<https://wiki.mozilla.org/Gaia/Architecture_Proposal#Disclaimers> since
"This model is not about using x, y or z. It is technology agnostic and
uses very basic primitives of the Web. Various technologies can be put on
top of that (module UI, React, Web Components, etc.) and can actually be
benchmarked with real data from users using Telemetry."
The goal of the architectural changes which are proposed is *not* to
enforce a UI solution. So it sounds strange to be able to replace all the
proposal, which is a set of different pieces (aka Service Workers, Data
Sync, Telemetry, ...) by a single answer. Especially one that is so highly
UI related.
Now if we want to dive in the UI world, yes, a component system is
definitively something we should all be looking at for *consistency*,
*maintainability* and *performance*.
What this component system should be, is not part of the proposal,
specifically to avoid the confusion between what components are used for,
and what the proposal is about.
Now, it is understandable that Web Components is the default choice of
many Gaia developers as a component mechanism.
I would even validate the choice, if we do have dedicated raptor tests to
validate their performance and ensure they do not regress over time (which
is often the fate of a code that starts small and slowly by slowly get more
features).
Without raptor test it could not be proven that they will answer the
*performance* criteria over time.
Having a dedicated set of people that works on it, is definitively part of
the plan that nobody knows but is the companion of the new architecture
proposal: Architecture Transition Plan
<https://wiki.mozilla.org/Gaia/Architecture_Transition_Proposal#Toolkit_Team>
But it would be a shame to focus all our efforts in something that a third
party may not even consider.
If someone wants to ship a FirefoxOS powered device, it may rewrite all
the UI, or just some parts, to please itself or its own UI/UX team. This
custom solution may use a completely different framework, like React for
example. If all our efforts has been focused on Web Components, all our
work will basically be garbage for them (even for us if one day someone
prove that a new UI framework is way more modular and performant).
This is why defining a clear backend API that can be easily documented is
important. Beeing able to prove that the backend is not tied to the UI at
all is important too (this is one of the reason of beeing able to run it in
a Worker, you can prove it does not rely on DOM apis or front-end specific
logic).
This is why offering caching APIs via Service Worker, not tied to a
specific UI framework too, is important as well. To ensure that whatever
framework is choosen, people can benefit from caching to help performance.
This is why Data Sync is important. Whatever UI framework is used, users
will get their datas.
Etc...
Vivien.
Post by Justin D'Arcangelo
However, web components only solve our problems on the surface in the UI
of our apps. The Gaia apps contain an enormous amount of complexity and
business logic that is not in the UI. For instance, the Music app needs to
use a complex metadata parser in conjunction with DeviceStorage and
IndexedDB to scan and store the contents of a user’s music library. What
NGA brings to the table, in this regard, is the ability to craft an
easy-to-consume developer API for the app. When we talk about separating
the front-end from the back-end in terms of “NGA”, we are really talking
about defining this developer API for the back-end and exposing it via an
HTTP API. This allows a traditional web developer, who is used to working
with server-side HTTP APIs, to jump right in and get up and running.
https://github.com/mozilla-b2g/gaia/blob/master/apps/music/js/view.js#L10-L54
As for the front-end of things with NGA, our “views” are simply mini-apps
themselves. A single “view", at the very least, is just an HTML file to
define the view’s markup end a JS file to wire up the DOM and call the HTTP
API in the back-end.
This past week I started experimenting with adapting the Music app to
work on TV. Within an hour, I was able to just drop in a couple new “views”
that were TV-friendly versions of what we have in the regular phone version
of the app. Specifically, the Music app normally launches to the “tiles”
view and is obviously reliant on touch events for tapping on albums to
start playing them. This needed to be wired up a little differently for TV
because we needed to be able to use the arrow keys on the TV remote to move
the highlighting “cursor” around from album-to-album. In a very simplified
- Perform an HTTP request to the back-end URL “/api/albums”
- Loop over the response from the back-end and generate the HTML
- Attach an “onclick” event handler for the tiles to start playing the album
- To play the album, we perform an HTTP request to the back-end URL
“/api/queue/album/{album_id}"
As you can see, these look very much like things your average web
developer would be familiar with. So, to do a TV version of this “tiles”
view, I simply created a copy of the phone “tiles” view into another folder
called “tiles-tv”. For the TV version of the “tiles” view, the operations I
- Perform an HTTP request to the back-end URL “/api/albums”
- Loop over the response from the back-end and generate the HTML
- Attach a “keydown” event handler for moving the focus highlighting
around between tiles
- When the user presses [Enter], we perform an HTTP request to the
back-end URL “/api/queue/album/{album_id}”
I was also able to provide a completely different CSS stylesheet for my
TV-optimized “tiles” view. This was also extraordinarily easy because the
regular phone version of the “tiles” view has its own CSS file that only
deals with styles related to just that one view.
The key takeaway here is that defining a clear and easy-to-use HTTP
back-end for our apps is extremely helpful in achieving a very clear
separation of logic between front-end and back-end. It also provides a way
for regular web developers to jump in and customize the front-ends of our
apps without having to understand all the complexity that we deal with in
the back-end. The other important point to note is that the NGA method of
separating our “views” in the front-end allows us to swap out entire
screens in our apps wholesale. Our “views” are really just simple
“mini-apps” themselves and because of this, I firmly believe that this
architecture will help us take on unknown form factors in the future.
-Justin
I've been thinking a lot about this thread in the context of Ari's talk
at the All Hands meeting yesterday. We're working on an OS that has to run
on smartphones, smart tv's and other form factors tbd. Ari asked us to
focus on portability, and that obviously will be key to our ability to run
on different form factors.
I had something of an epiphany today: In the future, teams inside and
outside of Mozilla will build devices that run FirefoxOS and will create
products that provide true user value and delight. At this moment we don't
know what those products will be. So for core FirefoxOS developers, our
users are these future product development teams. We need to be building an
OS that is so fast and flexible, so portable and performant that product
developers will feel delight using our platform.
With that in mind, I'd like to suggest that we'd be better served by
focusing on web components than by working on NGA.
Converting our building blocks to web components and then refactoring our
apps to use those components and to be based on higher-level web components
will give us much of the modularity and portability that we're seeking from
NGA, but at the same time, it will also create a high-quality library of
reusable UI components that third party app authors (including those who
are embedding FirefoxOS in new products) can use to more easily create apps.
David
Hi all,
Given the Music app splitting we have done in time for 2.5 we want to
move ahead - I think it makes sense to be executed in a “train model”
fashion.
We should start from the top of the list and work through the list.
When I say splitting of the apps, we are looking for the following
1. FE/BE split
2. Split views
3. Page transition
Why did I choose the priority below? - for now we have 2 products that
we work on: smartphone and TV, but moving forward we need to investigate
what are the products that make sense for us and when we enter the
connected devices market 3rd party developers need to be able to develop
differing views for our core apps.
With this is mind we went through some exercise to define a priority for
the apps to be ported to the updated architecture.
- *Settings* - this is a key app for any product mozilla may be
planning to release; different apps will have different needs to display
information to the user in the settings
- *Camera *- again a key app for a lot of the modern devices
- *Contacts* - everyone wants to have contacts on their devices -
but they need different level of information - creating differing views is
going to key here
- *Calendar* - as with contacts its critical to have differing views
but not as high priority as contacts
- *Gallery* - another core app that every connected device may need
to have
- *E-mail* - typing emails on smaller devices will be a problem and
therefore creating readable email view may be needed for some connected
deviceds
- *Calculator *- table stake app
- *Clock *- table stake app
- *Browser *- one of core mozilla apps but a table stake app for
some of the connected devices
Some of the engineering teams, who have already worked on this split,
will be reaching out in smaller teams to discuss best practices and quick
wins for this activity.
BR
Wilfred
---
FxOS Product Management
Mozilla Corp., UK
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Vivien Nicolas
2015-11-20 12:01:56 UTC
Permalink
Basically agreeing.
Post by Wilson Page
- Optimize UI performance once and benefit everywhere
Having dedicated raptor tests sounds a must have to make sure performance
is monitored and we do not slowly regress over time.


Arguable we could use a JS framework (eg. React) instead of the built-in
Post by Wilson Page
- Frameworks come and go. What's next year's trendy framework? Should we
wait for that?
"Should we wait for that? " is definitively a valid concern.
For years I was hoping ES6 modules will arrived - that was likely a mistake.
My understanding of the current state of the situation is that they will
arrive probably in 2016 but without the associated module loader... I'm
fine to use require.js all over the place and move it to shared/ instead of
waiting again and again. And then switch to ES6 modules once they will be
here.
Post by Wilson Page
- Browser APIs will tend to be/become faster than a JS framework equivalent.
TBH I feel like there is still a lot of work to make Web Components really
fast, but I agree on the theory for the long term.
Post by Wilson Page
- We're Mozilla, we should be supporting the platform we're building :)
\o/
Benjamin Francis
2015-11-20 12:01:49 UTC
Permalink
Post by Vivien Nicolas
Having a dedicated set of people that works on it, is definitively part of
the plan that nobody knows but is the companion of the new architecture
proposal: Architecture Transition Plan
<https://wiki.mozilla.org/Gaia/Architecture_Transition_Proposal#Toolkit_Team>
Wow, thanks for sharing this.

Firstly, I really love the fundamental principle of the new architecture to
split the web apps into a REST API and a front end. This separation of
concerns is well established good practice in web development. Service
Workers will give us the magic we need to make this work offline. I also
really love the idea that the apps that make up Gaia become real web apps
with real URLs on the web which can be updated independently of Gonk and
Gecko using the web's built in update mechanism, not reliant on giant OTA
updates. This is the way of the web. I also agree that Web Components are
complimentary to this architecture and are solving a different problem.

On the transition plan, I think the front end/back end split makes perfect
sense from a technical point of view, but I'm very concerned about the idea
of reorganising our 100+ person team into a front end team, back end teams
and a toolkit team. This organisational structure seems like it would be a
nightmare for our EPMs as virtually every single feature we develop would
have cross-team dependencies. Cross-team dependencies kill our
productivity, especially given the distributed nature of our teams across
timezones. It's bad enough having Gecko dependencies for Gaia
features,representing another level of architectural abstraction in our
organisational structure seems like a recipe for not moving anywhere fast.

Let me give you an example of a user story, "As a user I want to create a
playlist of songs". Implementing this feature would require an addition to
the API (media back end team) and also an addition to the UI (front end
team). The front end team now has dependencies on the back end team and has
to file user stories in their backlog like "As a Gaia developer I want to
add a playlist", "As a Gaia developer I want to remove a playlist", "As a
Gaia developer I want to add a song to a playlist" etc. Now imagine this
new UI requires a new or modified web component - the front end team has a
dependency on the Toolkit team. Now imagine it requires some platform
support for streaming M3U playlists, the back end team now has a dependency
of Gecko. All these pieces have to be implemented by all of these separate
teams in their separate timezones with clearly defined interfaces for one
feature to be completed. Then Product or UX change the requirements
(inevitable) and the whole process has to start again!

I think the new architecture does give us an opportunity to make a change
to the way we manage our teams. It gives us the freedom to create even more
autonomous cross-functional teams like the media team, productivity team
and communications team who have less dependencies on the wider project and
can move fast to deliver updates on their own timescale. Whilst I agree
with the front end/back end split and shared components, I think directly
mapping the architecture onto our organisational structure is maybe a bit
simplistic and could be a recipe for disaster. My view is that what we need
is agile, autonomous, cross-functional teams who specialist in one product
area. We probably need the existing specialists in those apps to carry out
the front end/back end split in the first place anyway. I wouldn't have a
clue how to create a front end or back end for our music app, but the media
team does.

One other more technical comment is that one part of the architecture I
don't understand is why our "back end" pieces and our "data sync" service
are not the same thing. Wouldn't web apps usually work by having a
server-side REST API where all the data is stored, then multiple front ends
on different form factors which talk to that API and cache data on the
client? Why are we creating a web API which stores its data locally then
syncs via a separate service? Is that just applying native Firefox app
development thinking to web development?

BTW, thanks for having this discussion in the open :)

Ben


<https://lists.mozilla.org/listinfo/dev-fxos>
Vivien Nicolas
2015-11-20 12:17:37 UTC
Permalink
Post by Vivien Nicolas
Having a dedicated set of people that works on it, is definitively part
of the plan that nobody knows but is the companion of the new architecture
proposal: Arch
<https://wiki.mozilla.org/Gaia/Architecture_Transition_Proposal#Toolkit_Team>
On the transition plan, I think the front end/back end split makes
perfect sense from a technical point of view, but I'm very concerned about
the idea of reorganising our 100+ person team into a front end team, back
end teams and a toolkit team. This organisational structure seems like it
would be a nightmare for our EPMs as virtually every single feature we
develop would have cross-team dependencies. Cross-team dependencies kill
our productivity, especially given the distributed nature of our teams
across timezones. It's bad enough having Gecko dependencies for Gaia
features,representing another level of architectural abstraction in our
organisational structure seems like a recipe for not moving anywhere fast.
Let me give you an example of a user story, "As a user I want to create a
playlist of songs". Implementing this feature would require an addition to
the API (media back end team) and also an addition to the UI (front end
team). The front end team now has dependencies on the back end team and has
to file user stories in their backlog like "As a Gaia developer I want to
add a playlist", "As a Gaia developer I want to remove a playlist", "As a
Gaia developer I want to add a song to a playlist" etc. Now imagine this
new UI requires a new or modified web component - the front end team has a
dependency on the Toolkit team. Now imagine it requires some platform
support for streaming M3U playlists, the back end team now has a dependency
of Gecko. All these pieces have to be implemented by all of these separate
teams in their separate timezones with clearly defined interfaces for one
feature to be completed. Then Product or UX change the requirements
(inevitable) and the whole process has to start again!
I think the new architecture does give us an opportunity to make a change
to the way we manage our teams. It gives us the freedom to create even more
autonomous cross-functional teams like the media team, productivity team
and communications team who have less dependencies on the wider project and
can move fast to deliver updates on their own timescale. Whilst I agree
with the front end/back end split and shared components, I think directly
mapping the architecture onto our organisational structure is maybe a bit
simplistic and could be a recipe for disaster. My view is that what we need
is agile, autonomous, cross-functional teams who specialist in one product
area. We probably need the existing specialists in those apps to carry out
the front end/back end split in the first place anyway. I wouldn't have a
clue how to create a front end or back end for our music app, but the media
team does.
I'm pretty sure nobody is confident enough is my re-org plan :) So while I
will be happy to discuss about it, do not take it as a real plan, just as
my personal view on how things should be. I feel strongly that the
organisation should be mirroring the architecture and vice-versa.

But while I will be happy to discuss about it, do you mind if we spawn a
dedicated thread. Not to kill the conversation but otherwise I believe this
particular discussion will be flood!
One other more technical comment is that one part of the architecture I
don't understand is why our "back end" pieces and our "data sync" service
are not the same thing. Wouldn't web apps usually work by having a
server-side REST API where all the data is stored, then multiple front ends
on different form factors which talk to that API and cache data on the
client? Why are we creating a web API which stores its data locally then
syncs via a separate service? Is that just applying native Firefox app
development thinking to web development?
Fernando or Francisco will likely explain it much better than I. But
basically Data Sync to a remote server has its own concerns, like what is
the server infrastructure, which types of datas to we want first, etc.. to
be its own project. If you are interested in details there is a Firefox OS
Data Sync <https://wiki.mozilla.org/Firefox_OS_Data_Sync> wiki page and the
tracking bug is bug 1161657.

So you can look at Data Sync as a one of our shared toolkit library, which
may be used by the backend. While backend often refers to the specific app
business logic in this thread - even if the communication mechanism is part
of the toolkit under the bridge.js library.

Hope it helps.
BTW, thanks for having this discussion in the open :)
Ben
<https://lists.mozilla.org/listinfo/dev-fxos>
Russ Nicoletti
2015-11-20 19:50:12 UTC
Permalink
+1 to autonomous, cross-functional teams. In my experience, they work very
well because everyone is focused on the same goal (or limited number of
goals) and because they are cross-functional, the teams tend to get blocked
less often by needing deliverables from other groups. Another benefit I've
seen in autonomous, cross-functional teams is they tend to promote a
camaraderie that also improves efficiency.

-Russ
Post by Benjamin Francis
Post by Vivien Nicolas
Having a dedicated set of people that works on it, is definitively part
of the plan that nobody knows but is the companion of the new architecture
proposal: Architecture Transition Plan
<https://wiki.mozilla.org/Gaia/Architecture_Transition_Proposal#Toolkit_Team>
Wow, thanks for sharing this.
Firstly, I really love the fundamental principle of the new architecture
to split the web apps into a REST API and a front end. This separation of
concerns is well established good practice in web development. Service
Workers will give us the magic we need to make this work offline. I also
really love the idea that the apps that make up Gaia become real web apps
with real URLs on the web which can be updated independently of Gonk and
Gecko using the web's built in update mechanism, not reliant on giant OTA
updates. This is the way of the web. I also agree that Web Components are
complimentary to this architecture and are solving a different problem.
On the transition plan, I think the front end/back end split makes perfect
sense from a technical point of view, but I'm very concerned about the idea
of reorganising our 100+ person team into a front end team, back end teams
and a toolkit team. This organisational structure seems like it would be a
nightmare for our EPMs as virtually every single feature we develop would
have cross-team dependencies. Cross-team dependencies kill our
productivity, especially given the distributed nature of our teams across
timezones. It's bad enough having Gecko dependencies for Gaia
features,representing another level of architectural abstraction in our
organisational structure seems like a recipe for not moving anywhere fast.
Let me give you an example of a user story, "As a user I want to create a
playlist of songs". Implementing this feature would require an addition to
the API (media back end team) and also an addition to the UI (front end
team). The front end team now has dependencies on the back end team and has
to file user stories in their backlog like "As a Gaia developer I want to
add a playlist", "As a Gaia developer I want to remove a playlist", "As a
Gaia developer I want to add a song to a playlist" etc. Now imagine this
new UI requires a new or modified web component - the front end team has a
dependency on the Toolkit team. Now imagine it requires some platform
support for streaming M3U playlists, the back end team now has a dependency
of Gecko. All these pieces have to be implemented by all of these separate
teams in their separate timezones with clearly defined interfaces for one
feature to be completed. Then Product or UX change the requirements
(inevitable) and the whole process has to start again!
I think the new architecture does give us an opportunity to make a change
to the way we manage our teams. It gives us the freedom to create even more
autonomous cross-functional teams like the media team, productivity team
and communications team who have less dependencies on the wider project and
can move fast to deliver updates on their own timescale. Whilst I agree
with the front end/back end split and shared components, I think directly
mapping the architecture onto our organisational structure is maybe a bit
simplistic and could be a recipe for disaster. My view is that what we need
is agile, autonomous, cross-functional teams who specialist in one product
area. We probably need the existing specialists in those apps to carry out
the front end/back end split in the first place anyway. I wouldn't have a
clue how to create a front end or back end for our music app, but the media
team does.
One other more technical comment is that one part of the architecture I
don't understand is why our "back end" pieces and our "data sync" service
are not the same thing. Wouldn't web apps usually work by having a
server-side REST API where all the data is stored, then multiple front ends
on different form factors which talk to that API and cache data on the
client? Why are we creating a web API which stores its data locally then
syncs via a separate service? Is that just applying native Firefox app
development thinking to web development?
BTW, thanks for having this discussion in the open :)
Ben
<https://lists.mozilla.org/listinfo/dev-fxos>
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Vivien Nicolas
2015-11-20 12:44:37 UTC
Permalink
Post by Justin D'Arcangelo
This past week I started experimenting with adapting the Music app to work
on TV. Within an hour, I was able to just drop in a couple new “views” that
were TV-friendly versions of what we have in the regular phone version of
the app.
I think there is something important here. You drop a couple views in an
hour. This is pretty fast!

It sounds hard in one hour to understand all the possible code path and
impact of some new code. And regressions has been one of the big battle of
the last years.

How confident are you that there is no regressions in other views ? If you
are highly confident, can you explain why ?

Thanks,
Vivien.
Justin D'Arcangelo
2015-11-20 15:46:57 UTC
Permalink
Post by Justin D'Arcangelo
This past week I started experimenting with adapting the Music app to work on TV. Within an hour, I was able to just drop in a couple new “views” that were TV-friendly versions of what we have in the regular phone version of the app.
I think there is something important here. You drop a couple views in an hour. This is pretty fast!
It sounds hard in one hour to understand all the possible code path and impact of some new code. And regressions has been one of the big battle of the last years.
I didn't say it was production-ready ;-)
How confident are you that there is no regressions in other views ? If you are highly confident, can you explain why ?
Thanks,
Vivien.
As I mentioned, our views are like mini apps themselves. Because each view in this architecture is a completely separate HTML document with its own URL, it is almost impossible for changes in one view to affect another. Therefore, I can make drastic changes such as completely replacing a view with a great deal of confidence that I haven't caused any regressions elsewhere.
David Flanagan
2015-11-20 18:16:27 UTC
Permalink
I think that we should focus on web components instead of NGA during the
2.6 release cycle. This is not an argument against NGA, but it is an
argument that we'll have more impact working on web components right now.

These are my reasons:

1) We don't have enough engineers to focus on both for 2.6, especially if
we are also concurrently working on initiatives like B2GDroid, FlyWeb, Pin
the Web, telemetry, Alopex and so on.

2) We've been using web components like gaia-header for two releases now,
and the platform seems ready enough that we can make good progress on this.

3) With NGA we've only done the easy stuff (front-end/back-end split) so
far. We're still waiting on platform support (or better platform
performance) for service workers, prerendering, the new security model, and
for converting APIs to work in worker contexts. So these important parts
of the architecture have not yet been validated. If we push ahead with NGA
now we will be on the bleeding edge of the platform and will suffer the
bugs and performance problems that entails

4) Mozilla engineers understand modularity and its benefits. Given the
opportunity to refactor our apps, I'm confident that we will all move
toward a separation between front-end and back-end, even without the NGA
prescription. In the process of modifying our apps to use web components
instead of the current building blocks, I would like to encourage teams to
create higher-level app-specific web components as needed, and I think that
this kind of refactoring will offer many of the same modularity benefits as
an NGA-focused frontend/backend refactoring.

5) NGA is an investment in our current set of apps, at a time when we don't
know what apps will be needed in the next product we try to launch. But
working on web components is an investment in the OS itself: we'd be
creating the building blocks for future apps, and working toward the
platform portability goal that Ari outlined recently.

So what do I have wrong here? I think points #1 and #5 are my strongest
arguments. I'm less confident about #2 and #3. Does anyone want to argue
that web components are ready to be used? Or that we do have enough
engineers to work on both? Or that NGA is a more strategic and impactful
thing to be working on in 2.6?

David
On Fri, Nov 20, 2015 at 6:19 AM, Justin D'Arcangelo <
Post by Justin D'Arcangelo
This past week I started experimenting with adapting the Music app to
work on TV. Within an hour, I was able to just drop in a couple new “views”
that were TV-friendly versions of what we have in the regular phone version
of the app.
I think there is something important here. You drop a couple views in an
hour. This is pretty fast!
It sounds hard in one hour to understand all the possible code path and
impact of some new code. And regressions has been one of the big battle of
the last years.
I didn't say it was production-ready ;-)
How confident are you that there is no regressions in other views ? If you
are highly confident, can you explain why ?
Thanks,
Vivien.
As I mentioned, our views are like mini apps themselves. Because each view
in this architecture is a completely separate HTML document with its own
URL, it is almost impossible for changes in one view to affect another.
Therefore, I can make drastic changes such as completely replacing a view
with a great deal of confidence that I haven't caused any regressions
elsewhere.
Sam Foster
2015-11-20 18:40:48 UTC
Permalink
I only want to offer a personal note of caution around web components. For
the granular, UI "atoms" I think they are a great solution. But composing
whole UI with nested components and layout-level components is less proven.
The neat encapsulation you get with web components is its own kind of
sugar, and without checks and balances you can make what seem like very
reasonable decisions that wind up duplicating platform functionality and
ending with a net loss in your ability to reason about layout and
rendering. Also, a very domain-specific codebase that represents a steep
learning curve for a new developer.

/Sam
Post by David Flanagan
I think that we should focus on web components instead of NGA during the
2.6 release cycle. This is not an argument against NGA, but it is an
argument that we'll have more impact working on web components right now.
1) We don't have enough engineers to focus on both for 2.6, especially if
we are also concurrently working on initiatives like B2GDroid, FlyWeb, Pin
the Web, telemetry, Alopex and so on.
2) We've been using web components like gaia-header for two releases now,
and the platform seems ready enough that we can make good progress on this.
3) With NGA we've only done the easy stuff (front-end/back-end split) so
far. We're still waiting on platform support (or better platform
performance) for service workers, prerendering, the new security model, and
for converting APIs to work in worker contexts. So these important parts
of the architecture have not yet been validated. If we push ahead with NGA
now we will be on the bleeding edge of the platform and will suffer the
bugs and performance problems that entails
4) Mozilla engineers understand modularity and its benefits. Given the
opportunity to refactor our apps, I'm confident that we will all move
toward a separation between front-end and back-end, even without the NGA
prescription. In the process of modifying our apps to use web components
instead of the current building blocks, I would like to encourage teams to
create higher-level app-specific web components as needed, and I think that
this kind of refactoring will offer many of the same modularity benefits as
an NGA-focused frontend/backend refactoring.
5) NGA is an investment in our current set of apps, at a time when we
don't know what apps will be needed in the next product we try to launch.
But working on web components is an investment in the OS itself: we'd be
creating the building blocks for future apps, and working toward the
platform portability goal that Ari outlined recently.
So what do I have wrong here? I think points #1 and #5 are my strongest
arguments. I'm less confident about #2 and #3. Does anyone want to argue
that web components are ready to be used? Or that we do have enough
engineers to work on both? Or that NGA is a more strategic and impactful
thing to be working on in 2.6?
David
Jim Porter
2015-11-20 19:36:09 UTC
Permalink
Post by Justin D'Arcangelo
What NGA brings to the table, in this regard, is the ability to craft
an easy-to-consume developer API for the app. When we talk about
separating the front-end from the back-end in terms of “NGA”, we are
really talking about defining this developer API for the back-end and
exposing it via an HTTP API. This allows a traditional web developer,
who is used to working with server-side HTTP APIs, to jump right in
and get up and running.
How does an HTTP API make things easier than a similarly-designed (and
likely more-expressive) Javascript API? I absolutely disagree that NGA
provides any new abilities to create pleasant APIs for the backend of an
app. While using HTTP internally might allow for some new features (like
running the backend on a different system), that doesn't mean that the
API itself needs to expose this, nor does it mean that the *interface*
has improved because of it.

Since Firefox OS assumes that all our apps will be written in
Javascript, why not take advantage of that property and write the API
for our backend *as* Javascript? I doubt that any "traditional web
programmer" would be confused by a Javascript-based API as opposed to an
HTTP-based API.

To be clear, if we can get significant performance gains from using HTTP
and Service Workers internally (e.g. by taking advantage of caching),
then by all means, let's use it. However, our experience with Service
Workers hasn't borne this out yet, and it still doesn't mean that the
easiest-to-use API would be HTTP-based instead of Javascript-based. Even
if we used HTTP internally, we might find it preferable to expose an API
that takes advantage of all the syntactical niceties of modern
Javascript. In fact, this is pretty common in many languages, even ones
where HTTP fetches are super-easy: somewhere on top of the HTTP API lies
a language-specific API that handles query-building and response parsing
for you. These "wrapper" APIs can reduce the verbosity and improve the
readability of any calls to the HTTP endpoint

- Jim
Justin D'Arcangelo
2015-11-20 19:55:14 UTC
Permalink
Traditional web developers are *very* familiar with HTTP APIs as pretty much all web applications on the open web rely on an HTTP back-end (think Twitter clients, FB clients, etc). In contrast, many of our own JavaScript-based Device APIs do not feel “webby” and more closely resemble the types of APIs you would see on native platforms like iOS or Android. That’s not to say we don’t need those types of APIs (we absolutely do), but to your average web developer, they can be *very* intimidating.

Note, I’m not necessarily opposed to exposing a JS API for our back-ends. However, in doing so, you would almost certainly end up seeing vastly different APIs across all our apps as there is no “standard” pattern for the design of these APIs. By sticking with HTTP, you will inherently have some level of consistency between APIs for all of our apps — especially if we follow a REST-like pattern. You would also be set up for doing all sorts of new things in the future with regards to splitting the app across multiple devices (front-end on phone/back-end on desktop, etc).

Also, it should certainly be possible for apps to use a thin JS “wrapper” around their back-end HTTP APIs as well. In fact, it is fairly common to see APIs on the open web being offered this way *in addition to* a plain-vanilla HTTP API (think Google Maps, Twitter, etc.). However, this only affects the way a developer *consumes* said API. In the end, the back-end service still exposes an HTTP API under-the-hood and offers a thin JS library for developers mostly as a convenience.

-Justin
Post by Jim Porter
Post by Justin D'Arcangelo
What NGA brings to the table, in this regard, is the ability to craft
an easy-to-consume developer API for the app. When we talk about
separating the front-end from the back-end in terms of “NGA”, we are
really talking about defining this developer API for the back-end and
exposing it via an HTTP API. This allows a traditional web developer,
who is used to working with server-side HTTP APIs, to jump right in
and get up and running.
How does an HTTP API make things easier than a similarly-designed (and
likely more-expressive) Javascript API? I absolutely disagree that NGA
provides any new abilities to create pleasant APIs for the backend of an
app. While using HTTP internally might allow for some new features (like
running the backend on a different system), that doesn't mean that the
API itself needs to expose this, nor does it mean that the *interface*
has improved because of it.
Since Firefox OS assumes that all our apps will be written in
Javascript, why not take advantage of that property and write the API
for our backend *as* Javascript? I doubt that any "traditional web
programmer" would be confused by a Javascript-based API as opposed to an
HTTP-based API.
To be clear, if we can get significant performance gains from using HTTP
and Service Workers internally (e.g. by taking advantage of caching),
then by all means, let's use it. However, our experience with Service
Workers hasn't borne this out yet, and it still doesn't mean that the
easiest-to-use API would be HTTP-based instead of Javascript-based. Even
if we used HTTP internally, we might find it preferable to expose an API
that takes advantage of all the syntactical niceties of modern
Javascript. In fact, this is pretty common in many languages, even ones
where HTTP fetches are super-easy: somewhere on top of the HTTP API lies
a language-specific API that handles query-building and response parsing
for you. These "wrapper" APIs can reduce the verbosity and improve the
readability of any calls to the HTTP endpoint
- Jim
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Benjamin Francis
2015-11-20 20:17:40 UTC
Permalink
Post by Jim Porter
While using HTTP internally might allow for some new features (like
running the backend on a different system),
Exactly, what if the back end could run on a server as a web service, with
a Service Worker as a progressive enhancement to make it work offline? What
if the app could work in multiple browsers? What if that API was also
accessible by other apps so that we didn't have to use proprietary
cross-app messaging APIs? What if that cross-app messaging could also work
locally using cross-origin Service Workers? What if we could replace other
local proprietary JavaScript APIs in Gecko with web services?
Post by Jim Porter
To be clear, if we can get significant performance gains from using HTTP
and Service Workers internally (e.g. by taking advantage of caching),
then by all means, let's use it. However, our experience with Service
Workers hasn't borne this out yet, and it still doesn't mean that the
easiest-to-use API would be HTTP-based instead of Javascript-based.
I don't think a REST API as a back end is inherently easier or more
performant, but it is good practice, it is the web, and it does make our
code much more portable. Currently Gaia is not of the web.

Even
Post by Jim Porter
if we used HTTP internally, we might find it preferable to expose an API
that takes advantage of all the syntactical niceties of modern
Javascript. In fact, this is pretty common in many languages, even ones
where HTTP fetches are super-easy: somewhere on top of the HTTP API lies
a language-specific API that handles query-building and response parsing
for you. These "wrapper" APIs can reduce the verbosity and improve the
readability of any calls to the HTTP endpoint
We could do that too.
Jim Porter
2015-11-20 20:23:45 UTC
Permalink
Post by Justin D'Arcangelo
Traditional web developers are *very* familiar with HTTP APIs as
pretty much all web applications on the open web rely on an HTTP
back-end (think Twitter clients, FB clients, etc). In contrast, many
of our own JavaScript-based Device APIs do not feel “webby” and more
closely resemble the types of APIs you would see on native platforms
like iOS or Android. That’s not to say we don’t need those types of
APIs (we absolutely do), but to your average web developer, they can
be *very* intimidating.
Are you sure about that? The non-Mozilla web developers I know are all
familiar with things like jQuery, Angular, React, etc (not necessarily
all at once). These are just Javascript APIs, and I'd be very surprised
if web devs described them as "intimidating". In any case, I don't think
we should optimize for "traditional" web developers anyway, since
Post by Justin D'Arcangelo
Note, I’m not necessarily opposed to exposing a JS API for our
back-ends. However, in doing so, you would almost certainly end up
seeing vastly different APIs across all our apps as there is no
“standard” pattern for the design of these APIs.
Luckily, we all work at the same company and can communicate with each
other what "shape" our APIs should be. :) In individual teams, e.g. the
media apps, the API designers might even be the same people. Then, you'd
end up with very-similar APIs for Gallery, Video, and Music.
Post by Justin D'Arcangelo
By sticking with HTTP, you will inherently have some level of
consistency between APIs for all of our apps — especially if we
follow a REST-like pattern.
I don't see a lot of potential for consistency with HTTP APIs, except in
the boring parts (e.g. boilerplate syntax). Without cross-team
communication, the names of resources will probably vary widely, as
would the conventions of what to pass as a parameter. Heck, these could
vary even among versions of the *same* app! For instance, the Music
app's backend currently takes filenames of individual songs to refer to
an album, whereas in the future, we might pass an album ID to reduce the
number of database queries on the backend. In a Javascript-based API,
however, we could hide that change from users by simply accepting a full
metadata object for a file as the parameter, and then extracting the
appropriate info inside our backend's implementation before the DB
query. Following conventions like this could make a JS-based API *more*
consistent than an HTTP-based alternative.
Post by Justin D'Arcangelo
You would also be set up for doing all sorts of new things in the
future with regards to splitting the app across multiple devices
(front-end on phone/back-end on desktop, etc).
While there are certainly benefits to doing things like this, I imagine
that in many cases, technologies like this already exist, and it would
be wiser for us to use them rather than invent our own HTTP API. For
instance, if we split up the media libraries from the UI, a likely
choice for communication would be UPnP/DLNA, since we'd then have
interoperability with a wide range of *other* devices. While UPnP is
effectively an HTTP API, it's not quite the kind that we'd design on our
own, since it uses XML as opposed to JSON, has a separate protocol
(RTSP) for the actual media data, and features strange things like
HTTP-over-UDP.

In any case, if the performance issues with Service Workers remain, it
may be better to provide a non-HTTP mode of communication if you're
dealing with a database on the same device as your UI.
Post by Justin D'Arcangelo
Also, it should certainly be possible for apps to use a thin JS
“wrapper” around their back-end HTTP APIs as well. In fact, it is
fairly common to see APIs on the open web being offered this way *in
addition to* a plain-vanilla HTTP API (think Google Maps, Twitter,
etc.). However, this only affects the way a developer *consumes* said
API.
The way a developer uses an API is all an API is. Everything else is an
implementation detail. One of the reasons Google Maps, Twitter, etc
provide public documentation for their HTTP APIs is because it allows
applications written in arbitrary languages to communicate with them.
For Android, iOS, and desktop platforms, this can be pretty important.
However, since Firefox OS was designed from the ground up on the
assumption that all code is written in (or compiled to) Javascript, that
reason no longer applies.
Post by Justin D'Arcangelo
In the end, the back-end service still exposes an HTTP API
under-the-hood and offers a thin JS library for developers mostly as
a convenience.
In API design, I'd say convenience is everything.

- Jim
Justin D'Arcangelo
2015-11-20 20:42:26 UTC
Permalink
Post by Jim Porter
Post by Justin D'Arcangelo
Traditional web developers are *very* familiar with HTTP APIs as
pretty much all web applications on the open web rely on an HTTP
back-end (think Twitter clients, FB clients, etc). In contrast, many
of our own JavaScript-based Device APIs do not feel “webby” and more
closely resemble the types of APIs you would see on native platforms
like iOS or Android. That’s not to say we don’t need those types of
APIs (we absolutely do), but to your average web developer, they can
be *very* intimidating.
Are you sure about that? The non-Mozilla web developers I know are all
familiar with things like jQuery, Angular, React, etc (not necessarily
all at once). These are just Javascript APIs, and I'd be very surprised
if web devs described them as "intimidating". In any case, I don't think
we should optimize for "traditional" web developers anyway, since
Let’s ask the dev-rel team what they think about this :-)

We are trying to grow our number of contributors. Anything that lowers the barrier of entry and follows well-established patterns in the community helps. Also, I’m not referring to jQuery, Angular, etc. which all have *well-documented* syntax with easy-to-follow examples. I’m talking about things like DeviceStorage, MozCamera, etc. There was just a thread the other day where someone did not understand how to enumerate a directory with DeviceStorage, so I’d say that this *is* a problem.
Post by Jim Porter
Post by Justin D'Arcangelo
Note, I’m not necessarily opposed to exposing a JS API for our
back-ends. However, in doing so, you would almost certainly end up
seeing vastly different APIs across all our apps as there is no
“standard” pattern for the design of these APIs.
Luckily, we all work at the same company and can communicate with each
other what "shape" our APIs should be. :) In individual teams, e.g. the
media apps, the API designers might even be the same people. Then, you'd
end up with very-similar APIs for Gallery, Video, and Music.
Using that logic, all our Gaia apps should currently have similar design patterns and coding standards. Is anybody here going to seriously argue that we already have that?!
Post by Jim Porter
Post by Justin D'Arcangelo
By sticking with HTTP, you will inherently have some level of
consistency between APIs for all of our apps — especially if we
follow a REST-like pattern.
I don't see a lot of potential for consistency with HTTP APIs, except in
the boring parts (e.g. boilerplate syntax). Without cross-team
communication, the names of resources will probably vary widely, as
would the conventions of what to pass as a parameter. Heck, these could
vary even among versions of the *same* app! For instance, the Music
app's backend currently takes filenames of individual songs to refer to
an album, whereas in the future, we might pass an album ID to reduce the
number of database queries on the backend. In a Javascript-based API,
however, we could hide that change from users by simply accepting a full
metadata object for a file as the parameter, and then extracting the
appropriate info inside our backend's implementation before the DB
query. Following conventions like this could make a JS-based API *more*
consistent than an HTTP-based alternative.
Versioning an API is something that happens all the time with HTTP APIs. Usually all that’s needed is a bump in a version number to change the URL pattern (e.g. /api/v2/…).
Post by Jim Porter
Post by Justin D'Arcangelo
You would also be set up for doing all sorts of new things in the
future with regards to splitting the app across multiple devices
(front-end on phone/back-end on desktop, etc).
While there are certainly benefits to doing things like this, I imagine
that in many cases, technologies like this already exist, and it would
be wiser for us to use them rather than invent our own HTTP API. For
instance, if we split up the media libraries from the UI, a likely
choice for communication would be UPnP/DLNA, since we'd then have
interoperability with a wide range of *other* devices. While UPnP is
effectively an HTTP API, it's not quite the kind that we'd design on our
own, since it uses XML as opposed to JSON, has a separate protocol
(RTSP) for the actual media data, and features strange things like
HTTP-over-UDP.
In any case, if the performance issues with Service Workers remain, it
may be better to provide a non-HTTP mode of communication if you're
dealing with a database on the same device as your UI.
If we are going to support other 3rd-party HTTP APIs in the back-end, why on earth would we design a back-end that’s *not* HTTP? If you are proposing that we have a thin JS wrapper that maps JS calls to HTTP calls, then I’m all for it. But, it seems to me that if we wanted our app to run on a UPnP back-end, we would effectively have to expose our own UPnP services through an HTTP API, right?
Post by Jim Porter
Post by Justin D'Arcangelo
Also, it should certainly be possible for apps to use a thin JS
“wrapper” around their back-end HTTP APIs as well. In fact, it is
fairly common to see APIs on the open web being offered this way *in
addition to* a plain-vanilla HTTP API (think Google Maps, Twitter,
etc.). However, this only affects the way a developer *consumes* said
API.
The way a developer uses an API is all an API is. Everything else is an
implementation detail. One of the reasons Google Maps, Twitter, etc
provide public documentation for their HTTP APIs is because it allows
applications written in arbitrary languages to communicate with them.
For Android, iOS, and desktop platforms, this can be pretty important.
However, since Firefox OS was designed from the ground up on the
assumption that all code is written in (or compiled to) Javascript, that
reason no longer applies.
This doesn’t make sense. If the back-end API is *not* HTTP, then what is the transport? We should not assume that client and server will always be on the same device if we want to scale up for the future.
Post by Jim Porter
Post by Justin D'Arcangelo
In the end, the back-end service still exposes an HTTP API
under-the-hood and offers a thin JS library for developers mostly as
a convenience.
In API design, I'd say convenience is everything.
- Jim
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Jim Porter
2015-11-20 21:32:23 UTC
Permalink
Post by Justin D'Arcangelo
We are trying to grow our number of contributors. Anything that
lowers the barrier of entry and follows well-established patterns in
the community helps. Also, I’m not referring to jQuery, Angular, etc.
which all have *well-documented* syntax with easy-to-follow examples.
I’m talking about things like DeviceStorage, MozCamera, etc. There
was just a thread the other day where someone did not understand how
to enumerate a directory with DeviceStorage, so I’d say that this
*is* a problem.
But I wasn't talking about deviceStorage. Presumably, no matter the
interface for our backend API, *we'd* be the ones dealing with
deviceStorage's oddities. Someone using our Music backend certainly
shouldn't have to care about deviceStorage.

You also seem to imply that, had deviceStorage been implemented as an
HTTP REST API, there wouldn't be confusion with it. However, I don't
think that's true. If we're thinking of the same thread, the concerns
with deviceStorage were about its semantics (e.g. the impossibility of
listing the files in a directory NON-recursively), not its interface.
Those issues would remain no matter how the API were accessed.
Post by Justin D'Arcangelo
Using that logic, all our Gaia apps should currently have similar
design patterns and coding standards. Is anybody here going to
seriously argue that we already have that?!
I'd argue that was a conscious decision on our part (and a bad one at
that). When I started on Firefox OS, there was an active resistance to
creating much in the way of shared code or creating/using a common API
(especially for UI stuff). While we did have things like shared/js and
the Building Blocks, the argument at the time was that we should each do
the work from scratch, since using jQuery, etc wasn't "the web".
However, nowadays we have a growing number of web components that we can
just drop in to our apps. That alone will help to foster a degree of
consistency among our apps.

In fact, the NGA effort in general was about coming up with a set of
ideas that all the apps should adopt. *Anything* we adopt universally
will have a level of consistency. It doesn't necessarily need to be
HTTP-based.
Post by Justin D'Arcangelo
Versioning an API is something that happens all the time with HTTP
APIs. Usually all that’s needed is a bump in a version number to
change the URL pattern (e.g. /api/v2/…).
Versioning an API doesn't necessarily make its semantics consistent
across versions, nor does it make migration to a new version easy. I'd
argue that richer syntax *does* make those things easier, since you can
treat more things as implementation details. In this particular case, a
JS-based API has the benefit of being able to pass non-string objects as
arguments and extract the appropriate data internally. This frees the
user of the API from worrying about what piece of the object is relevant
to the API; they just pass the whole object and the implementation
figures it out.
Post by Justin D'Arcangelo
Post by Jim Porter
In any case, if the performance issues with Service Workers remain,
it may be better to provide a non-HTTP mode of communication if
you're dealing with a database on the same device as your UI.
If we are going to support other 3rd-party HTTP APIs in the back-end,
why on earth would we design a back-end that’s *not* HTTP? If you are
proposing that we have a thin JS wrapper that maps JS calls to HTTP
calls, then I’m all for it. But, it seems to me that if we wanted our
app to run on a UPnP back-end, we would effectively have to expose
our own UPnP services through an HTTP API, right?
There are a few reasons we might choose not to access our backend via
HTTP. First, if we open up the possibility of talking to another device
that holds our media library, a logical extension of this is to talk to
*multiple* servers[1]. These devices may also be far away from the user,
and thus have a fair amount of latency when communicating. As a result,
we may want to have local indexes of the user's "aggregate library" for
performance. There's no benefit to these being accessible via HTTP,
since they're local by definition.

Second, as I mentioned above, we may choose to eliminate HTTP for our
"local" library in order to improve performance. Even if Service Workers
get faster than they are now, they still impose an additional layer of
indirection (serialization/deserialization of all messages). They also
force us to deal with the limitations of the platform's HTTP support,
including the inability to send multiple messages as a response, and no
"push" events. While there are proposals to add support for these
things, I'd consider "using HTTP" to be premature at this point.

Finally, we might find that the established HTTP APIs for our domain are
missing features that we'd like to support in our app, at least for
local libraries. As an off-the-cuff example, suppose we added the
ability to edit metadata. If UPnP doesn't support that[2], it might
prove easier to handle that without going through an HTTP API. For a
single feature like this, it's probably easier to just add a proprietary
extension to UPnP and still use that, but if we end up with many such
features, it might be easier to just provide the front-end with direct
JS-based access to the back-end.
Post by Justin D'Arcangelo
This doesn’t make sense. If the back-end API is *not* HTTP, then what
is the transport? We should not assume that client and server will
always be on the same device if we want to scale up for the future.
"Server" and "backend" aren't quite the same thing. Even apps which
communicate with a server might have their own (local-only) backend. The
email app is a good example of this: MIME parsing is part of the
"backend", and yet it's something that you'd expect to run locally[3].
An HTTP API to parse MIME would just add complexity and a second parsing
step (to parse the JSON returned from HTTP).

Except for very-simple apps, I expect that there will be lots of cases
like this: even when communicating with a Real Server, there's still a
fair bit of "backend" processing that makes the most sense to be done
locally. In these cases, an HTTP API provides little-to-no benefit.
However, splitting up the front-end and the back-end still provides
enormous benefit because it improves the readability, reliability, and
testability of our code.

- Jim

[1] These servers might even use different protocols, e.g. UPnP/DLNA,
Spotify, etc. In this case, a Javascript-based wrapper that unifies all
the different protocols into a common API would be really helpful.
[2] I don't think it does, but I haven't looked closely.
[3] You want the result of the MIME parsing to be a bunch of objects
(headers, bodies, etc) that you can pull from to render the message.
Jim Porter
2015-11-20 21:40:02 UTC
Permalink
Post by Jim Porter
While using HTTP internally might allow for some new features (like
running the backend on a different system),
Exactly, what if the back end could run on a server as a web service,
with a Service Worker as a progressive enhancement to make it work
offline?
This makes the false assumption that we'd benefit from splitting the
front-end and the back-end up onto different devices. That's not always
the case.

For some apps (e.g. dialer or camera), the point is that you're
communicating with hardware on the device you're holding in your hand
(you could have a "remote camera", but I expect the UI would be a lot
different).

For other apps (e.g. email), they already communicate with a remote
server, and I don't know if there's much benefit to moving its backend
code (MIME parser, local database) to another device.

For still other apps (e.g. music, video), it makes sense to have a
backend on a different device, but in many cases, such backend protocols
are already defined, and aren't just HTTP (UPnP/DLNA uses RTSP for media
data, for example). Even then, you'd likely want some parts of the
backend to always be on your device, e.g. a local version of (parts of?)
the database so that queries can be faster.
Post by Jim Porter
What if the app could work in multiple browsers?
A pure Javascript API would also work in multiple browsers without
issue. In fact, it would probably work *better* than an HTTP API, since
you'd be less likely to need brand-new browser features to make it work.
Post by Jim Porter
What if that API was also accessible by other apps so that we didn't have to use
proprietary cross-app messaging APIs? What if that cross-app messaging
could also work locally using cross-origin Service Workers? What if we
could replace other local proprietary JavaScript APIs in Gecko with web
services?
Why do those APIs have to be proprietary? If we come up with a really
good API that's not HTTP-based, I'm sure we could push to standardize
it. I'm all for purging the Inter-App Communications API, but in the
Music app at least, the alternative isn't Service Workers; I believe
there's an API in the works to allow media keys (e.g. on physical
keyboards, in the lockscreen, etc) to control playback. As far as I
know, it's on the standards track, although I can't recall the name
off-hand.
Post by Jim Porter
I don't think a REST API as a back end is inherently easier or more
performant, but it is good practice, it is the web, and it does make our
code much more portable. Currently Gaia is not of the web.
If it's not inherently easier or more performant, why is it good
practice? Is it good practice simply because it's "the web"? I disagree
that it makes our code more portable, since plain-old Javascript is at
least as portable. It might be more portable in certain specific
scenarios (e.g. if you need inter-app communications and don't have a
better standardized way of handling it), but not every app needs that,
nor does it mean the *entire* backend needs to be exposed via HTTP.
Post by Jim Porter
Even
if we used HTTP internally, we might find it preferable to expose an API
that takes advantage of all the syntactical niceties of modern
Javascript. ...
We could do that too.
At that point, HTTP is just an implementation detail, and we could defer
using HTTP in a given app until we decide it's actually better than just
running the Javascript "directly". For some apps, that might come along
pretty soon; for others, it might never happen.

- Jim
David Flanagan
2015-11-20 22:05:53 UTC
Permalink
Basically +1 to everything Jim has been saying here.

When service workers are ready, I think that some of our apps will be able
to make good use of them. For those apps, designing an HTTP API may make a
lot of sense. The Music app involves a lot of database queries, which map
nicely to REST APIs, so encoding method calls as URLs was a fairly natural
fit there (even though it the app is not actually using sevice workers or
HTTP).

Other apps may not have much use for service workers and will have their
backends in a regular web worker or iframe. For those apps, a JSON-based
postMessage/threads.js API will be a more straightforward and flexible
choice. I think that Gallery will probably be one of these apps.

And some apps (like Camera) are pretty much all front-end and may never
adopt the NGA architecture at all. This is an app that will never be
"webby", and that is okay.

But I really would like to shift our focus away from our core set of Gaia
apps and onto the OS itself. What can we do in the 2.6 release cycle to
improve the portabilty and performance of the FirefoxOS platform? What can
we do to make it a great OS to develop apps on?

David
Post by Jim Porter
Post by Jim Porter
While using HTTP internally might allow for some new features (like
running the backend on a different system),
Exactly, what if the back end could run on a server as a web service,
with a Service Worker as a progressive enhancement to make it work
offline?
This makes the false assumption that we'd benefit from splitting the
front-end and the back-end up onto different devices. That's not always
the case.
For some apps (e.g. dialer or camera), the point is that you're
communicating with hardware on the device you're holding in your hand
(you could have a "remote camera", but I expect the UI would be a lot
different).
For other apps (e.g. email), they already communicate with a remote
server, and I don't know if there's much benefit to moving its backend
code (MIME parser, local database) to another device.
For still other apps (e.g. music, video), it makes sense to have a
backend on a different device, but in many cases, such backend protocols
are already defined, and aren't just HTTP (UPnP/DLNA uses RTSP for media
data, for example). Even then, you'd likely want some parts of the
backend to always be on your device, e.g. a local version of (parts of?)
the database so that queries can be faster.
Post by Jim Porter
What if the app could work in multiple browsers?
A pure Javascript API would also work in multiple browsers without
issue. In fact, it would probably work *better* than an HTTP API, since
you'd be less likely to need brand-new browser features to make it work.
Post by Jim Porter
What if that API was also accessible by other apps so that we didn't
have to use
Post by Jim Porter
proprietary cross-app messaging APIs? What if that cross-app messaging
could also work locally using cross-origin Service Workers? What if we
could replace other local proprietary JavaScript APIs in Gecko with web
services?
Why do those APIs have to be proprietary? If we come up with a really
good API that's not HTTP-based, I'm sure we could push to standardize
it. I'm all for purging the Inter-App Communications API, but in the
Music app at least, the alternative isn't Service Workers; I believe
there's an API in the works to allow media keys (e.g. on physical
keyboards, in the lockscreen, etc) to control playback. As far as I
know, it's on the standards track, although I can't recall the name
off-hand.
Post by Jim Porter
I don't think a REST API as a back end is inherently easier or more
performant, but it is good practice, it is the web, and it does make our
code much more portable. Currently Gaia is not of the web.
If it's not inherently easier or more performant, why is it good
practice? Is it good practice simply because it's "the web"? I disagree
that it makes our code more portable, since plain-old Javascript is at
least as portable. It might be more portable in certain specific
scenarios (e.g. if you need inter-app communications and don't have a
better standardized way of handling it), but not every app needs that,
nor does it mean the *entire* backend needs to be exposed via HTTP.
Post by Jim Porter
Even
if we used HTTP internally, we might find it preferable to expose an
API
Post by Jim Porter
that takes advantage of all the syntactical niceties of modern
Javascript. ...
We could do that too.
At that point, HTTP is just an implementation detail, and we could defer
using HTTP in a given app until we decide it's actually better than just
running the Javascript "directly". For some apps, that might come along
pretty soon; for others, it might never happen.
- Jim
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Justin D'Arcangelo
2015-11-20 23:03:36 UTC
Permalink
Just an FYI, we have already started planning the work to move Camera over to NGA.

While much of the NGA plan includes parts of the platform that are not quite 100% ready to go yet (e.g. ServiceWorkers), we should not exclude them from our designs. We are building for the future. Of all the apps that would benefit tremendously from an HTTP-based back-end, I would think Gallery would be at the very top of that list. If the app owners cannot agree to follow the architecture that the NGA group has spent many months defining and validating, then I really don’t know how we’ll ever scale FxOS up to meet our future needs.

-Justin
Post by David Flanagan
Basically +1 to everything Jim has been saying here.
When service workers are ready, I think that some of our apps will be able to make good use of them. For those apps, designing an HTTP API may make a lot of sense. The Music app involves a lot of database queries, which map nicely to REST APIs, so encoding method calls as URLs was a fairly natural fit there (even though it the app is not actually using sevice workers or HTTP).
Other apps may not have much use for service workers and will have their backends in a regular web worker or iframe. For those apps, a JSON-based postMessage/threads.js API will be a more straightforward and flexible choice. I think that Gallery will probably be one of these apps.
And some apps (like Camera) are pretty much all front-end and may never adopt the NGA architecture at all. This is an app that will never be "webby", and that is okay.
But I really would like to shift our focus away from our core set of Gaia apps and onto the OS itself. What can we do in the 2.6 release cycle to improve the portabilty and performance of the FirefoxOS platform? What can we do to make it a great OS to develop apps on?
David
Post by Jim Porter
While using HTTP internally might allow for some new features (like
running the backend on a different system),
Exactly, what if the back end could run on a server as a web service,
with a Service Worker as a progressive enhancement to make it work
offline?
This makes the false assumption that we'd benefit from splitting the
front-end and the back-end up onto different devices. That's not always
the case.
For some apps (e.g. dialer or camera), the point is that you're
communicating with hardware on the device you're holding in your hand
(you could have a "remote camera", but I expect the UI would be a lot
different).
For other apps (e.g. email), they already communicate with a remote
server, and I don't know if there's much benefit to moving its backend
code (MIME parser, local database) to another device.
For still other apps (e.g. music, video), it makes sense to have a
backend on a different device, but in many cases, such backend protocols
are already defined, and aren't just HTTP (UPnP/DLNA uses RTSP for media
data, for example). Even then, you'd likely want some parts of the
backend to always be on your device, e.g. a local version of (parts of?)
the database so that queries can be faster.
Post by Jim Porter
What if the app could work in multiple browsers?
A pure Javascript API would also work in multiple browsers without
issue. In fact, it would probably work *better* than an HTTP API, since
you'd be less likely to need brand-new browser features to make it work.
Post by Jim Porter
What if that API was also accessible by other apps so that we didn't have to use
proprietary cross-app messaging APIs? What if that cross-app messaging
could also work locally using cross-origin Service Workers? What if we
could replace other local proprietary JavaScript APIs in Gecko with web
services?
Why do those APIs have to be proprietary? If we come up with a really
good API that's not HTTP-based, I'm sure we could push to standardize
it. I'm all for purging the Inter-App Communications API, but in the
Music app at least, the alternative isn't Service Workers; I believe
there's an API in the works to allow media keys (e.g. on physical
keyboards, in the lockscreen, etc) to control playback. As far as I
know, it's on the standards track, although I can't recall the name
off-hand.
Post by Jim Porter
I don't think a REST API as a back end is inherently easier or more
performant, but it is good practice, it is the web, and it does make our
code much more portable. Currently Gaia is not of the web.
If it's not inherently easier or more performant, why is it good
practice? Is it good practice simply because it's "the web"? I disagree
that it makes our code more portable, since plain-old Javascript is at
least as portable. It might be more portable in certain specific
scenarios (e.g. if you need inter-app communications and don't have a
better standardized way of handling it), but not every app needs that,
nor does it mean the *entire* backend needs to be exposed via HTTP.
Post by Jim Porter
Even
if we used HTTP internally, we might find it preferable to expose an API
that takes advantage of all the syntactical niceties of modern
Javascript. ...
We could do that too.
At that point, HTTP is just an implementation detail, and we could defer
using HTTP in a given app until we decide it's actually better than just
running the Javascript "directly". For some apps, that might come along
pretty soon; for others, it might never happen.
- Jim
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos <https://lists.mozilla.org/listinfo/dev-fxos>
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
David Flanagan
2015-11-20 23:37:17 UTC
Permalink
Post by Justin D'Arcangelo
Just an FYI, we have already started planning the work to move Camera over to NGA.
While much of the NGA plan includes parts of the platform that are not
quite 100% ready to go yet (e.g. ServiceWorkers), we should not exclude
them from our designs. We are building for the future. Of all the apps that
would benefit tremendously from an HTTP-based back-end, I would think
Gallery would be at the very top of that list.
The gallery back end does metadata parsing and image processing. I don't
see how HTTP helps here at all. (In fact, we lose the ability to treat
ArrayBuffers as Transferrable objects if we switch from postMessage() to an
HTTP API where data has to be copied.)

If you're talking about defining an HTTP API to device storage so that
Gallery can inter-operate with remote file storage services, that's
actually an interesting idea, but is out of scope for now.
Post by Justin D'Arcangelo
If the app owners cannot agree to follow the architecture that the NGA
group has spent many months defining and validating,
HTTP APIs for communication between front-end and back-end code is not
actually part of the NGA proposal, so you can't accuse me of not following
the architecture :-P. And, we've only validated the frontend/backend split
part of NGA. All the interesting and hard stuff involving service workers,
caching, app updates and page transitions has not been validated yet.
Post by Justin D'Arcangelo
then I really don’t know how we’ll ever scale FxOS up to meet our future
needs.
If you feel that you understand what our future needs are, I'd be very
interested to have you write up your vision and explain how NGA and HTTP
APIs help us meet those future needs and explain what you mean by "scale
up". (Not being snarky here. I really want to understand where you're
coming from on this.)

David
Post by Justin D'Arcangelo
-Justin
Basically +1 to everything Jim has been saying here.
When service workers are ready, I think that some of our apps will be able
to make good use of them. For those apps, designing an HTTP API may make a
lot of sense. The Music app involves a lot of database queries, which map
nicely to REST APIs, so encoding method calls as URLs was a fairly natural
fit there (even though it the app is not actually using sevice workers or
HTTP).
Other apps may not have much use for service workers and will have their
backends in a regular web worker or iframe. For those apps, a JSON-based
postMessage/threads.js API will be a more straightforward and flexible
choice. I think that Gallery will probably be one of these apps.
And some apps (like Camera) are pretty much all front-end and may never
adopt the NGA architecture at all. This is an app that will never be
"webby", and that is okay.
But I really would like to shift our focus away from our core set of Gaia
apps and onto the OS itself. What can we do in the 2.6 release cycle to
improve the portabilty and performance of the FirefoxOS platform? What can
we do to make it a great OS to develop apps on?
David
Post by Jim Porter
Post by Jim Porter
While using HTTP internally might allow for some new features (like
running the backend on a different system),
Exactly, what if the back end could run on a server as a web service,
with a Service Worker as a progressive enhancement to make it work
offline?
This makes the false assumption that we'd benefit from splitting the
front-end and the back-end up onto different devices. That's not always
the case.
For some apps (e.g. dialer or camera), the point is that you're
communicating with hardware on the device you're holding in your hand
(you could have a "remote camera", but I expect the UI would be a lot
different).
For other apps (e.g. email), they already communicate with a remote
server, and I don't know if there's much benefit to moving its backend
code (MIME parser, local database) to another device.
For still other apps (e.g. music, video), it makes sense to have a
backend on a different device, but in many cases, such backend protocols
are already defined, and aren't just HTTP (UPnP/DLNA uses RTSP for media
data, for example). Even then, you'd likely want some parts of the
backend to always be on your device, e.g. a local version of (parts of?)
the database so that queries can be faster.
Post by Jim Porter
What if the app could work in multiple browsers?
A pure Javascript API would also work in multiple browsers without
issue. In fact, it would probably work *better* than an HTTP API, since
you'd be less likely to need brand-new browser features to make it work.
Post by Jim Porter
What if that API was also accessible by other apps so that we didn't
have to use
Post by Jim Porter
proprietary cross-app messaging APIs? What if that cross-app messaging
could also work locally using cross-origin Service Workers? What if we
could replace other local proprietary JavaScript APIs in Gecko with web
services?
Why do those APIs have to be proprietary? If we come up with a really
good API that's not HTTP-based, I'm sure we could push to standardize
it. I'm all for purging the Inter-App Communications API, but in the
Music app at least, the alternative isn't Service Workers; I believe
there's an API in the works to allow media keys (e.g. on physical
keyboards, in the lockscreen, etc) to control playback. As far as I
know, it's on the standards track, although I can't recall the name
off-hand.
Post by Jim Porter
I don't think a REST API as a back end is inherently easier or more
performant, but it is good practice, it is the web, and it does make our
code much more portable. Currently Gaia is not of the web.
If it's not inherently easier or more performant, why is it good
practice? Is it good practice simply because it's "the web"? I disagree
that it makes our code more portable, since plain-old Javascript is at
least as portable. It might be more portable in certain specific
scenarios (e.g. if you need inter-app communications and don't have a
better standardized way of handling it), but not every app needs that,
nor does it mean the *entire* backend needs to be exposed via HTTP.
Post by Jim Porter
Even
if we used HTTP internally, we might find it preferable to expose
an API
Post by Jim Porter
that takes advantage of all the syntactical niceties of modern
Javascript. ...
We could do that too.
At that point, HTTP is just an implementation detail, and we could defer
using HTTP in a given app until we decide it's actually better than just
running the Javascript "directly". For some apps, that might come along
pretty soon; for others, it might never happen.
- Jim
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Andrew Sutherland
2015-11-21 01:07:06 UTC
Permalink
Post by Justin D'Arcangelo
If the app owners cannot agree to follow the architecture that the NGA
group has spent many months defining and validating, then I really
don’t know how we’ll ever scale FxOS up to meet our future needs.
Disclaimer: I understand this comment was made in a back-and-forth about
engineering issues which we all care very deeply about and so may not be
exactly what you intended to say, but I think the underlying point is
still worth addressing.

I'd like to reiterate :djf's comment that "Mozilla engineers understand
modularity and its benefits."

Specifically, I worry that there's an impression that the state of the
tree at the transition to v2.5 was entirely intentional or somehow due
to a lack of understanding of good software engineering practices.  The
general time-pressure, emergent branching, repeated stabilization-
focused intervals with strict uplift approval, and externally-imposed
features led to a sustained period where there was limited time for
cleanup, involving a lot of duct-tape engineering.

And I worry that this has led to the impression that engineers outside
of the NGA group somehow can't be trusted to make their own engineering
decisions.


This matters because as Ari made the point at the recent FxOS all hands,
"end user value" is of vital importance, and given our limited
resources, we are frequently making decisions between:
* Making user-visible enhancements
* Paying down technical debt
* Attempting to drive the platform forward by being experimental
guinea pigs
* Attempting to standardize across all FxOS apps
* Attempt to be more webby in some abstract sense.

Concerns in particular can arise where it can seem like "NGA for the
sake of NGA" that does not address perceived problems is creating
busywork.  Or where being a platform guinea pig has known risks that are
at odds with having a usable product[1] given the continued limited
bandwidth of the platform team.


A point being made in multiple places is that most of the NGA efforts
that were beneficial aren't so much a result of specific NGA
implementation choices being the cure for everything, but simply that
NGA is also built-on sound engineering principles of modularity,
encapsulation, etc. and that in v2.5 we've had time to pay down
technical debt.

I think it makes sense to say: "Hey, engineers, we trust you.  Here's
the selection of reusable libraries, idioms, and conventions we've
created for you to use, a la carte.  When you feel it's time to address
problems that these address, we'd like for you to pick from these first.
If they don't fit your use-case but are in the same problem domain,
let's have a discussion about whether it's appropriate to augment them
to fit your use-case or whether we should use some other existing open
source library, or even create a new library."

I also think it makes sense that when creating new libraries, etc., that
we discuss those on the list so that engineers with existing
solutions/thoughts on problem spaces can contribute.  This helps ensure
that everyone is on the same page and that they're aligned with the
library when it comes time to use it.  For example, AFAICT the first
time that the fast-list/gaia-fast-list effort was mentioned on our
mailing lists was when Music NGA landed[2].

Andrew

1: For specific examples:
* The email app adopted preliminary use of custom elements.  A bug
(https://bugzilla.mozilla.org/show_bug.cgi?id=1176829) in the custom
elements implementation was reported to the DOM team and acknowledged
on July 9th.  A fix landed over two months later on September 18th.
* The email app switched over to requestsync from mozAlarms, making
email's periodic sync unreliable for approximately 8 months.  (Noting
that since flame device clocks had serious reliability issues over
that extended time period and there were also several mozAlarms issues
that were only more recently fixed, it was not immediately obvious
that requestsync was broken until the other issues were ironed out.)

2: Note that I'm just using gaia-fast-list as an example because it's an
important implementation to performant apps but was not particularly
discussed and there was prior art/effort within the gaia repo by
multiple functional teams.  It seems pretty cool, quite well
documented and exampled, and with some model enhancements to not
require the entire model to be synchronously available to the list
implementation, would be suitable for email.  Although the shadow
root issues and the fact that the email app does its nefarious
localStorage HTML cache at a higher level mean that there would be
non-trivial effort to change and a potential startup time regression,
so that's an example of where it would not make sense to change-over
unless there was already a fundamental refactoring under way and the
life-cycle issue and shadow root issues had been addressed.
Vivien Nicolas
2015-11-23 11:08:16 UTC
Permalink
On Sat, Nov 21, 2015 at 2:07 AM, Andrew Sutherland <
Post by Justin D'Arcangelo
If the app owners cannot agree to follow the architecture that the NGA
group has spent many months defining and validating, then I really don’t
know how we’ll ever scale FxOS up to meet our future needs.
Disclaimer: I understand this comment was made in a back-and-forth about
engineering issues which we all care very deeply about and so may not be
exactly what you intended to say, but I think the underlying point is still
worth addressing.
I'd like to reiterate :djf's comment that "Mozilla engineers understand
modularity and its benefits."
Specifically, I worry that there's an impression that the state of the
tree at the transition to v2.5 was entirely intentional or somehow due to a
lack of understanding of good software engineering practices. The general
time-pressure, emergent branching, repeated stabilization-focused intervals
with strict uplift approval, and externally-imposed features led to a
sustained period where there was limited time for cleanup, involving a lot
of duct-tape engineering.
And I worry that this has led to the impression that engineers outside of
the NGA group somehow can't be trusted to make their own engineering
decisions.
This matters because as Ari made the point at the recent FxOS all hands,
"end user value" is of vital importance, and given our limited resources,
* Making user-visible enhancements
* Paying down technical debt
* Attempting to drive the platform forward by being experimental guinea
pigs
* Attempting to standardize across all FxOS apps
* Attempt to be more webby in some abstract sense.
Concerns in particular can arise where it can seem like "NGA for the sake
of NGA" that does not address perceived problems is creating busywork. Or
where being a platform guinea pig has known risks that are at odds with
having a usable product[1] given the continued limited bandwidth of the
platform team.
A point being made in multiple places is that most of the NGA efforts that
were beneficial aren't so much a result of specific NGA implementation
choices being the cure for everything, but simply that NGA is also built-on
sound engineering principles of modularity, encapsulation, etc. and that in
v2.5 we've had time to pay down technical debt.
I think it makes sense to say: "Hey, engineers, we trust you. Here's the
selection of reusable libraries, idioms, and conventions we've created for
you to use, a la carte. When you feel it's time to address problems that
these address, we'd like for you to pick from these first. If they don't
fit your use-case but are in the same problem domain, let's have a
discussion about whether it's appropriate to augment them to fit your
use-case or whether we should use some other existing open source library,
or even create a new library."
I also think it makes sense that when creating new libraries, etc., that
we discuss those on the list so that engineers with existing
solutions/thoughts on problem spaces can contribute. This helps ensure
that everyone is on the same page and that they're aligned with the library
when it comes time to use it. For example, AFAICT the first time that the
fast-list/gaia-fast-list effort was mentioned on our mailing lists was when
Music NGA landed[2].
Let me pile up a bit my personal opinion on your comments, and so on djs's
comment.

The state of the tree was clearly not intentional, or because of the lack
of skills. The set of constraints you have described are one of the root
cause of many things. In a limited timeframe, you can do a limited amount
of work. And has you have described, you can spend it making one choice at
a time - ignoring the other categories during this timeframe.

Sounds criminal to blame Gaia developers, if you think about all the work
that has been done with the amount of constraints.

Now it is not clear to me what it is to be an engineer outside of the NGA
group.

It seems to me that since the beginning the speech of *engineers* that have
decided to spent time on helping to prototype the proposed architecture has
always been: This is a proposal, and there are many various pieces. Some of
them may never happens, some of them will definitively helps, some will
likely be transformed before the end, etc...

But one of the core idea behind the proposal is: all the constraints you
have mentioned will likely rise again. Whatever you skills are you will
face again this situation and have to do choices. Promoting scoping and
encapsulations at many levels should help to reduce side effects and should
make the code easier to maintain and to understand. This is not a new idea,
but the proposal is trying to enforce it with platform level features, at
various levels.

So you should think about it as: "Nobody is perfect. Anyone can fail under
such constraints". Platform level enforced encapsulations would like to
help to reduce the possible side effects.

UI Components and modules, are other helping abstractions too.

So, anybody who want to help to shape this high level structure for apps,
and participate is part of the group.

Actually Francisco keeps complaining that there is not enough people
pissing on Service Worker ware, nor the Virtual list. Having more feedbacks
to understand why a particular library does not fit your use case is great.
Having patches to make it fit your use case is awesome. But in general
those libraries are open to discussions.

So, your "a-la-carte" wish, is basically what Francisco says since the
beginning!

Then it is unclear that there is a gap between what you want and where some
spend their efforts. One of the contention point could be that there is a
will to unify our apps architecture based on some of the lessons we have
all learned in the past years.

Now my next answer in this thread will try to answer a bit more directly
djf's points, in order to try to refocus a bit on the initial subject of
this thread. This answer will likely contradict a bit the "a-la-carte"
point and the feeling that any app owner can do whatever it wants, when it
wants - or when it feels it is time.

Vivien.

P.S: Virtual list has been mentioned multiple times in various thread under
different forms since a bit less than 2 years now. The will to really
deliver a solution has been captured in bug 1168076 (which lack a nice
description i should admit).
P.P.S: I agree on the lack of enough discussions on the mailing-list. But
iirc they has been some trials earlier without much impacts :/ Francisco
knows more than me on this subject.
Post by Justin D'Arcangelo
Andrew
* The email app adopted preliminary use of custom elements. A bug (
https://bugzilla.mozilla.org/show_bug.cgi?id=1176829) in the custom
elements implementation was reported to the DOM team and acknowledged on
July 9th. A fix landed over two months later on September 18th.
* The email app switched over to requestsync from mozAlarms, making
email's periodic sync unreliable for approximately 8 months. (Noting that
since flame device clocks had serious reliability issues over that extended
time period and there were also several mozAlarms issues that were only
more recently fixed, it was not immediately obvious that requestsync was
broken until the other issues were ironed out.)
2: Note that I'm just using gaia-fast-list as an example because it's an
important implementation to performant apps but was not particularly
discussed and there was prior art/effort within the gaia repo by multiple
functional teams. It seems pretty cool, quite well documented and
exampled, and with some model enhancements to not require the entire model
to be synchronously available to the list implementation, would be suitable
for email. Although the shadow root issues and the fact that the email app
does its nefarious localStorage HTML cache at a higher level mean that
there would be non-trivial effort to change and a potential startup time
regression, so that's an example of where it would not make sense to
change-over unless there was already a fundamental refactoring under way
and the life-cycle issue and shadow root issues had been addressed.
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Andrew Sutherland
2015-11-23 14:16:13 UTC
Permalink
Post by Vivien Nicolas
Actually Francisco keeps complaining that there is not enough people
pissing on Service Worker ware, nor the Virtual list. Having more
feedbacks to understand why a particular library does not fit your use
case is great. Having patches to make it fit your use case is awesome.
But in general those libraries are open to discussions. So, your "a-la-
carte" wish, is basically what Francisco says since the beginning!
To be clear, I agree: Everyone has been very open to discussion and as
an FxOS engineer I have not felt pressured to formally adopt NGA for the
sake of NGA.  If things continue like this, we're in great shape.  If we
all mail the mailing list a little bit more, we're in even better shape.

My specific concern is a combination of nitpicking on Justin's specific
phrasing of "follow" and that Wilfred's root message in this thread and
his follow-ups seem to very explicitly be a prescriptive "everybody
adopt NGA for the sake of NGA" which is a change from this.
Post by Vivien Nicolas
This answer will likely contradict a bit the "a-la-carte" point and
the feeling that any app owner can do whatever it wants, when it wants
- or when it feels it is time.
To clarify, I'm not suggesting module owners should get to be dictators
of a fiefdom and should work on what suits their whim.  All of the
aspects of NGA are meant to address different problems we may encounter.
I think it makes sense for product/UX/foxfooders/engineers to agree on
the biggest problems in apps and prioritize them.

For example: "Check out this profile, your app is unresponsive during
normal usage because of too much main-thread work and we need to move
things to a worker ASAP" is a great reason to do an overdue FE/BE worker
split.  "All the apps need to be on NGA" is not.

"I was trying to figure out how I could create a tablet version of this
screen without forking the app, and I couldn't because the view logic
and application is too entangled" is likewise a great reason to focus on
solutions to that problem.  Other internals issues that impact potential
contributors are also important, and this is a place where arguments for
consistency should definitely be considered with the trade-offs.


Hopefully I'm misunderstanding the original intent of the thread.  If
the idea is that that the NGA group will help identify specific
user/developer/contributor pain points in apps and specific NGA
solutions and will talk with the relevant parties (product, US,
engineering, etc.) about priorities and trade-offs, then that is
awesome.  If we're talking about prioritizing checking a bunch of boxes
for the sake of checking a bunch of boxes, I'm concerned, and I think
that may be the concern of others as well.

Andrew
Vivien Nicolas
2015-11-23 15:11:18 UTC
Permalink
On Mon, Nov 23, 2015 at 3:16 PM, Andrew Sutherland <
Post by Vivien Nicolas
Actually Francisco keeps complaining that there is not enough people
pissing on Service Worker ware, nor the Virtual list. Having more feedbacks
to understand why a particular library does not fit your use case is great.
Having patches to make it fit your use case is awesome. But in general
those libraries are open to discussions.
So, your "a-la-carte" wish, is basically what Francisco says since the
beginning!
To be clear, I agree: Everyone has been very open to discussion and as an
FxOS engineer I have not felt pressured to formally adopt NGA for the sake
of NGA. If things continue like this, we're in great shape. If we all
mail the mailing list a little bit more, we're in even better shape.
My specific concern is a combination of nitpicking on Justin's specific
phrasing of "follow" and that Wilfred's root message in this thread and his
follow-ups seem to very explicitly be a prescriptive "everybody adopt NGA
for the sake of NGA" which is a change from this.
I think Wilfred point is: it should be easy to replace any views. For us at
Mozilla, as the shape of the future product is not defined, for partners as
they may want to customize things, for third party as they may want to have
fun.

Now, I don't think Wilfred or others are really pushing for one specific
technical solution.

But so far 'NGA' is likely what they have been told will help for some of
those specific issues, as well as some others. Then it sounds logical to
them that they want to move forward, trying to break the architecture
proposal into multiple parts that can be incrementally worked on while
trying to define a product.
Post by Vivien Nicolas
This answer will likely contradict a bit the "a-la-carte" point and the
feeling that any app owner can do whatever it wants, when it wants - or
when it feels it is time.
To clarify, I'm not suggesting module owners should get to be dictators of
a fiefdom and should work on what suits their whim. All of the aspects of
NGA are meant to address different problems we may encounter. I think it
makes sense for product/UX/foxfooders/engineers to agree on the biggest
problems in apps and prioritize them.
For example: "Check out this profile, your app is unresponsive during
normal usage because of too much main-thread work and we need to move
things to a worker ASAP" is a great reason to do an overdue FE/BE worker
split. "All the apps need to be on NGA" is not.
"I was trying to figure out how I could create a tablet version of this
screen without forking the app, and I couldn't because the view logic and
application is too entangled" is likewise a great reason to focus on
solutions to that problem. Other internals issues that impact potential
contributors are also important, and this is a place where arguments for
consistency should definitely be considered with the trade-offs.
Those are great examples. I bet all of the app authors have a few lessons
learned in the past years, and some stuffs they have been struggling with.
This is some of those that we should solve with some architectural changes.

Usually one solution does not fit all, and there will likely be some
differences into apps architecture in the future, but at least it would be
great to have a high level architecture common to most apps.

One of the things the proposal is trying to do is to draw some white boxes.
Authors can freely address their specific issues into them. Those boxes are
delimited via platform primitives such as compartments, threads or
processes.
Post by Vivien Nicolas
Hopefully I'm misunderstanding the original intent of the thread. If the
idea is that that the NGA group will help identify specific
user/developer/contributor pain points in apps and specific NGA solutions
and will talk with the relevant parties (product, US, engineering, etc.)
about priorities and trade-offs, then that is awesome. If we're talking
about prioritizing checking a bunch of boxes for the sake of checking a
bunch of boxes, I'm concerned, and I think that may be the concern of
others as well.
We are talking about moving forward in an uncertain environment, and to
offer a flexible enough Gaia so it can fit into multiple variants in a
quick, stable and performant way.

Thanks for raising your concerns thought. I'm pretty sure you are not alone
to feel this way.

Vivien.
Post by Vivien Nicolas
Andrew
Wilfred Mathanaraj
2015-11-23 15:26:20 UTC
Permalink
Absolutely - how we implement the changeable views is an engineering call till now I only had one option and that was the FE/BE split.

If there are different technical options then even better - just need to understand the pros and cons.

- for me its critical that we have a adaptable, modular architecture that will allow people who use our OS to modify to their need.

BR
Wilfred
Actually Francisco keeps complaining that there is not enough people pissing on Service Worker ware, nor the Virtual list. Having more feedbacks to understand why a particular library does not fit your use case is great. Having patches to make it fit your use case is awesome. But in general those libraries are open to discussions.
So, your "a-la-carte" wish, is basically what Francisco says since the beginning!
To be clear, I agree: Everyone has been very open to discussion and as an FxOS engineer I have not felt pressured to formally adopt NGA for the sake of NGA. If things continue like this, we're in great shape. If we all mail the mailing list a little bit more, we're in even better shape.
My specific concern is a combination of nitpicking on Justin's specific phrasing of "follow" and that Wilfred's root message in this thread and his follow-ups seem to very explicitly be a prescriptive "everybody adopt NGA for the sake of NGA" which is a change from this.
I think Wilfred point is: it should be easy to replace any views. For us at Mozilla, as the shape of the future product is not defined, for partners as they may want to customize things, for third party as they may want to have fun.
Now, I don't think Wilfred or others are really pushing for one specific technical solution.
But so far 'NGA' is likely what they have been told will help for some of those specific issues, as well as some others. Then it sounds logical to them that they want to move forward, trying to break the architecture proposal into multiple parts that can be incrementally worked on while trying to define a product.
This answer will likely contradict a bit the "a-la-carte" point and the feeling that any app owner can do whatever it wants, when it wants - or when it feels it is time.
To clarify, I'm not suggesting module owners should get to be dictators of a fiefdom and should work on what suits their whim. All of the aspects of NGA are meant to address different problems we may encounter. I think it makes sense for product/UX/foxfooders/engineers to agree on the biggest problems in apps and prioritize them.
For example: "Check out this profile, your app is unresponsive during normal usage because of too much main-thread work and we need to move things to a worker ASAP" is a great reason to do an overdue FE/BE worker split. "All the apps need to be on NGA" is not.
"I was trying to figure out how I could create a tablet version of this screen without forking the app, and I couldn't because the view logic and application is too entangled" is likewise a great reason to focus on solutions to that problem. Other internals issues that impact potential contributors are also important, and this is a place where arguments for consistency should definitely be considered with the trade-offs.
Those are great examples. I bet all of the app authors have a few lessons learned in the past years, and some stuffs they have been struggling with. This is some of those that we should solve with some architectural changes.
Usually one solution does not fit all, and there will likely be some differences into apps architecture in the future, but at least it would be great to have a high level architecture common to most apps.
One of the things the proposal is trying to do is to draw some white boxes. Authors can freely address their specific issues into them. Those boxes are delimited via platform primitives such as compartments, threads or processes.
Hopefully I'm misunderstanding the original intent of the thread. If the idea is that that the NGA group will help identify specific user/developer/contributor pain points in apps and specific NGA solutions and will talk with the relevant parties (product, US, engineering, etc.) about priorities and trade-offs, then that is awesome. If we're talking about prioritizing checking a bunch of boxes for the sake of checking a bunch of boxes, I'm concerned, and I think that may be the concern of others as well.
We are talking about moving forward in an uncertain environment, and to offer a flexible enough Gaia so it can fit into multiple variants in a quick, stable and performant way.
Thanks for raising your concerns thought. I'm pretty sure you are not alone to feel this way.
Vivien.
Andrew
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos <https://lists.mozilla.org/listinfo/dev-fxos>
Jim Porter
2015-11-20 23:28:41 UTC
Permalink
Post by Justin D'Arcangelo
While much of the NGA plan includes parts of the platform that are
not quite 100% ready to go yet (e.g. ServiceWorkers), we should not
exclude them from our designs.
True, but neither should we include them in places where they don't
provide significant value. If Service Workers don't help make an app
better in some concrete way, we can defer adding them for the time
being. A well-designed app should have no trouble converting to use
Service Workers farther in the future, since it's essentially a
middleman between the front-end and the back-end.

This is already what the Music app does, and given the relative
simplicity of our "HTTP" routing, it would be entirely reasonable to use
bridge.js directly unless and until we decide that we actually *need*
Service Workers for something[1]. In short, we should follow the "You
Ain't Gonna Need It" principle when it comes to NGA-ifying apps.
Post by Justin D'Arcangelo
We are building for the future.
In my experience, building for the future has about a 50% chance of just
adding more plumbing that we have to rip out later anyway. It's
extremely difficult to predict exactly what we'll need several years
down the line. That's why I advocate for keeping things simple; at least
that way, there's less stuff to rip out.
Post by Justin D'Arcangelo
If the app owners cannot agree to follow the architecture that the
NGA group has spent many months defining and validating, then I
really don’t know how we’ll ever scale FxOS up to meet our future
needs.
Arguably, I'm in the "NGA group" as well, so not even the NGA group can
agree on the architecture. >:D

- Jim

[1] Of course, we don't *need* Service Workers for anything in the Music
app (proof: we're not using them), but I was ok with creating an
HTTP-like API for our backend because NGAifying Music was an
*experiment*. We shouldn't expect everything from an experiment to be a
resounding success. Instead, let's evaluate each piece on its own merits
for each place it could be used.
Jim Porter
2015-11-20 23:14:44 UTC
Permalink
Post by David Flanagan
When service workers are ready, I think that some of our apps will be
able to make good use of them. For those apps, designing an HTTP API may
make a lot of sense. The Music app involves a lot of database queries,
which map nicely to REST APIs, so encoding method calls as URLs was a
fairly natural fit there (even though it the app is not actually using
sevice workers or HTTP).
As I mentioned in another message, even for Music, it's debatable if an
HTTP API is the best long-term strategy. Eventually, I think we'd like
to support streaming from libraries on other machines (via UPnP/DNLA,
Ampache, Spotify, AURA, etc). All of these have different HTTP APIs[1],
despite doing similar things. It would make sense to wrap all these APIs
in a compatibility layer so that, to the rest of the app, they look the
same (maybe with some capabilities flags for each to enable/disable
features). This compatibility layer could be an HTTP API, but it seems
rather excessive to wrap one HTTP API with another. I can't imagine it'd
be good for performance either, since we'd have to box/unbox data twice
as much.

Instead, I think the compatibility layer should have a Javascript API.
This is more efficient, and also lets us add all the convenience
functions that we might want but can't easily provide via HTTP (I think
most people already agree that a Javascript-based "convenience API" is
an ok-to-good idea). Once such an API exists, it becomes logical to
implement our local backend in terms of that API. Thus, the local
backend is accessed via a Javascript API.

Now, we could still provide access to our local Music backend over HTTP
(say, via UPnP) so that people could run a headless Music app on their
desktop to manage their library, but I'm not sure why we'd bother. There
are already dozens of UPnP media servers out there, and I don't think we
gain much by throwing our hat into the ring. Why not just let other
folks worry about making the remote server so we can focus on making the
best client we can?

- Jim

[1] Well, mostly HTTP. UPnP uses RTSP for transferring the actual media.
I don't know a whole lot about Ampache either, but I think it uses HTTP.
Vivien Nicolas
2015-11-23 12:46:34 UTC
Permalink
Post by David Flanagan
I've been thinking a lot about this thread in the context of Ari's talk at
the All Hands meeting yesterday. We're working on an OS that has to run on
smartphones, smart tv's and other form factors tbd. Ari asked us to focus
on portability, and that obviously will be key to our ability to run on
different form factors.
I had something of an epiphany today: In the future, teams inside and
outside of Mozilla will build devices that run FirefoxOS and will create
products that provide true user value and delight. At this moment we don't
know what those products will be. So for core FirefoxOS developers, our
users are these future product development teams. We need to be building an
OS that is so fast and flexible, so portable and performant that product
developers will feel delight using our platform.
"At this moment we don't know what those products will be".

This sentence is extremely important to me. It should have been the first
thing I noticed. As far as I know, this is correct. Nobody knows.
Am I wrong to say this is true since last December ?

But...based on Wilfred initial email, there are some hints. Various form
factors. List of most wanted apps. The need for different views for those
apps.

This is something we can address. Ensuring the FE and the BE are properly
splitted, with clear and documented APIs, will be helpful, to make it
easier to write various views. My point is that this work should happens
first.

Once it has happens, you can parallelize work. Some people can work on
transforming the front-end to use a components system, while some other may
work on making the backend more pleasant, more abstract, more performant
and add some new features.

Also, once a lot of the business logic has been clearly separated, it would
be much easier to have others helping the front-end of any apps.

Concerning point #2. The idea is that porting all the front-end in once is
hard. It is also hard to get many people working on various panels at the
same time. Splitting things into multiple isolated contexts, may let many
people working at the same time on a dedicated view, and limit the possible
area of conflicts.
One can argue that this can be more or less achieved using the right
framework and beeing very cautious. This is likely. But once the team
starts to be under heavy constraints this is something very hard to keep
running. While strong isolations of views, prevent some changes to leak in
other views, helping developers and reviewers in their daily job. If
everybody rush into web components now, are we sure we will not beeing
asked to ship something before everything has been converted ? And if so,
do you really want to ends up in the same situation than one of two years
ago ?

I'm less confident in #3 if we want to do it at Gecko level. So far, and as
you mentioned, we lack some platform features to do it properly. Hopefully,
once we have #2 it can be emulated partly at the toolkit level (you will be
happy there is a web component for that).

Basically Web Components will help to write views faster, with globally a
more unified experience across the target. But if you want more manpower
from people out of your team in order to move very quickly, you will need
to have a clearly isolated backends with clear APIs, ensure the work of
one, will not conflict nor regress the work of an other, and have a
incremental way to migrate.

Also, Web Components will help a lot for the UI paradigm. But this part is
undefined so far.

Even by assuming all apps has been able to migrate to use components
everywhere before the next rush - we may be in front of a target device
that use completely a completely different metaphor.
Yes, components will have clean the (UI) code base, and it sounds easier to
replace just a component. But you will again have to fix all the app (UI)
at once, working with the limited set of people that knows the app business
logic and constraints, trying to avoid regressions abd collisions.
Sound scary to me. Not saying #1 and #2 will fix everything. But they are
trying to help at least.

Vivien.
Post by David Flanagan
With that in mind, I'd like to suggest that we'd be better served by
focusing on web components than by working on NGA.
Converting our building blocks to web components and then refactoring our
apps to use those components and to be based on higher-level web components
will give us much of the modularity and portability that we're seeking from
NGA, but at the same time, it will also create a high-quality library of
reusable UI components that third party app authors (including those who
are embedding FirefoxOS in new products) can use to more easily create apps.
David
Hi all,
Given the Music app splitting we have done in time for 2.5 we want to
move ahead - I think it makes sense to be executed in a “train model”
fashion.
We should start from the top of the list and work through the list.
When I say splitting of the apps, we are looking for the following
1. FE/BE split
2. Split views
3. Page transition
Why did I choose the priority below? - for now we have 2 products that we
work on: smartphone and TV, but moving forward we need to investigate what
are the products that make sense for us and when we enter the connected
devices market 3rd party developers need to be able to develop differing
views for our core apps.
With this is mind we went through some exercise to define a priority for
the apps to be ported to the updated architecture.
- *Settings* - this is a key app for any product mozilla may be
planning to release; different apps will have different needs to display
information to the user in the settings
- *Camera *- again a key app for a lot of the modern devices
- *Contacts* - everyone wants to have contacts on their devices - but
they need different level of information - creating differing views is
going to key here
- *Calendar* - as with contacts its critical to have differing views
but not as high priority as contacts
- *Gallery* - another core app that every connected device may need
to have
- *E-mail* - typing emails on smaller devices will be a problem and
therefore creating readable email view may be needed for some connected
deviceds
- *Calculator *- table stake app
- *Clock *- table stake app
- *Browser *- one of core mozilla apps but a table stake app for some
of the connected devices
Some of the engineering teams, who have already worked on this split,
will be reaching out in smaller teams to discuss best practices and quick
wins for this activity.
BR
Wilfred
---
FxOS Product Management
Mozilla Corp., UK
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
a***@gmail.com
2015-11-25 17:41:50 UTC
Permalink
The problem here is coming from un-trust.

As you said, splitting panel into iframes will force people to destruct the panel dependency. Isn't this just meaning: hey I don't trust you can develop a good application architecture with less coupling, so now please use NGA because you cannot couple panels anymore even you want to coupling.

As a web developer, I wrote less code than you all; but only thing I know better is: there is no best practice for Web application. People can use any framework, any library, and self-made frameworks to bake their application. There is no total solution for web application. So this is not a point to say NGA is good.

Just like djf mentioned, mozilla knows modularity. I liked that we have different architecture design for each app; it makes sense because each application is trying to address different user stories and achieve different goals. So why do we need a overall one-and-all architecture? Even applying the NGA, people can definitely write codes which makes their applications looks so different.... you cannot ask people to design the modules inside the panels with NGA.

Unless you invent NNGA: hey, please move every little component inside your panel into iframes. Make every module communication become asynchronous, even we don't need to do.

Sounds crazy... and this was something you mentioned to me, but never convinced me. Yes, being async is good for cases. With promises we can write beauituful codes. But sometimes we just need synchronous communication.

Also, I like the way people have their own idea about module. Even every one starts to use ES6 syntax to write applications, I could tell there would be 20 different ways to define a module across 20 different applications. Some of them might be inspiring, and I can learn from them. Some of them might be still deep coupling, and we need to fix them by learning from each other, instead of saying, hey use NGA or NNGA to write code, I am just want to help!

Everyone is here to help, who is not? :)

At least I won't say, hey angular is popular, please rewrite your application with it. I am just want to help! Hey reactJS is cool, use it! I'm just want to help.

No, no. Framework or library won't teach you how to organize your application. As I said, even with ES6, I can write bad code with dirty module coupling. It's not what you use shape your app. It's what you think. It's your experience helping you. I wrote very bad code when I joined mozilla, but I made some effort such as read all kind of codes from others and did lots of refactoring. Now I have my own "feel" about modularity and architecture. If you ask me to follow only one way to write my code, I don't think I can grow up.

I believe what shall be done is not asking people to follow your own "future". I think a better way is to gather people sit down to tell each other:

1. What's the current architecture of my application?
2. How do I separate my UI and data? If I don't, what's blocking me to do that? (Please, don't call that FE/BE. Very confusing.)
3. What's possible if I am asked to design an application to fit different devices? What would be common, and what would be device specific? Don't we just need to extract the data logic from the view logic? Why do we need to put every panel and every little component into iframes and increase the communication overhead?

What made me sad at most, is that, people is selling NGA ideas like they are the sales, not an engineer. I am not the customer. It's really annoying to hear 'this is really wonderful' without real data. Such an advertising wording does not convince me. I can do the same thing to split modules without NGA's help. I can see that some people will still write coupling codes with NGA. And in the long run, it hears like: people don't how to lessen module coupling before we invent NGA. This is also the point that increases the un-trust between developers as I mentioned above.

It's very "interesting" to see people say "NGA is working" and show us that pick contact activity now don't need to load the first page. It's not coming from NGA. It was a design failure that we must load the main panel and then the second panel.

There was ever an app called settings app.. Long long time ago, we need to load the main setting panel when we are using web activity to launch certain panel. But Arthur and 佳龍 did lots nice refactoring work to split the subpanels. Now we can directly load any subpanels. And what's most important, this was happening before NGA. What they use is just require-js and have their own design of panels. I bet that I can do the same thing without using requirejs. So why can we say NGA did succeed and work because of this result..?

TL;DR
1. There is No architecture total solution for web. Each app has it own shape, its own target, and its own future.
2. Force using NGA implies untrust to the devs
3. Web won't teach you how to coding. Web is silent.
4. Brainstorming and learning from each other makes dev grow. Force using one framework makes dev become code farmer.
5. When I said NGA, I am talking about "splitting views into iframes". Not the gaia-fast-list. Not moving heavy-load things to web worker. Some of the technologies are good, but made everything become iframe is not.

-Alive

Vivien Nicolas於 2015年11月23日星期一 UTC+8下午8時46分43秒寫道:
I've been thinking a lot about this thread in the context of Ari's talk at the All Hands meeting yesterday. We're working on an OS that has to run on smartphones, smart tv's and other form factors tbd. Ari asked us to focus on portability, and that obviously will be key to our ability to run on different form factors.
I had something of an epiphany today: In the future, teams inside and outside of Mozilla will build
devices that run FirefoxOS and will create products that provide true
user value and delight. At this moment we don't know what those products
will be. So for core FirefoxOS developers, our users are these future
product development teams. We need to be building an OS that is so fast
and flexible, so portable and performant that product developers will
feel delight using our platform.
"At this moment we don't know what those products will be".
This sentence is extremely important to me. It should have been the first thing I noticed. As far as I know, this is correct. Nobody knows.
Am I wrong to say this is true since last December ?
But...based on Wilfred initial email, there are some hints. Various form factors. List of most wanted apps. The need for different views for those apps.
This is something we can address. Ensuring the FE and the BE are properly splitted, with clear and documented APIs, will be helpful, to make it easier to write various views. My point is that this work should happens first.
Once it has happens, you can parallelize work. Some people can work on transforming the front-end to use a components system, while some other may work on making the backend more pleasant, more abstract, more performant and add some new features.
Also, once a lot of the business logic has been clearly separated, it would be much easier to have others helping the front-end of any apps.
Concerning point #2. The idea is that porting all the front-end in once is hard. It is also hard to get many people working on various panels at the same time. Splitting things into multiple isolated contexts, may let many people working at the same time on a dedicated view, and limit the possible area of conflicts.
One can argue that this can be more or less achieved using the right framework and beeing very cautious. This is likely. But once the team starts to be under heavy constraints this is something very hard to keep running. While strong isolations of views, prevent some changes to leak in other views, helping developers and reviewers in their daily job. If everybody rush into web components now, are we sure we will not beeing asked to ship something before everything has been converted ? And if so, do you really want to ends up in the same situation than one of two years ago ?
I'm less confident in #3 if we want to do it at Gecko level. So far, and as you mentioned, we lack some platform features to do it properly. Hopefully, once we have #2 it can be emulated partly at the toolkit level (you will be happy there is a web component for that).
Basically Web Components will help to write views faster, with globally a more unified experience across the target. But if you want more manpower from people out of your team in order to move very quickly, you will need to have a clearly isolated backends with clear APIs, ensure the work of one, will not conflict nor regress the work of an other, and have a incremental way to migrate.
Also, Web Components will help a lot for the UI paradigm. But this part is undefined so far. 
Even by assuming all apps has been able to migrate to use components everywhere before the next rush - we may be in front of a target device that use completely a completely different metaphor.
Yes, components will have clean the (UI) code base, and it sounds easier to replace just a component. But you will again have to fix all the app (UI) at once, working with the limited set of people that knows the app business logic and constraints, trying to avoid regressions abd collisions.
Sound scary to me. Not saying #1 and #2 will fix everything. But they are trying to help at least.
Vivien.
 
With that in mind, I'd like to suggest that we'd be better served by focusing on web components than by working on NGA.
Converting our building blocks to web components and then refactoring our apps to use those components and to be based on higher-level web components will give us much of the modularity and portability that we're seeking from NGA, but at the same time, it will also create a high-quality library of reusable UI components that third party app authors (including those who are embedding FirefoxOS in new products) can use to more easily create apps.
   David
Hi all,
Given the Music app splitting we have done in time for 2.5 we want to move ahead - I think it makes sense to be executed in a “train model” fashion. 
We should start from the top of the list and work through the list.
1. FE/BE split
2. Split views
3. Page transition  
Why did I choose the priority below? - for now we have 2 products that we work on: smartphone and TV, but moving forward we need to investigate what are the products that make sense for us and when we enter the connected devices market 3rd party developers need to be able to develop differing views for our core apps. 
With this is mind we went through some exercise to define a priority for the apps to be ported to the updated architecture.
Settings - this is a key app for any product mozilla may be planning to release; different apps will have different needs to display information to the user in the settings
Camera  - again a key app for a lot of the modern devices
Contacts - everyone wants to have contacts on their devices - but they need different level of information - creating differing views is going to key here
Calendar - as with contacts its critical to have differing views but not as high priority as contacts
Gallery  - another core app that every connected device may need to have
E-mail - typing emails on smaller devices will be a problem and therefore creating readable email view may be needed for some connected deviceds
Calculator - table stake app
Clock - table stake app
Browser - one of core mozilla apps but a table stake app for some of the connected devices
Some of the engineering teams, who have already worked on this split, will be reaching out in smaller teams to discuss best practices and quick wins for this activity.
BR
Wilfred
---
FxOS Product Management
Mozilla Corp., UK
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Francisco Jordano
2015-11-25 19:39:12 UTC
Permalink
Hi folks,
Post by a***@gmail.com
The problem here is coming from un-trust.
As you said, splitting panel into iframes will force people to destruct
the panel dependency. Isn't this just meaning: hey I don't trust you can
develop a good application architecture with less coupling, so now please
use NGA because you cannot couple panels anymore even you want to coupling.
That's a really interesting point, why are we talking about panels, we are
writing webs, or at least that was the original idea. We as web developers,
are used to write single page apps cause it's what is suppose to work in
mobile. But again, that's not the web we used to know, it's not the web of
documents, the web we learned while pressing the 'view source code' button.
And it's in our hand to push the platform forward to make the web to work
better everywhere.
Post by a***@gmail.com
As a web developer, I wrote less code than you all; but only thing I know
better is: there is no best practice for Web application. People can use
any framework, any library, and self-made frameworks to bake their
application. There is no total solution for web application. So this is not
a point to say NGA is good.
I totally agree with this, there is not a single solution for everything,
and I think that what it's been call NGA (oh gosh, you don't know how much
I hate the name ;) ), was a set of ideas, that not all of them would make
sense to apply, that will always depend on the nature of the app. For
example, if you take a look to the retrospective [1] of the people that was
trying to apply some of this recommendations, some things worked some
things didn't.

If by NGA we are talking about splitting the views in documents, again,
there are some of the apps that are more document oriented than others
right?
Post by a***@gmail.com
Just like djf mentioned, mozilla knows modularity. I liked that we have
different architecture design for each app; it makes sense because each
application is trying to address different user stories and achieve
different goals. So why do we need a overall one-and-all architecture?
Even applying the NGA, people can definitely write codes which makes their
applications looks so different.... you cannot ask people to design the
modules inside the panels with NGA.
About each app having a different architecture we could be discussing for a
while, we could have people arguing that it delays development with
developers having to get familiar with totally different ways of writing
apps, same problem for contributors, being difficult for them to try to
help in different parts. But as well I agree the beauty and freedom of each
app being shaped by the owners enrich the experience and shows what the web
is.

Personally I don't think that writing your views in different documents
will prevent you to design your modules in one way or another, it wont
enforce you to not to write ES6 modules or use require.js or use <put your
favourite framework here (avoid react.js and angular cause they will think
we are making fun of them)>.

For me it's an interesting proposition that allow us to be more flexible in
terms of reusing complete views, interchange them, partners being able to
customize easily, having documents that are almost independent, getting
closer to what we used to do in web development. I would suggest to get a
look to the work in music [2] and contacts [3]. Again, this is totally
subjective, perhaps for me is nicer to work in that way, but that doesn't
mean I'm right. (Oh boy, sometimes even remind me to android activities,
not our activities :))
Post by a***@gmail.com
Unless you invent NNGA: hey, please move every little component inside
your panel into iframes. Make every module communication become
asynchronous, even we don't need to do.
Sounds crazy... and this was something you mentioned to me, but never
convinced me. Yes, being async is good for cases. With promises we can
write beauituful codes. But sometimes we just need synchronous
communication.
Also, I like the way people have their own idea about module. Even every
one starts to use ES6 syntax to write applications, I could tell there
would be 20 different ways to define a module across 20 different
applications. Some of them might be inspiring, and I can learn from them.
Some of them might be still deep coupling, and we need to fix them by
learning from each other, instead of saying, hey use NGA or NNGA to write
code, I am just want to help!
Everyone is here to help, who is not? :)
+ 1000 \o/
Post by a***@gmail.com
At least I won't say, hey angular is popular, please rewrite your
application with it. I am just want to help! Hey reactJS is cool, use it!
I'm just want to help.
;)
Post by a***@gmail.com
No, no. Framework or library won't teach you how to organize your
application. As I said, even with ES6, I can write bad code with dirty
module coupling. It's not what you use shape your app. It's what you think.
It's your experience helping you. I wrote very bad code when I joined
mozilla, but I made some effort such as read all kind of codes from others
and did lots of refactoring. Now I have my own "feel" about modularity and
architecture. If you ask me to follow only one way to write my code, I
don't think I can grow up.
That's totally right again, no framework or library will prevent that you
shoot yourself in the foot. Also personally I've never seen anyone inside
mozilla telling you have to code in this way, things were proposed and have
to grow within the engineers.
Post by a***@gmail.com
I believe what shall be done is not asking people to follow your own
"future". I think a better way is to gather people sit down to tell each
1. What's the current architecture of my application?
2. How do I separate my UI and data? If I don't, what's blocking me to do
that? (Please, don't call that FE/BE. Very confusing.)
3. What's possible if I am asked to design an application to fit different
devices? What would be common, and what would be device specific? Don't we
just need to extract the data logic from the view logic? Why do we need to
put every panel and every little component into iframes and increase the
communication overhead?
What made me sad at most, is that, people is selling NGA ideas like they
are the sales, not an engineer. I am not the customer. It's really annoying
to hear 'this is really wonderful' without real data. Such an advertising
wording does not convince me. I can do the same thing to split modules
without NGA's help. I can see that some people will still write coupling
codes with NGA. And in the long run, it hears like: people don't how to
lessen module coupling before we invent NGA. This is also the point that
increases the un-trust between developers as I mentioned above.
It's very "interesting" to see people say "NGA is working" and show us
that pick contact activity now don't need to load the first page. It's not
coming from NGA. It was a design failure that we must load the main panel
and then the second panel.
Again I think that by NGA you are talking about different documents, I
don't think the point is look an activity goes through a panel or does or
doesn't do a transition. It's about writing documents, pretty specific with
just the css, dom and js that you will need. And yes, you can get this with
several techniques, if I'm not wrong settings app for example after the
rewrite manages to do this right? Imagine that you are working for the web,
not restrictions of mobile web, you can run everywhere, wouldn't you design
pointing to an specific document?

And why this interest for the documents? Simple, our platform, a web
browser, is very good with documents, it has a lots of built in stuff for
dealing with them, perhaps we need to push for making it even better in the
mobile web, but ei! wouldn't that be wonderful, improve the mobile web too?
Post by a***@gmail.com
There was ever an app called settings app.. Long long time ago, we need to
load the main setting panel when we are using web activity to launch
certain panel. But Arthur and 䜳韍 did lots nice refactoring work to split
the subpanels. Now we can directly load any subpanels. And what's most
important, this was happening before NGA. What they use is just require-js
and have their own design of panels. I bet that I can do the same thing
without using requirejs. So why can we say NGA did succeed and work because
of this result..?
require-js is a fantastic tool, and I personally would say to continue
using it whenever you have multiple documents or a single one. What I would
really like is people sitting with each other showing what they manage to
do and others really wanting to give things a try. Hopefully we have
Orlando coming soon and will be fantastic if we can have office hours where
we can sit, chat, code together, prototype :). That's for me the way of
learning, growing, and finally succeeding.
Post by a***@gmail.com
TL;DR
1. There is No architecture total solution for web. Each app has it own
shape, its own target, and its own future.
Agree, there is no a ring to rule them all. What has been proposed is a
list of things to take into consideration.

2. Force using NGA implies untrust to the devs
Definitely I don't think we are going to force anyone, also using the word
untrust to devs is for me out of the scope. Should we untrust the people
that are proposing changes? I don't think so, I think we have to talk,
debate, try, help each other and be open to collaborate.
Post by a***@gmail.com
3. Web won't teach you how to coding. Web is silent.
4. Brainstorming and learning from each other makes dev grow. Force using
one framework makes dev become code farmer.
Yes! Let's do that!
Post by a***@gmail.com
5. When I said NGA, I am talking about "splitting views into iframes". Not
the gaia-fast-list. Not moving heavy-load things to web worker. Some of the
technologies are good, but made everything become iframe is not.
;) exactly let's see what kind of ideas are fitting better in each app :)
Cheers!
f.

[1]
https://docs.google.com/document/d/1Lels5HA1CgWSrVek5JFuR9sYq--y4mmjXmpRQBWLdkU
[2] https://github.com/mozilla-b2g/gaia/tree/master/apps/music/views
[3]
https://github.com/mozilla-b2g/gaia/tree/nga/apps/communications/contacts/views
Justin D'Arcangelo
2015-11-25 20:06:49 UTC
Permalink
Francisco points out something that, to me, is the thing of most significant value of NGA. Having a separate “document” for each view, while not a new concept to the greater web, is a new concept for mobile web apps. In the Music app, each “view” is effectively its own mini-app. Again, if you look at the “/views” sub-folder in the Music app, you’ll see exactly what I mean:

https://github.com/mozilla-b2g/gaia/tree/master/apps/music/views <https://github.com/mozilla-b2g/gaia/tree/master/apps/music/views>

Any one of those folders can be considered its own mini-app. The best thing about this is that it inherently reduces the scope of each view drastically. This isn’t forcing every view to be constructed in any one way. Heck, you could even build one of your views with Angular or React if you really wanted to and it wouldn’t impose Angular or React principles on the rest of your application. We have also explored the possibilities of letting each view have its own l10n .properties file for strings. This is another inherent advantage of this particular multi-document architecture where a localizer would also benefit from dealing with more limited scopes (i.e., knowing exactly where each string is being used). We can also be less concerned with polluting the global namespace when views are separated like this as each view has its own `window`.

But, the most powerful thing about this approach, to me, is the fact that any one of these views (mini-apps) can be completely replaced with an alternative implementation without affecting the rest of the app. Being that we’ve always struggled with regressions in the past, this is of tremendous value. I’ve stated in some earlier responses that this is what will enable us to easily build versions of our apps for additional form factors in the future. For instance, the “player” view in the Music app is currently built to listen for touch events for things like the on-screen previous/play/pause/next buttons as well as the seek-bar slider. To build a TV version, you’d simply replace the “/views/player” folder with a new view (mini-app) that instead listens for keyboard/remote events. To do this, all a developer would need to do is look at the existing “player” view to see what API calls are made to perform the necessary operations (e.g. play/pause, seek, etc.) and ensure that their replacement view does the same thing.

Now, its possible that these same benefits could be had by embracing a different architecture for separation of views. However, the “NGA” way of separating views (multi-document) is completely natural for the web. In a single-page application architecture, you would likely have to define some sort of base-class or other means for defining a “view”. But since we are using a multi-document approach, this separation means we are simply providing an HTML file along with any JS/CSS files required by that view.

-Justin
Post by Francisco Jordano
Hi folks,
The problem here is coming from un-trust.
As you said, splitting panel into iframes will force people to destruct the panel dependency. Isn't this just meaning: hey I don't trust you can develop a good application architecture with less coupling, so now please use NGA because you cannot couple panels anymore even you want to coupling.
That's a really interesting point, why are we talking about panels, we are writing webs, or at least that was the original idea. We as web developers, are used to write single page apps cause it's what is suppose to work in mobile. But again, that's not the web we used to know, it's not the web of documents, the web we learned while pressing the 'view source code' button. And it's in our hand to push the platform forward to make the web to work better everywhere.
As a web developer, I wrote less code than you all; but only thing I know better is: there is no best practice for Web application. People can use any framework, any library, and self-made frameworks to bake their application. There is no total solution for web application. So this is not a point to say NGA is good.
I totally agree with this, there is not a single solution for everything, and I think that what it's been call NGA (oh gosh, you don't know how much I hate the name ;) ), was a set of ideas, that not all of them would make sense to apply, that will always depend on the nature of the app. For example, if you take a look to the retrospective [1] of the people that was trying to apply some of this recommendations, some things worked some things didn't.
If by NGA we are talking about splitting the views in documents, again, there are some of the apps that are more document oriented than others right?
Just like djf mentioned, mozilla knows modularity. I liked that we have different architecture design for each app; it makes sense because each application is trying to address different user stories and achieve different goals. So why do we need a overall one-and-all architecture? Even applying the NGA, people can definitely write codes which makes their applications looks so different.... you cannot ask people to design the modules inside the panels with NGA.
About each app having a different architecture we could be discussing for a while, we could have people arguing that it delays development with developers having to get familiar with totally different ways of writing apps, same problem for contributors, being difficult for them to try to help in different parts. But as well I agree the beauty and freedom of each app being shaped by the owners enrich the experience and shows what the web is.
Personally I don't think that writing your views in different documents will prevent you to design your modules in one way or another, it wont enforce you to not to write ES6 modules or use require.js or use <put your favourite framework here (avoid react.js and angular cause they will think we are making fun of them)>.
For me it's an interesting proposition that allow us to be more flexible in terms of reusing complete views, interchange them, partners being able to customize easily, having documents that are almost independent, getting closer to what we used to do in web development. I would suggest to get a look to the work in music [2] and contacts [3]. Again, this is totally subjective, perhaps for me is nicer to work in that way, but that doesn't mean I'm right. (Oh boy, sometimes even remind me to android activities, not our activities :))
Unless you invent NNGA: hey, please move every little component inside your panel into iframes. Make every module communication become asynchronous, even we don't need to do.
Sounds crazy... and this was something you mentioned to me, but never convinced me. Yes, being async is good for cases. With promises we can write beauituful codes. But sometimes we just need synchronous communication.
Also, I like the way people have their own idea about module. Even every one starts to use ES6 syntax to write applications, I could tell there would be 20 different ways to define a module across 20 different applications. Some of them might be inspiring, and I can learn from them. Some of them might be still deep coupling, and we need to fix them by learning from each other, instead of saying, hey use NGA or NNGA to write code, I am just want to help!
Everyone is here to help, who is not? :)
+ 1000 \o/
At least I won't say, hey angular is popular, please rewrite your application with it. I am just want to help! Hey reactJS is cool, use it! I'm just want to help.
;)
No, no. Framework or library won't teach you how to organize your application. As I said, even with ES6, I can write bad code with dirty module coupling. It's not what you use shape your app. It's what you think. It's your experience helping you. I wrote very bad code when I joined mozilla, but I made some effort such as read all kind of codes from others and did lots of refactoring. Now I have my own "feel" about modularity and architecture. If you ask me to follow only one way to write my code, I don't think I can grow up.
That's totally right again, no framework or library will prevent that you shoot yourself in the foot. Also personally I've never seen anyone inside mozilla telling you have to code in this way, things were proposed and have to grow within the engineers.
1. What's the current architecture of my application?
2. How do I separate my UI and data? If I don't, what's blocking me to do that? (Please, don't call that FE/BE. Very confusing.)
3. What's possible if I am asked to design an application to fit different devices? What would be common, and what would be device specific? Don't we just need to extract the data logic from the view logic? Why do we need to put every panel and every little component into iframes and increase the communication overhead?
What made me sad at most, is that, people is selling NGA ideas like they are the sales, not an engineer. I am not the customer. It's really annoying to hear 'this is really wonderful' without real data. Such an advertising wording does not convince me. I can do the same thing to split modules without NGA's help. I can see that some people will still write coupling codes with NGA. And in the long run, it hears like: people don't how to lessen module coupling before we invent NGA. This is also the point that increases the un-trust between developers as I mentioned above.
It's very "interesting" to see people say "NGA is working" and show us that pick contact activity now don't need to load the first page. It's not coming from NGA. It was a design failure that we must load the main panel and then the second panel.
Again I think that by NGA you are talking about different documents, I don't think the point is look an activity goes through a panel or does or doesn't do a transition. It's about writing documents, pretty specific with just the css, dom and js that you will need. And yes, you can get this with several techniques, if I'm not wrong settings app for example after the rewrite manages to do this right? Imagine that you are working for the web, not restrictions of mobile web, you can run everywhere, wouldn't you design pointing to an specific document?
And why this interest for the documents? Simple, our platform, a web browser, is very good with documents, it has a lots of built in stuff for dealing with them, perhaps we need to push for making it even better in the mobile web, but ei! wouldn't that be wonderful, improve the mobile web too?
There was ever an app called settings app.. Long long time ago, we need to load the main setting panel when we are using web activity to launch certain panel. But Arthur and 䜳韍 did lots nice refactoring work to split the subpanels. Now we can directly load any subpanels. And what's most important, this was happening before NGA. What they use is just require-js and have their own design of panels. I bet that I can do the same thing without using requirejs. So why can we say NGA did succeed and work because of this result..?
require-js is a fantastic tool, and I personally would say to continue using it whenever you have multiple documents or a single one. What I would really like is people sitting with each other showing what they manage to do and others really wanting to give things a try. Hopefully we have Orlando coming soon and will be fantastic if we can have office hours where we can sit, chat, code together, prototype :). That's for me the way of learning, growing, and finally succeeding.
TL;DR
1. There is No architecture total solution for web. Each app has it own shape, its own target, and its own future.
Agree, there is no a ring to rule them all. What has been proposed is a list of things to take into consideration.
2. Force using NGA implies untrust to the devs
Definitely I don't think we are going to force anyone, also using the word untrust to devs is for me out of the scope. Should we untrust the people that are proposing changes? I don't think so, I think we have to talk, debate, try, help each other and be open to collaborate.
3. Web won't teach you how to coding. Web is silent.
4. Brainstorming and learning from each other makes dev grow. Force using one framework makes dev become code farmer.
Yes! Let's do that!
5. When I said NGA, I am talking about "splitting views into iframes". Not the gaia-fast-list. Not moving heavy-load things to web worker. Some of the technologies are good, but made everything become iframe is not.
;) exactly let's see what kind of ideas are fitting better in each app :)
Cheers!
f.
[1] https://docs.google.com/document/d/1Lels5HA1CgWSrVek5JFuR9sYq--y4mmjXmpRQBWLdkU <https://docs.google.com/document/d/1Lels5HA1CgWSrVek5JFuR9sYq--y4mmjXmpRQBWLdkU>
[2] https://github.com/mozilla-b2g/gaia/tree/master/apps/music/views <https://github.com/mozilla-b2g/gaia/tree/master/apps/music/views>
[3] https://github.com/mozilla-b2g/gaia/tree/nga/apps/communications/contacts/views <https://github.com/mozilla-b2g/gaia/tree/nga/apps/communications/contacts/views>_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos <https://lists.mozilla.org/listinfo/dev-fxos>
Wilson Page
2015-11-26 10:10:32 UTC
Permalink
I know both myself and Justin were strongly against the document-per-view
approach when Vivien first suggested it. But having both worked building
apps around this strategy, we can now both clearly see the advantages
(listed by Justin).

It's different (really different!) to the majority of approaches being used
elsewhere, but for me, this is what is most exciting! We're questioning the
norm and defining new patterns (not 'frameworks') to make applications on
the mobile web simpler to build/update, whilst using the strengths of our
platform to bring features and performance.

This is *real* 'innovation' coming from Mozilla; I'm excited to be a part
of it!

*W I L S O N P A G E*

Front-end Developer
Firefox OS (Gaia)
London Office

Twitter: @wilsonpage
IRC: wilsonpage
Post by Justin D'Arcangelo
Francisco points out something that, to me, is the thing of most
significant value of NGA. Having a separate “document” for each view, while
not a new concept to the greater web, is a new concept for mobile web apps.
In the Music app, each “view” is effectively its own mini-app. Again, if
you look at the “/views” sub-folder in the Music app, you’ll see exactly
https://github.com/mozilla-b2g/gaia/tree/master/apps/music/views
Any one of those folders can be considered its own mini-app. The best
thing about this is that it inherently reduces the scope of each view
drastically. This isn’t forcing every view to be constructed in any one
way. Heck, you could even build one of your views with Angular or React if
you really wanted to and it wouldn’t impose Angular or React principles on
the rest of your application. We have also explored the possibilities of
letting each view have its own l10n .properties file for strings. This is
another inherent advantage of this particular multi-document architecture
where a localizer would also benefit from dealing with more limited scopes
(i.e., knowing exactly where each string is being used). We can also be
less concerned with polluting the global namespace when views are separated
like this as each view has its own `window`.
But, the most powerful thing about this approach, to me, is the fact that
any one of these views (mini-apps) can be completely replaced with an
alternative implementation without affecting the rest of the app. Being
that we’ve always struggled with regressions in the past, this is of
tremendous value. I’ve stated in some earlier responses that this is what
will enable us to easily build versions of our apps for additional form
factors in the future. For instance, the “player” view in the Music app is
currently built to listen for touch events for things like the on-screen
previous/play/pause/next buttons as well as the seek-bar slider. To build a
TV version, you’d simply replace the “/views/player” folder with a new view
(mini-app) that instead listens for keyboard/remote events. To do this, all
a developer would need to do is look at the existing “player” view to see
what API calls are made to perform the necessary operations (e.g.
play/pause, seek, etc.) and ensure that their replacement view does the
same thing.
Now, its possible that these same benefits could be had by embracing a
different architecture for separation of views. However, the “NGA” way of
separating views (multi-document) is completely natural for the web. In a
single-page application architecture, you would likely have to define some
sort of base-class or other means for defining a “view”. But since we are
using a multi-document approach, this separation means we are simply
providing an HTML file along with any JS/CSS files required by that view.
-Justin
Hi folks,
Post by a***@gmail.com
The problem here is coming from un-trust.
As you said, splitting panel into iframes will force people to destruct
the panel dependency. Isn't this just meaning: hey I don't trust you can
develop a good application architecture with less coupling, so now please
use NGA because you cannot couple panels anymore even you want to coupling.
That's a really interesting point, why are we talking about panels, we are
writing webs, or at least that was the original idea. We as web developers,
are used to write single page apps cause it's what is suppose to work in
mobile. But again, that's not the web we used to know, it's not the web of
documents, the web we learned while pressing the 'view source code' button.
And it's in our hand to push the platform forward to make the web to work
better everywhere.
Post by a***@gmail.com
As a web developer, I wrote less code than you all; but only thing I know
better is: there is no best practice for Web application. People can use
any framework, any library, and self-made frameworks to bake their
application. There is no total solution for web application. So this is not
a point to say NGA is good.
I totally agree with this, there is not a single solution for everything,
and I think that what it's been call NGA (oh gosh, you don't know how much
I hate the name ;) ), was a set of ideas, that not all of them would make
sense to apply, that will always depend on the nature of the app. For
example, if you take a look to the retrospective [1] of the people that was
trying to apply some of this recommendations, some things worked some
things didn't.
If by NGA we are talking about splitting the views in documents, again,
there are some of the apps that are more document oriented than others
right?
Post by a***@gmail.com
Just like djf mentioned, mozilla knows modularity. I liked that we have
different architecture design for each app; it makes sense because each
application is trying to address different user stories and achieve
different goals. So why do we need a overall one-and-all architecture?
Even applying the NGA, people can definitely write codes which makes their
applications looks so different.... you cannot ask people to design the
modules inside the panels with NGA.
About each app having a different architecture we could be discussing for
a while, we could have people arguing that it delays development with
developers having to get familiar with totally different ways of writing
apps, same problem for contributors, being difficult for them to try to
help in different parts. But as well I agree the beauty and freedom of each
app being shaped by the owners enrich the experience and shows what the web
is.
Personally I don't think that writing your views in different documents
will prevent you to design your modules in one way or another, it wont
enforce you to not to write ES6 modules or use require.js or use <put your
favourite framework here (avoid react.js and angular cause they will think
we are making fun of them)>.
For me it's an interesting proposition that allow us to be more flexible
in terms of reusing complete views, interchange them, partners being able
to customize easily, having documents that are almost independent, getting
closer to what we used to do in web development. I would suggest to get a
look to the work in music [2] and contacts [3]. Again, this is totally
subjective, perhaps for me is nicer to work in that way, but that doesn't
mean I'm right. (Oh boy, sometimes even remind me to android activities,
not our activities :))
Post by a***@gmail.com
Unless you invent NNGA: hey, please move every little component inside
your panel into iframes. Make every module communication become
asynchronous, even we don't need to do.
Sounds crazy... and this was something you mentioned to me, but never
convinced me. Yes, being async is good for cases. With promises we can
write beauituful codes. But sometimes we just need synchronous
communication.
Also, I like the way people have their own idea about module. Even every
one starts to use ES6 syntax to write applications, I could tell there
would be 20 different ways to define a module across 20 different
applications. Some of them might be inspiring, and I can learn from them.
Some of them might be still deep coupling, and we need to fix them by
learning from each other, instead of saying, hey use NGA or NNGA to write
code, I am just want to help!
Everyone is here to help, who is not? :)
+ 1000 \o/
Post by a***@gmail.com
At least I won't say, hey angular is popular, please rewrite your
application with it. I am just want to help! Hey reactJS is cool, use it!
I'm just want to help.
;)
Post by a***@gmail.com
No, no. Framework or library won't teach you how to organize your
application. As I said, even with ES6, I can write bad code with dirty
module coupling. It's not what you use shape your app. It's what you think.
It's your experience helping you. I wrote very bad code when I joined
mozilla, but I made some effort such as read all kind of codes from others
and did lots of refactoring. Now I have my own "feel" about modularity and
architecture. If you ask me to follow only one way to write my code, I
don't think I can grow up.
That's totally right again, no framework or library will prevent that you
shoot yourself in the foot. Also personally I've never seen anyone inside
mozilla telling you have to code in this way, things were proposed and have
to grow within the engineers.
Post by a***@gmail.com
I believe what shall be done is not asking people to follow your own
"future". I think a better way is to gather people sit down to tell each
1. What's the current architecture of my application?
2. How do I separate my UI and data? If I don't, what's blocking me to do
that? (Please, don't call that FE/BE. Very confusing.)
3. What's possible if I am asked to design an application to fit
different devices? What would be common, and what would be device specific?
Don't we just need to extract the data logic from the view logic? Why do we
need to put every panel and every little component into iframes and
increase the communication overhead?
What made me sad at most, is that, people is selling NGA ideas like they
are the sales, not an engineer. I am not the customer. It's really annoying
to hear 'this is really wonderful' without real data. Such an advertising
wording does not convince me. I can do the same thing to split modules
without NGA's help. I can see that some people will still write coupling
codes with NGA. And in the long run, it hears like: people don't how to
lessen module coupling before we invent NGA. This is also the point that
increases the un-trust between developers as I mentioned above.
It's very "interesting" to see people say "NGA is working" and show us
that pick contact activity now don't need to load the first page. It's not
coming from NGA. It was a design failure that we must load the main panel
and then the second panel.
Again I think that by NGA you are talking about different documents, I
don't think the point is look an activity goes through a panel or does or
doesn't do a transition. It's about writing documents, pretty specific with
just the css, dom and js that you will need. And yes, you can get this with
several techniques, if I'm not wrong settings app for example after the
rewrite manages to do this right? Imagine that you are working for the web,
not restrictions of mobile web, you can run everywhere, wouldn't you design
pointing to an specific document?
And why this interest for the documents? Simple, our platform, a web
browser, is very good with documents, it has a lots of built in stuff for
dealing with them, perhaps we need to push for making it even better in the
mobile web, but ei! wouldn't that be wonderful, improve the mobile web too?
Post by a***@gmail.com
There was ever an app called settings app.. Long long time ago, we need
to load the main setting panel when we are using web activity to launch
certain panel. But Arthur and 䜳韍 did lots nice refactoring work to split
the subpanels. Now we can directly load any subpanels. And what's most
important, this was happening before NGA. What they use is just require-js
and have their own design of panels. I bet that I can do the same thing
without using requirejs. So why can we say NGA did succeed and work because
of this result..?
require-js is a fantastic tool, and I personally would say to continue
using it whenever you have multiple documents or a single one. What I would
really like is people sitting with each other showing what they manage to
do and others really wanting to give things a try. Hopefully we have
Orlando coming soon and will be fantastic if we can have office hours where
we can sit, chat, code together, prototype :). That's for me the way of
learning, growing, and finally succeeding.
Post by a***@gmail.com
TL;DR
1. There is No architecture total solution for web. Each app has it own
shape, its own target, and its own future.
Agree, there is no a ring to rule them all. What has been proposed is a
list of things to take into consideration.
2. Force using NGA implies untrust to the devs
Definitely I don't think we are going to force anyone, also using the word
untrust to devs is for me out of the scope. Should we untrust the people
that are proposing changes? I don't think so, I think we have to talk,
debate, try, help each other and be open to collaborate.
Post by a***@gmail.com
3. Web won't teach you how to coding. Web is silent.
4. Brainstorming and learning from each other makes dev grow. Force using
one framework makes dev become code farmer.
Yes! Let's do that!
Post by a***@gmail.com
5. When I said NGA, I am talking about "splitting views into iframes".
Not the gaia-fast-list. Not moving heavy-load things to web worker. Some of
the technologies are good, but made everything become iframe is not.
;) exactly let's see what kind of ideas are fitting better in each app :)
Cheers!
f.
[1]
https://docs.google.com/document/d/1Lels5HA1CgWSrVek5JFuR9sYq--y4mmjXmpRQBWLdkU
[2] https://github.com/mozilla-b2g/gaia/tree/master/apps/music/views
[3]
https://github.com/mozilla-b2g/gaia/tree/nga/apps/communications/contacts/views
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Jim Porter
2015-12-01 06:49:37 UTC
Permalink
Post by Wilson Page
I know both myself and Justin were strongly against the
document-per-view approach when Vivien first suggested it. But having
both worked building apps around this strategy, we can now both clearly
see the advantages (listed by Justin).
For me, whether document-per-view is good depends a lot on how you
divide up the views. One concern I had initially were the plans to have
each view be a root-level document instead of being nested in an iframe,
and to then rely on Navigation Transitions to swap between each view,
with some magic to make "common" elements appear to remain in-place
(e.g. headers). I'm glad that we didn't try that for Music. It would be
a lot more work to make everything look perfect, and would be very
error-prone since the UX wouldn't match the app's architecture.

Other than that, I have no issue with document-per-view aside from the
potential for performance issues. Since we're now dealing with multiple
JS compartments, we need to copy more data around, and there are still
some issues with the perf on certain actions (tapping the "next track"
button is noticeably slower than OGA, for instance). However, I'm
reasonably confident that we can eliminate (or at least improve) these
issues.

There's been a lot of talk about how document-per-view makes it easier
to replace existing views. However, another benefit is that for some
form factors (e.g. tablet) we can just rearrange the *existing* views to
make new UI. Since each view is its own document, it would be easy to
show the player view next to the album list view, for instance. With
sufficient effort, this can even extend to desktop (although this might
entail rewriting the views anyway).

Of course, it should be noted that document-per-view isn't strictly
necessary for any of this. A well-designed app could do all this in a
single document; document-per-view just makes it more obvious what the
right way is. :)

- Jim

Michael Henretty
2015-11-26 13:05:09 UTC
Permalink
Post by Francisco Jordano
Definitely I don't think we are going to force anyone, also using the word
untrust to devs is for me out of the scope. Should we untrust the people
that are proposing changes? I don't think so, I think we have to talk,
debate, try, help each other and be open to collaborate.
If you read the first email in this thread, it certainly seems that at
least the Priority List apps (which is most apps btw) are being forced to
adopt this architecture. That is why I am very glad we are having this
discussion. Hearing you, Justin, and Wilson talk so highly of certain
techniques introduced by NGA makes me curious and want to learn more. Being
told I need to think about what NGA means for the Browser so I can
implement it soon has the opposite effect.
Vivien Nicolas
2015-11-25 20:05:48 UTC
Permalink
Hey Alive, nice to heard from you!

If I understood correctly, one of the central point of your arguments are
against the <iframe>(s) split ?
Let me know if I misunderstood ?

If that's correct I think you are missing the core part of my argumentation
when I spoke about <iframe>s and what those are offering. <iframe> are
documents.

A document is a core web object, which offers things that *really*
framework can hardly do. It is not a new cool way of writing things for the
web. It is the fundamental part of the web you are using every time you're
navigating between 2 urls.

But more importantly, documents are something the platform, as in the web
platform, can understand.

That's one of the thing I'm trying to explain since some times: If we want
to build a platform, we need the platform to understand the semantic of a
what is a web app. Documents is the best thing I have handy - nothing else
as far as I know in the web platform can scope js, css and the dom properly.

No. Web Components, can not.

I would be very happy to be able to replace <iframe>s by top level
document, where each panel is its own document. Then you would really think
of this <iframe>s change as a no change. Many website already use
navigation between pages. What NGA is not trying to define, is what is
inside those web pages - since as you mentioned, there may be various way
to handle your application constraints.

No, IIRC one of your point is that <iframe>s seems to fit the phone in some
ways, as it is mostly panel based - which is not true for tablets for
example.
That's true. But I guess most of your web browsing is on desktop ? And you
are still navigating between documents right ? The web is not a single page
- but you probably still like browsing the web.

Cheers,
Vivien.
Post by a***@gmail.com
The problem here is coming from un-trust.
As you said, splitting panel into iframes will force people to destruct
the panel dependency. Isn't this just meaning: hey I don't trust you can
develop a good application architecture with less coupling, so now please
use NGA because you cannot couple panels anymore even you want to coupling.
As a web developer, I wrote less code than you all; but only thing I know
better is: there is no best practice for Web application. People can use
any framework, any library, and self-made frameworks to bake their
application. There is no total solution for web application. So this is not
a point to say NGA is good.
Just like djf mentioned, mozilla knows modularity. I liked that we have
different architecture design for each app; it makes sense because each
application is trying to address different user stories and achieve
different goals. So why do we need a overall one-and-all architecture?
Even applying the NGA, people can definitely write codes which makes their
applications looks so different.... you cannot ask people to design the
modules inside the panels with NGA.
Unless you invent NNGA: hey, please move every little component inside
your panel into iframes. Make every module communication become
asynchronous, even we don't need to do.
Sounds crazy... and this was something you mentioned to me, but never
convinced me. Yes, being async is good for cases. With promises we can
write beauituful codes. But sometimes we just need synchronous
communication.
Also, I like the way people have their own idea about module. Even every
one starts to use ES6 syntax to write applications, I could tell there
would be 20 different ways to define a module across 20 different
applications. Some of them might be inspiring, and I can learn from them.
Some of them might be still deep coupling, and we need to fix them by
learning from each other, instead of saying, hey use NGA or NNGA to write
code, I am just want to help!
Everyone is here to help, who is not? :)
At least I won't say, hey angular is popular, please rewrite your
application with it. I am just want to help! Hey reactJS is cool, use it!
I'm just want to help.
No, no. Framework or library won't teach you how to organize your
application. As I said, even with ES6, I can write bad code with dirty
module coupling. It's not what you use shape your app. It's what you think.
It's your experience helping you. I wrote very bad code when I joined
mozilla, but I made some effort such as read all kind of codes from others
and did lots of refactoring. Now I have my own "feel" about modularity and
architecture. If you ask me to follow only one way to write my code, I
don't think I can grow up.
I believe what shall be done is not asking people to follow your own
"future". I think a better way is to gather people sit down to tell each
1. What's the current architecture of my application?
2. How do I separate my UI and data? If I don't, what's blocking me to do
that? (Please, don't call that FE/BE. Very confusing.)
3. What's possible if I am asked to design an application to fit different
devices? What would be common, and what would be device specific? Don't we
just need to extract the data logic from the view logic? Why do we need to
put every panel and every little component into iframes and increase the
communication overhead?
What made me sad at most, is that, people is selling NGA ideas like they
are the sales, not an engineer. I am not the customer. It's really annoying
to hear 'this is really wonderful' without real data. Such an advertising
wording does not convince me. I can do the same thing to split modules
without NGA's help. I can see that some people will still write coupling
codes with NGA. And in the long run, it hears like: people don't how to
lessen module coupling before we invent NGA. This is also the point that
increases the un-trust between developers as I mentioned above.
It's very "interesting" to see people say "NGA is working" and show us
that pick contact activity now don't need to load the first page. It's not
coming from NGA. It was a design failure that we must load the main panel
and then the second panel.
There was ever an app called settings app.. Long long time ago, we need to
load the main setting panel when we are using web activity to launch
certain panel. But Arthur and 䜳韍 did lots nice refactoring work to split
the subpanels. Now we can directly load any subpanels. And what's most
important, this was happening before NGA. What they use is just require-js
and have their own design of panels. I bet that I can do the same thing
without using requirejs. So why can we say NGA did succeed and work because
of this result..?
TL;DR
1. There is No architecture total solution for web. Each app has it own
shape, its own target, and its own future.
2. Force using NGA implies untrust to the devs
3. Web won't teach you how to coding. Web is silent.
4. Brainstorming and learning from each other makes dev grow. Force using
one framework makes dev become code farmer.
5. When I said NGA, I am talking about "splitting views into iframes". Not
the gaia-fast-list. Not moving heavy-load things to web worker. Some of the
technologies are good, but made everything become iframe is not.
-Alive
Vivien Nicolasæ–Œ 2015幎11月23日星期䞀 UTC+8䞋午8時46分43秒寫道
Post by David Flanagan
I've been thinking a lot about this thread in the context of Ari's talk
at the All Hands meeting yesterday. We're working on an OS that has to run
on smartphones, smart tv's and other form factors tbd. Ari asked us to
focus on portability, and that obviously will be key to our ability to run
on different form factors.
Post by David Flanagan
I had something of an epiphany today: In the future, teams inside and
outside of Mozilla will build
Post by David Flanagan
devices that run FirefoxOS and will create products that provide true
user value and delight. At this moment we don't know what those products
will be. So for core FirefoxOS developers, our users are these future
product development teams. We need to be building an OS that is so fast
and flexible, so portable and performant that product developers will
feel delight using our platform.
"At this moment we don't know what those products will be".
This sentence is extremely important to me. It should have been the
first thing I noticed. As far as I know, this is correct. Nobody knows.
Post by David Flanagan
Am I wrong to say this is true since last December ?
But...based on Wilfred initial email, there are some hints. Various form
factors. List of most wanted apps. The need for different views for those
apps.
Post by David Flanagan
This is something we can address. Ensuring the FE and the BE are
properly splitted, with clear and documented APIs, will be helpful, to make
it easier to write various views. My point is that this work should happens
first.
Post by David Flanagan
Once it has happens, you can parallelize work. Some people can work on
transforming the front-end to use a components system, while some other may
work on making the backend more pleasant, more abstract, more performant
and add some new features.
Post by David Flanagan
Also, once a lot of the business logic has been clearly separated, it
would be much easier to have others helping the front-end of any apps.
Post by David Flanagan
Concerning point #2. The idea is that porting all the front-end in once
is hard. It is also hard to get many people working on various panels at
the same time. Splitting things into multiple isolated contexts, may let
many people working at the same time on a dedicated view, and limit the
possible area of conflicts.
Post by David Flanagan
One can argue that this can be more or less achieved using the right
framework and beeing very cautious. This is likely. But once the team
starts to be under heavy constraints this is something very hard to keep
running. While strong isolations of views, prevent some changes to leak in
other views, helping developers and reviewers in their daily job. If
everybody rush into web components now, are we sure we will not beeing
asked to ship something before everything has been converted ? And if so,
do you really want to ends up in the same situation than one of two years
ago ?
Post by David Flanagan
I'm less confident in #3 if we want to do it at Gecko level. So far, and
as you mentioned, we lack some platform features to do it properly.
Hopefully, once we have #2 it can be emulated partly at the toolkit level
(you will be happy there is a web component for that).
Post by David Flanagan
Basically Web Components will help to write views faster, with globally
a more unified experience across the target. But if you want more manpower
from people out of your team in order to move very quickly, you will need
to have a clearly isolated backends with clear APIs, ensure the work of
one, will not conflict nor regress the work of an other, and have a
incremental way to migrate.
Post by David Flanagan
Also, Web Components will help a lot for the UI paradigm. But this part
is undefined so far.
Post by David Flanagan
Even by assuming all apps has been able to migrate to use components
everywhere before the next rush - we may be in front of a target device
that use completely a completely different metaphor.
Post by David Flanagan
Yes, components will have clean the (UI) code base, and it sounds easier
to replace just a component. But you will again have to fix all the app
(UI) at once, working with the limited set of people that knows the app
business logic and constraints, trying to avoid regressions abd collisions.
Post by David Flanagan
Sound scary to me. Not saying #1 and #2 will fix everything. But they
are trying to help at least.
Post by David Flanagan
Vivien.
With that in mind, I'd like to suggest that we'd be better served by
focusing on web components than by working on NGA.
Post by David Flanagan
Converting our building blocks to web components and then refactoring
our apps to use those components and to be based on higher-level web
components will give us much of the modularity and portability that we're
seeking from NGA, but at the same time, it will also create a high-quality
library of reusable UI components that third party app authors (including
those who are embedding FirefoxOS in new products) can use to more easily
create apps.
Post by David Flanagan
David
Hi all,
Given the Music app splitting we have done in time for 2.5 we want to
move ahead - I think it makes sense to be executed in a “train model”
fashion.
Post by David Flanagan
We should start from the top of the list and work through the list.
When I say splitting of the apps, we are looking for the following
1. FE/BE split
2. Split views
3. Page transition
Why did I choose the priority below? - for now we have 2 products that
we work on: smartphone and TV, but moving forward we need to investigate
what are the products that make sense for us and when we enter the
connected devices market 3rd party developers need to be able to develop
differing views for our core apps.
Post by David Flanagan
With this is mind we went through some exercise to define a priority for
the apps to be ported to the updated architecture.
Post by David Flanagan
Settings - this is a key app for any product mozilla may be planning to
release; different apps will have different needs to display information to
the user in the settings
Post by David Flanagan
Camera - again a key app for a lot of the modern devices
Contacts - everyone wants to have contacts on their devices - but they
need different level of information - creating differing views is going to
key here
Post by David Flanagan
Calendar - as with contacts its critical to have differing views but not
as high priority as contacts
Post by David Flanagan
Gallery - another core app that every connected device may need to have
E-mail - typing emails on smaller devices will be a problem and
therefore creating readable email view may be needed for some connected
deviceds
Post by David Flanagan
Calculator - table stake app
Clock - table stake app
Browser - one of core mozilla apps but a table stake app for some of the
connected devices
Post by David Flanagan
Some of the engineering teams, who have already worked on this split,
will be reaching out in smaller teams to discuss best practices and quick
wins for this activity.
Post by David Flanagan
BR
Wilfred
---
FxOS Product Management
Mozilla Corp., UK
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
_______________________________________________
dev-fxos mailing list
https://lists.mozilla.org/listinfo/dev-fxos
Loading...