[Contacts, Meta] Contacts application code refactoring notes

RESOLVED WONTFIX

Status

RESOLVED WONTFIX
6 years ago
9 months ago

People

(Reporter: rwaldron, Assigned: arcturus)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
Keeping these together for the sake of documentation, eventually these notes should be broken up into their own tickets. Consider this an incomplete list, but certainly a good starting point.


1. Primarly, there is a lot of duplicate code introduced in this changeset, 
most notably the script loading code which exists in two different files. 

2.  There are many places where call stacks can be reduced by 
eliminating the function expression wrappers that were introduced—these 
only serve to beef up the bytes over the wire and thicken call stacks and 
stack traces. If the goal was to improve performance by reducing property 
look ups, then a localized binding is sufficient. (showOverlay, hideOverlay, showStatus, hideSettings, toggleFavorite, etc.)

3. document.location is non-standard, use window.location

4. Standardize on either elem.classList or elem.className, using both creates readability,  maintenance and refactoring hazards

5. The in operator is significantly less performant than doing an explicit, strict equality check against undefined http://jsperf.com/in-vs-explicit





See also:

https://groups.google.com/forum/?fromgroups=#!topic/mozilla.dev.gaia/bw_A1BXNkDU
https://github.com/mozilla-b2g/gaia/pull/8038/files
https://github.com/mozilla-b2g/gaia/commit/e6f1589e29a0b1163a42d14954f1df5f03291450
(Reporter)

Comment 2

6 years ago
The Live connector code seems to avoid defining and using constructors

https://github.com/mozilla-b2g/gaia/pull/8302/files#r3168709
Will, assign to myself to put this feedback in a wiki page.
Assignee: nobody → francisco

Comment 4

9 months ago
Firefox OS is not being worked on
Status: NEW → RESOLVED
Last Resolved: 9 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.