Professional Documents
Culture Documents
02 April 2013
Michael S. Mikowski
02 April 2013
Michael S. Mikowski
02 April 2013
Michael S. Mikowski
SPAs are web applications that don!t reload d#ring a #ser session 3ncreasingl" pop#lar& as #sers are now e pecting desktop-like behavior -lash games& 4ava office s#ites& 4avascript calc#lators have been aro#nd for a long time We are considering Native 4avaScript SPAs here
Michael S. Mikowski 5
02 April 2013
!rowser
4S coding at a scale an order of magnit#de greater than a traditional websites 6700k lines8 $ne SPA ma" re'#ire man" developers Conventions and discipline previously reserved for server-side develop ent beco es a ust for working at this scale
02 April 2013
Michael S. Mikowski
A bit abo#t me
Single Page "eb Applications 9 4avaScript end-to-end #$ Architect at Snap:ogic& team of ; <eveloper on % production SPAs since /00=& Architect on all b#t one Previo#s back-end development manager on &P'&A od(perl clusters 6>/5 web transactions per week8 -irst SPA: ?#ropean and @S A*< ,wheretobuy.a d.co &. rel. /00A
Michael S. Mikowski
02 April 2013
02 April 2013
Michael S. Mikowski
02 April 2013
Michael S. Mikowski
10
02 April 2013
Michael S. Mikowski
11
co
advertising 6<o#bleDlick or Eal#eDlick8 analytics 6Foogle or $vert#re8 sharing 6AddThis or ShareThis8 social services 6-acebook ,:ike. or Foogle ,C7.8
02 April 2013
Michael S. Mikowski
12
02 April 2013
Michael S. Mikowski
13
02 April 2013
Michael S. Mikowski
14
02 April 2013
Michael S. Mikowski
15
02 April 2013
Michael S. Mikowski
16
02 April 2013
Michael S. Mikowski
17
A feat#re mod#le provides a well-defined and scoped capabilit" to the applications +o cross talk between mod#les !enefit: Third-part" and "o#r mod#les are interchangable !enefit- )e#sable across pro%ects !enefit- -oc#s on core and #se third-part" mod#les& replace as reso#rces allow !enefit- A great wa" to divide work
Michael S. Mikowski 18
02 April 2013
02 April 2013
Michael S. Mikowski
19
02 April 2013
Michael S. Mikowski
20
+amespace
spa css
Chat Module spa.chat.css spa-chat-head { left : 25px, } spa.chat.js spa.chat = ( function () { }() );
$#r spa sho#ld !#se! onl" two global variables 78 o#r root namespace& and /8 o#r common namespace
%s
02 April 2013
Michael S. Mikowski
21
02 April 2013
Michael S. Mikowski
22
02 April 2013
Michael S. Mikowski
23
+ow start the Shell: ,*aster controller. Doordinates feat#re mod#les Gandles browse-wide interfaces like...
@): anchor 6,hash fragment.8 -eat#re containers Dookies
02 April 2013
Michael S. Mikowski
24
02 April 2013
Michael S. Mikowski
25
02 April 2013
Michael S. Mikowski
26
02 April 2013
AP$
Michael S. Mikowski 28
?vents
As"nchrono#s data $ften res#lts from e ternal inp#t 3ncl#de data with events
02 April 2013
*ost ,web application. sites are act#all" a collection of a / or more SPAs ? ample: A*<& one SPA per comp#ter t"pe <ecide where to split the capabilities Plan on common capabilities and look and feel per site
02 April 2013
Michael S. Mikowski
29
We have selected !sp! as o#r ,common. namespace 3ncl#de common libraries before the SPA specific libraries
Standard #tilities 6sp.#til8 5rowser #tilities 6sp.#tilIb8 Arg#ment checking 6sp.arg8 Templating 6sp.d#st8
%s
common admin designer commerce img common...
02 April 2013
Michael S. Mikowski
30
J. Wh" is Foogle developing <artH A. The overhead of 4ava/4avaScript development is a serio#s drag on iterations
02 April 2013
Michael S. Mikowski
31
Start with prod#ct design <efine terms as earl" as possible 3t is best if marketing #ses the same terms as prod#ct planners& developers& and s"sops Write definitions for each Avoids miscomm#nication thro#gho#t the prod#ct As important as code standards
Snaps
Dependencies
02 April 2013
Michael S. Mikowski
32
Keep the lang#ages si ple and few @se native 4avaScript and DSS
@se of a 4S complier and DSS compiler are two additional steps that can go wrong When "o# deb#g "o#r application& "o# see DSS and 4avaScript 9 so "o# need to know these reall" well The best wa" to know DSS and 4avaScript reall" well is to #se them ever"da" "e have found the tradeoffs aren/t worth it
<o we want to test the application immediatel" or work thro#gh a /-step compile each timeH
Michael S. Mikowski 33
02 April 2013
All of these tr" to solve t"pe discover" problems Most variables never change typeM most are mistakes Pol"morphic interfaces are almost alwa"s a bad idea 3f "o#r f#nction ret#rns a string& alwa"s ret#rn a string. Throw an exception on error don't return false!
Michael S. Mikowski 34
02 April 2013
02 April 2013
Michael S. Mikowski
35
02 April 2013
Michael S. Mikowski
36
02 April 2013
Michael S. Mikowski
37
Share a co on $01 We have fo#nd an 3<? that is great as a res#lt of a B-da" st#d" Sharing it red#ces lang#age barriers Allows #s to share settings in o#r F3T repositor" Gosts a nice test framwork Spend time eval#ating the best 3<? for "o#r #se #se a code review tool A great wa" to keep team members in s"nc Prevent ever"one from getting too far ,o#t there.
Michael S. Mikowski 38
02 April 2013
)emember an SPA is a client not %#st the @3 3S4int is inval#able in spotting common& st#pid errors. *ake it part of "o#r commit hook All public AP$s sho#ld #se common arg#ment checking and named arg#ments The *odel and -ake data provide an e cellent fo#ndation for .00 #sing known data 5egression tests6
02 April 2013
Michael S. Mikowski
39
0angling beads and accidents Candidate e2a ple 6avoiding re'#irements8 The moral: *inimi2e tool kits and lang#ages
Add toolkits onl" after careful consideration. Dan we do this with o#r e isting toolsH Dan we test witho#t n#mero#s b#ild steps or m#ltiple la"ers of abstractionH avoid #nmanagable comple it"
02 April 2013