DTVE

August 2013


V1 Features
Advanced JS
Advanced git
Risks

Hunter Loftis
<hunter@skookum.com>

V1 Features this Week


  1. Message Keys
  2. Vanity URLs
  3. Grunt Builds
  4. Performance Timers

Message Keys


API client + Periodic update + Memory cache +
AJAX endpoint + Angular Directive + Jade Helper



TODO: Talk to real API (once it exists).

Vanity URLs


API client + Mapping middleware +
Memory cached hit / miss




TODO: Limit size of 'miss' cache, otherwise 404s will gradually build up over time.

Grunt Builds


Gruntfile + local helper + script group keys + config





Performance Timer


Middleware + Stats + Event Emitters + Results page



TODO: Run this with jMeter to get better numbers; use data to optimize middleware.

Advanced JS


  1. Hoisting
  2. Closures
  3. Call / Apply
  4. Bind
  5. Object.create

Variable Hoisting




Function Hoisting


Closures


Call / Apply


Bind


Object.create



Advanced git (bisect)


  1. on the current (broken) commit:
    `git bisect start` `git bisect bad`
  2. now look back in time and find a working commit:
    `git log` `git checkout (ref)` `git bisect good`
  3. now git will start auto-checking-out for you. Test, then:
    `git bisect bad` (if broken) or `git bisect good` (if working)


`git bisect reset` once you've found the breaking commit.

Risks


  1. Front-end "God" objects
  2. Lowest-common-denominator API performance
  3. Test progress

"God" Objects


browseApp.js is a good example of this.
It's working, but difficult to maintain and extend.
Next step: split controllers into data models as services.

Services: Data Model, API actions (thick, robust)
Scope: View Model referencing the Data Model (one off)
Directives: DOM manipulation (small, many)
Controllers: Instantiate & coordinate the above (thin, light)


API Performance


A majority of our time is spent waiting on the API - this gives us a definite place to start optimizing:

Test Progress


We've got just 13 tests and most of the angular components are floating around without any sandboxes.

(I know it's unnatural to write tests when you're exploring the early versions of a feature - I delivered several features this week without tests.)

However, we need to consciously devote time to catch up on tests. This is the project's biggest risk factor.

PhantomJS/webkit is fine to replace Zombie (thanks JT!).

Outlook


  • Very impressive progress with:
    • completeness of front-end
    • mobile / fluid layouts
    • new components / complex filters
    • partials / ajax / standalone content sharing
    • single-page history / navigation
    • node.js structure / refactor / middleware
  • front-end needs a similar refactor (into smaller pieces)
  • node.js needs more performance data, optimization
  • everything needs tests

Node Summit?


I spoke at Node Summit in 2012 and they've asked us if we'd like to present again. We should present together!

  • If you're looking for talented devs, headlining at a cutting-edge industry event is a great way to find them.

  • We have the opportunity to frame DTV as a thought leader (just like Walmart in 2012 at the same conference).

  • We'll learn as much as we'll teach - the attendees and presenters are a wealth of information relevant to DTVE.

dtv-august-13

By hunterloftis

dtv-august-13

  • 1,190