SlideShare a Scribd company logo
Yakov Fain, Farata Systems
7 Versions of One
Web Application
www.faratasystems.com	
  
We’ll	
  Review	
  7	
  Versions	
  of	
  the	
  UI	
  of	
  this	
  Single	
  Page	
  Applica?on	
  
SPA:	
  One	
  Web	
  page,	
  AJAX	
  calls	
  bring	
  the	
  data	
  as	
  needed,	
  CSS	
  hides/shows	
  HTML	
  elements	
  
…	
  and	
  the	
  7	
  versions	
  are…	
  
1.  HTML/AJAX	
  
2.  HTML	
  +	
  Responsive	
  Web	
  Design	
  
3.  With	
  jQuery	
  library	
  	
  
4.  With	
  Ext	
  JS	
  framework	
  
5.  Modularizing	
  HTML5	
  
6.  With	
  jQuery	
  Mobile	
  
7.  With	
  Sencha	
  Touch	
  
Wireframing	
  with	
  Balsamiq	
  Mockups	
  
V1:	
  HTML,	
  JS,	
  CSS,	
  AJAX,	
  JSON	
  
//	
  Loading	
  data	
  	
  with	
  AJAX	
  and	
  parsing	
  JSON	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
	
  
func9on	
  loadData(dataUrl)	
  {	
  
	
  var	
  xhr	
  =	
  new	
  XMLH+pRequest();	
  	
  
	
  
	
  xhr.open('GET',	
  dataUrl,	
  true);	
  
	
  
	
  xhr.onreadystatechange	
  =	
  func9on()	
  {	
  
	
   	
  if	
  (xhr.readyState	
  ==	
  4)	
  {	
  
	
   	
   	
  if	
  (xhr.status	
  ==	
  200)	
  {	
  
	
   	
   	
   	
  var	
  jsonData	
  =	
  xhr.responseText;	
  
	
  
	
   	
   	
   	
  //parse	
  json	
  data	
  
	
   	
   	
   	
  var	
  campaignsData	
  =	
  JSON.parse(jsonData).campaigns;	
  
	
   	
   	
   	
  showCampaignsInfo(campaignsData);	
  
	
   	
   	
  }	
  else	
  {	
  
	
   	
   	
   	
  console.log(xhr.statusText);	
  
	
   	
   	
  }	
  
	
   	
  }	
  
	
  }	
  
	
  xhr.send(null);	
  
}	
  
Demo:	
  Debugging	
  in	
  Chrome	
  
Oops…A	
  Smaller	
  Screen	
  
V2:	
  Responsive	
  Web	
  Design(RWD)	
  
•  Should	
  we	
  create	
  separate	
  versions	
  for	
  desktop	
  and	
  
mobile?	
  
•  How	
  many	
  versions	
  of	
  the	
  UI	
  to	
  create?	
  
•  Can	
  we	
  have	
  a	
  single	
  HTML	
  version	
  for	
  all	
  devices?	
  
•  CSS	
  Media	
  Queries	
  –	
  	
  layouts	
  based	
  on	
  screen	
  width	
  
•  Seing	
  CSS	
  Breakpoints	
  
•  Pros	
  and	
  Cons	
  of	
  RWD	
  	
  
Remember	
  the	
  wireframe	
  for	
  desktops?	
  
Wireframing	
  for	
  a	
  table	
  in	
  portrait	
  	
  
Wireframing	
  for	
  large	
  phones	
  
Wireframing	
  for	
  smaller	
  phones	
  
These	
  are	
  the	
  wireframes	
  for	
  3	
  phone	
  screens	
  
V2:	
  Demo	
  
1.  Basic	
  Media	
  Queries	
  
2.  Responsive	
  Header	
  
3.  Responsive	
  
Dona?on	
  
4.  Responsive	
  Final	
  
RWD	
  Pros	
  and	
  Cons	
  
•  RWD	
  is	
  good	
  for	
  publishing	
  info.	
  Mobile	
  frameworks	
  can	
  be	
  a	
  
beker	
  choice	
  for	
  interac?ve	
  apps	
  
•  RWD	
  allows	
  to	
  have	
  a	
  single	
  app	
  code	
  base	
  
•  Mobile	
  versions	
  of	
  an	
  app	
  may	
  need	
  limited	
  func?onality	
  and	
  
specific	
  naviga?on	
  
•  RWD	
  means	
  larger	
  traffic	
  (heavy	
  CSS)	
  –	
  no	
  good	
  for	
  slower	
  
connec?ons	
  
•  Mobile	
  frameworks	
  offer	
  more	
  na?ve	
  look	
  and	
  feel	
  of	
  the	
  UI	
  	
  
Libraries	
  of	
  responsive	
  UI	
  components:	
  
Bootstrap:	
  hkp://getbootstrap.com	
  
Seman?c	
  UI:	
  hkp://seman?c-­‐ui.com	
  	
  	
  	
  	
  
V3:	
  With	
  jQuery	
  Library	
  
•  Learning	
  jQuery	
  is	
  easy	
  for	
  designers	
  –	
  mostly	
  HTML.	
  
•  40	
  –	
  50%	
  of	
  top	
  Web	
  sites	
  use	
  jQuery	
  (see	
  bultwith.com)	
  	
  	
  	
  
•  It’s	
  a	
  light-­‐weight	
  addi?on	
  to	
  your	
  app	
  –	
  33Kb	
  gzipped,	
  minified	
  
•  Shorter	
  than	
  in	
  JS	
  syntax	
  for	
  DOM	
  Browsing	
  	
  
•  $()	
  –	
  pass	
  it	
  a	
  String,	
  	
  pass	
  it	
  a	
  func?on	
  	
  
•  There	
  are	
  thousands	
  plugins	
  in	
  jQuery	
  Plugin	
  Registry	
  
DOM	
  Querying	
  &	
  Func?on	
  Chaining	
  
An	
  AJAX	
  call	
  in	
  jQuery	
  
The	
  shortcut	
  methods:	
  $.get(),	
  $.post(),	
  $.getJSON()	
  
V3:	
  Demo	
  with	
  jQuery	
  
V4:	
  With	
  Sencha	
  Ext	
  JS	
  Framework	
  
•  Ext	
  JS	
  has	
  rich	
  library	
  of	
  enterprise-­‐grade	
  components,	
  e.g.	
  grids,	
  charts	
  
•  Cool	
  code	
  generator	
  Sencha	
  CMD	
  
•  Promotes	
  MVC	
  architecture	
  
•  Some	
  code	
  reuse	
  for	
  mobile	
  app	
  with	
  Sencha	
  Touch	
  
•  The	
  “weight”	
  of	
  the	
  app	
  substan?ally	
  increases	
  
•  If	
  you	
  decided	
  to	
  go	
  with	
  Ext	
  JS,	
  there	
  is	
  no	
  easy	
  way	
  out	
  
•  Doesn’t	
  support	
  Responsive	
  Web	
  Design	
  
•  Has	
  steep	
  learning	
  curve	
  –	
  has	
  no	
  HTML,	
  but	
  new	
  JS-­‐based	
  syntax	
  
Ext	
  JS:	
  	
  index.html	
  and	
  app.js	
  
Ext	
  JS:	
  	
  index.html	
  and	
  app.js	
  
Ext	
  JS	
  MVC	
  
Genera?ng	
  a	
  project	
  with	
  Sencha	
  CMD	
  
sencha	
  -­‐sdk	
  /Library/ext-­‐4.2	
  generate	
  app	
  HelloWorld	
  /Users/yfain11/hello	
  
The	
  View	
  Fragment:	
  DonateForm.js	
  	
  
V4:	
  Demo	
  with	
  Ext	
  JS	
  
V5:	
  Modularizing	
  UI	
  
•  Large	
  apps	
  should	
  be	
  modularized	
  to	
  avoid	
  loading	
  all	
  code	
  at	
  once.	
  
•  Mul?ple	
  <script> tags	
  may	
  depend	
  on	
  each	
  other	
  and	
  have	
  to	
  
be	
  loaded	
  in	
  certain	
  order.	
  
•  Need	
  to	
  be	
  able	
  to	
  specify	
  dependencies	
  between	
  the	
  modules.	
  
Need	
  to	
  avoid	
  pollu?ng	
  global	
  scope	
  and	
  name	
  conflicts.	
  	
  
Manually	
  wri?ng	
  Modules	
  doesn’t	
  solve	
  these	
  issues.	
  
•  Today:	
  CommonJS	
  and	
  Async	
  Module	
  Defini?on	
  (AMD)	
  specs	
  
•  Tomorrow:	
  ECMAScript	
  6	
  spec	
  (a.k.a.	
  Harmony)	
  defines	
  modules.	
  
One	
  way	
  of	
  implemen?ng	
  Module	
  Pakern	
  
Passing	
  inside	
  the	
  module	
  a	
  reference	
  to	
  the	
  global	
  window	
  object	
  	
  
CommonJS	
  is	
  an	
  effort	
  to	
  standardize	
  JS	
  APIs.	
  
CommonJS	
  Modules	
  defines	
  3	
  variables	
  for	
  modules:	
  	
  
	
  
	
  	
  	
  	
  	
  -­‐	
  requires
	
  	
  	
  	
  	
  -­‐	
  exports
	
  	
  	
  	
  	
  -­‐	
  module
	
  
Node.js	
  framework	
  implements	
  CommonJS	
  Modules	
  spec	
  and	
  
provides	
  these	
  global	
  variables.	
  
Code	
  Sample	
  With	
  CommonJS	
  
CommonJS	
  Pros	
  and	
  Cons	
  
Pros:	
  
	
  
•  Simple	
  API	
  
	
  
Cons:	
  
•  Mainly	
  for	
  the	
  server-­‐side	
  JavaScript.	
  Web	
  browsers	
  don’t	
  have	
  	
  
require,	
  export,	
  and	
  module	
  variables.	
  	
  
	
  
•  The	
  require	
  method	
  is	
  synchronous.	
  	
  
	
  
•  CommonJS	
  API	
  is	
  suitable	
  for	
  loading	
  JS	
  files,	
  but	
  can’t	
  load	
  CSS	
  	
  
and	
  HTML.	
  
Asynchronous	
  Module	
  Defini?on	
  (AMD)	
  
AMD	
  is	
  a	
  proposal	
  for	
  async	
  loading	
  of	
  both	
  the	
  module	
  and	
  its	
  
dependencies	
  in	
  Web	
  browsers.	
  	
  
	
  
You	
  provide	
  define	
  and	
  require	
  func?ons:	
  
	
  
define(!
module_id, // optional!
[dependencies],!
function (){!
// This function runs once when the module and its dependencies are loaded!
}!
);!
!
!
require(["main"], function() {!
console.log(”The module main is loaded");!
});!
!
	
  
!
!
!
The	
  func?on	
  define	
  defines	
  the	
  module	
  and	
  returns	
  it	
  once	
  it’s	
  needed.	
  	
  
The	
  require	
  executes	
  the	
  given	
  func?on	
  checking	
  that	
  the	
  dependencies	
  were	
  loaded.	
  	
  
Save	
  The	
  Child	
  Modularized	
  With	
  RequireJS	
  
Lis?ng	
  modules	
  in	
  config.js	
  
V5	
  Demo:	
  With	
  RequireJS	
  
main.js	
  (fragment)	
  
“Way	
  To	
  Give”	
  Module	
  Defini?on	
  
V6:	
  With	
  jQuery	
  Mobile	
  
•  Easy	
  to	
  learn.	
  Built	
  on	
  top	
  of	
  jQuery	
  Core	
  library	
  
•  HTML5	
  allows	
  crea?ng	
  custom	
  non-­‐visible	
  akributes.	
  They	
  
have	
  to	
  start	
  with	
  data-:	
  
<div data-role="page" id="Stats">
•  The	
  UI	
  shows	
  one	
  page	
  at	
  a	
  ?me	
  
•  Light-­‐weight	
  (90Kb	
  gZipped)	
  
Mul?-­‐Page	
  Template	
  
<body>
<!-- Page 1 -->
<div data-role="page"
id="Donate” >
...
</div>
<!-- Page 2 -->
<div data-role="page"
id="Stats” >
...
</div>
</body>
The	
  content	
  of	
  mul?ple	
  pages	
  is	
  located	
  in	
  one	
  file.	
  	
  
When	
  the	
  app	
  starts,	
  only	
  the	
  first	
  page	
  is	
  displayed	
  
Mul?-­‐Page	
  Template	
  (cont.)	
  
<body>
<!-- Page 1 -->
<div data-role="page" id="Donate">
<div data-role="header" >...</div>
<div data-role="content" >...</div>
<div data-role="footer" >...</div>
</div>
<!-- Page 2 -->
<div data-role="page" id="Stats">
...
</div>
</body>
Naviga?on	
  Bar	
  
<div data-role="navbar">
<ul>
<li>
<a href="#Who-We-Are">Who We Are</a>
</li>
<li>
<a href="#What-We-Do">What We Do</a>
</li>
<li>
<a href="#Where-We-Work">Where We Work</a>
</li>
<li>
<a href="#Way-To-Give">Way To Give</a>
</li>
</ul>
</div>
Ripple	
  Emulator	
  
The	
  Back	
  Bukon	
  
<div data-role="page" id="Stats" data-add-back-btn="true">
<div data-role="header" >
<h1>Statistics</h1>
</div>
Statistics will go here
</div>
Single-­‐Page	
  Template	
  
An	
  HTML	
  file	
  contains	
  the	
  content	
  of	
  a	
  single	
  page.	
  	
  
<div data-role="navbar">
<ul>
<li>
<a href="page-1.html"
data-transition="slideup">Page #1</a>
</li>
<li>
<a href="#" class="ui-state-persist">Page #2</a>
</li>
<li>
<a href="page-3.html"
data-transition="slideup">Page #3</a>
</li>
<li>
<a href="page-4.html"
data-transition="slideup">Page #4</a>
</li>
</ul>
</div>
V6:	
  Demo	
  With	
  jQuery	
  Mobile	
  
V7:	
  With	
  Sencha	
  Touch	
  
•  Sencha	
  Touch	
  is	
  a	
  smaller	
  brother	
  of	
  Ext	
  JS	
  
•  It	
  comes	
  with	
  mobile	
  versions	
  of	
  lists,	
  
forms,	
  toolbars,	
  bukons,	
  charts,	
  audio,	
  
video,	
  carousel	
  etc.	
  
•  Jumpstart	
  development	
  with	
  genera?ng	
  
the	
  app	
  with	
  Sencha	
  CMD.	
  
•  Package	
  the	
  Sencha	
  Touch	
  app	
  as	
  na?ve	
  
The	
  app.JS	
  
Ext.applica?on({	
  
	
  	
  	
  	
  name:	
  'SSC',	
  
	
  
	
  	
  	
  	
  requires:	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  'Ext.MessageBox'	
  
	
  	
  	
  	
  ],	
  
	
  
	
  	
  	
  	
  views:	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  'About',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'CampaignsMap',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'DonateForm',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'DonorsChart',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'LoginForm',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'LoginToolbar',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'Main',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'Media',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'Share',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'ShareTile'	
  
	
  	
  	
  	
  ],	
  
	
  
	
  	
  	
  	
  stores:	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  'Campaigns',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'Countries',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'Donors',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'States',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'Videos'	
  
	
  	
  	
  	
  ],x	
  
	
  
	
  	
  	
  	
  controllers:	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  'Login'	
  
	
  	
  	
  	
  ],	
  
	
  
	
  	
  	
  	
  launch:	
  func?on()	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  //	
  Destroy	
  the	
  #appLoadingIndicator	
  element	
  
	
  	
  	
  	
  	
  	
  	
  	
  Ext.fly('appLoadingIndicator').destroy();	
  
	
  
	
  	
  	
  	
  	
  	
  	
  	
  //	
  Ini?alize	
  the	
  main	
  view	
  
	
  	
  	
  	
  	
  	
  	
  	
  Ext.Viewport.add(Ext.create('SSC.view.Main'));	
  
	
  	
  	
  	
  },	
  
	
  
	
  	
  	
  	
  onUpdated:	
  func?on()	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  Ext.Msg.confirm(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  "Applica?on	
  Update",	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  "This	
  applica?on	
  has	
  just	
  successfully	
  been	
  updated	
  
to	
  the	
  latest	
  version.	
  Reload	
  now?",	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  func?on(bukonId)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  (bukonId	
  ===	
  'yes')	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  window.loca?on.reload();	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  );	
  
	
  	
  	
  	
  }	
  
});	
  
The	
  Landing	
  Page	
  
Login	
  Controller	
  
Donors	
  Store	
  
jQuery	
  Mobile	
  or	
  Sencha	
  Touch?	
  
Use	
  jQuery	
  Mobile	
  if:	
  
	
  
•  You	
  are	
  afraid	
  of	
  being	
  locked	
  up	
  with	
  any	
  one	
  vendor.	
  	
  
•  You	
  need	
  your	
  applica?on	
  to	
  work	
  on	
  most	
  of	
  the	
  mobile	
  pla€orms.	
  
•  You	
  prefer	
  declara?ve	
  UI	
  and	
  hate	
  debugging	
  JavaScript.	
  
jQuery	
  Mobile	
  or	
  Sencha	
  Touch?	
  
Use	
  Sencha	
  Touch	
  if:	
  
	
  
•  You	
  like	
  to	
  have	
  a	
  rich	
  library	
  of	
  pre-­‐created	
  UI	
  
•  Your	
  applica?on	
  needs	
  smooth	
  anima?on	
  
•  You	
  are	
  into	
  MVC	
  	
  
•  You	
  want	
  to	
  package	
  your	
  applica?on	
  as	
  a	
  na?ve	
  one	
  
•  You	
  want	
  your	
  applica?on	
  to	
  look	
  as	
  close	
  to	
  the	
  na?ve	
  ones	
  	
  
as	
  possible	
  
V7:	
  Demo	
  With	
  Sencha	
  Touch	
  
Where	
  to	
  go	
  next?	
  
Google	
  Dart	
  Language:	
  
hkps://www.dartlang.org	
  
	
  
Google	
  Angular	
  Dart	
  Framework:	
  
hkps://github.com/angular/angular.dart	
  	
  
Links	
  
•  7	
  versions	
  of	
  the	
  Save	
  The	
  Child	
  app:	
  
hkp://savesickchild.org	
  
•  Enterprise	
  Web	
  Dev	
  book:	
  
hkp://oreil.ly/1hxK5hl	
  	
  	
  
•  My	
  employer:	
  	
  	
  
hkp://faratasystems.com	
  	
  
•  My	
  Twiker:	
  @yfain	
  	
  

More Related Content

What's hot (20)

PDF
Exploring Angular 2 - Episode 2
Ahmed Moawad
 
PDF
Angular 2 Essential Training
Patrick Schroeder
 
PPTX
Angular js 2
Ran Wahle
 
PDF
Node.js vs Play Framework (with Japanese subtitles)
Yevgeniy Brikman
 
ODP
Angularjs
Vincenzo Ferrari
 
PDF
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Codemotion
 
PDF
Web sockets in Angular
Yakov Fain
 
PPTX
Angular 5
Bartłomiej Narożnik
 
PPTX
Angular2 for Beginners
Oswald Campesato
 
PPTX
AngularJs presentation
Phan Tuan
 
PDF
Test Driven Development with JavaFX
Hendrik Ebbers
 
PDF
Angular 2 - The Next Framework
Commit University
 
PPTX
Angular 2 어디까지 왔을까
장현 한
 
PDF
Building scalable applications with angular js
Andrew Alpert
 
PPT
React native
Mohammed El Rafie Tarabay
 
PDF
Angular 4 for Java Developers
Yakov Fain
 
PDF
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Codemotion
 
ODP
Introduction to Angular 2
Knoldus Inc.
 
PDF
RESTful services and OAUTH protocol in IoT
Yakov Fain
 
ODP
AngularJs Crash Course
Keith Bloomfield
 
Exploring Angular 2 - Episode 2
Ahmed Moawad
 
Angular 2 Essential Training
Patrick Schroeder
 
Angular js 2
Ran Wahle
 
Node.js vs Play Framework (with Japanese subtitles)
Yevgeniy Brikman
 
Angularjs
Vincenzo Ferrari
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Codemotion
 
Web sockets in Angular
Yakov Fain
 
Angular2 for Beginners
Oswald Campesato
 
AngularJs presentation
Phan Tuan
 
Test Driven Development with JavaFX
Hendrik Ebbers
 
Angular 2 - The Next Framework
Commit University
 
Angular 2 어디까지 왔을까
장현 한
 
Building scalable applications with angular js
Andrew Alpert
 
Angular 4 for Java Developers
Yakov Fain
 
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Codemotion
 
Introduction to Angular 2
Knoldus Inc.
 
RESTful services and OAUTH protocol in IoT
Yakov Fain
 
AngularJs Crash Course
Keith Bloomfield
 

Viewers also liked (13)

PPT
Cours java smi 2007 2008
Khalil Lechheb
 
PDF
Integrating consumers IoT devices into Business Workflow
Yakov Fain
 
PDF
Introduction àJava
Christophe Vaudry
 
PDF
Java(ee) mongo db applications in the cloud
Shekhar Gulati
 
PDF
Bonnes pratiques des applications java prêtes pour la production
Cyrille Le Clerc
 
PPTX
AngularJS for Java Developers
Loc Nguyen
 
PDF
Reactive Thinking in Java
Yakov Fain
 
PDF
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Shekhar Gulati
 
PDF
Angular 2 for Java Developers
Yakov Fain
 
PDF
Reactive programming in Angular 2
Yakov Fain
 
PDF
Reactive Thinking in Java with RxJava2
Yakov Fain
 
PDF
Building Universal Applications with Angular 2
Minko Gechev
 
ODP
Java 7 - Fork/Join
Zenika
 
Cours java smi 2007 2008
Khalil Lechheb
 
Integrating consumers IoT devices into Business Workflow
Yakov Fain
 
Introduction àJava
Christophe Vaudry
 
Java(ee) mongo db applications in the cloud
Shekhar Gulati
 
Bonnes pratiques des applications java prêtes pour la production
Cyrille Le Clerc
 
AngularJS for Java Developers
Loc Nguyen
 
Reactive Thinking in Java
Yakov Fain
 
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Shekhar Gulati
 
Angular 2 for Java Developers
Yakov Fain
 
Reactive programming in Angular 2
Yakov Fain
 
Reactive Thinking in Java with RxJava2
Yakov Fain
 
Building Universal Applications with Angular 2
Minko Gechev
 
Java 7 - Fork/Join
Zenika
 
Ad

Similar to Seven Versions of One Web Application (20)

ODP
Javascript Update May 2013
RameshNair6
 
PPT
Intro to SPA using JavaScript & ASP.NET
Alan Hecht
 
PDF
Zepto and the rise of the JavaScript Micro-Frameworks
Thomas Fuchs
 
PDF
Kann JavaScript elegant sein?
jbandi
 
KEY
20120306 dublin js
Richard Rodger
 
KEY
20120802 timisoara
Richard Rodger
 
PDF
JavaScript Libraries (Ajax Exp 2006)
jeresig
 
PPT
Node js
Chirag Parmar
 
PDF
Building businesspost.ie using Node.js
Richard Rodger
 
PPTX
Front End Development | Introduction
JohnTaieb
 
PDF
Desarrollo de apps multiplataforma con tecnologías web
Software Guru
 
PDF
Sg conference multiplatform_apps_adam_stanley
n_adam_stanley
 
PDF
Top JavaScript Frameworks Compared
Harbinger Systems - HRTech Builder of Choice
 
PPTX
Evolution of java script libraries
Columbia Developers Guild
 
KEY
Single Page Applications - Desert Code Camp 2012
Adam Mokan
 
PPTX
JavaScript on the server - Node.js
Rody Middelkoop
 
KEY
10 Years of JavaScript
Mike de Boer
 
PPTX
Building single page applications
SC5.io
 
PDF
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
FITC
 
PDF
Sencha Web Applications Come of Age
bastila
 
Javascript Update May 2013
RameshNair6
 
Intro to SPA using JavaScript & ASP.NET
Alan Hecht
 
Zepto and the rise of the JavaScript Micro-Frameworks
Thomas Fuchs
 
Kann JavaScript elegant sein?
jbandi
 
20120306 dublin js
Richard Rodger
 
20120802 timisoara
Richard Rodger
 
JavaScript Libraries (Ajax Exp 2006)
jeresig
 
Node js
Chirag Parmar
 
Building businesspost.ie using Node.js
Richard Rodger
 
Front End Development | Introduction
JohnTaieb
 
Desarrollo de apps multiplataforma con tecnologías web
Software Guru
 
Sg conference multiplatform_apps_adam_stanley
n_adam_stanley
 
Top JavaScript Frameworks Compared
Harbinger Systems - HRTech Builder of Choice
 
Evolution of java script libraries
Columbia Developers Guild
 
Single Page Applications - Desert Code Camp 2012
Adam Mokan
 
JavaScript on the server - Node.js
Rody Middelkoop
 
10 Years of JavaScript
Mike de Boer
 
Building single page applications
SC5.io
 
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
FITC
 
Sencha Web Applications Come of Age
bastila
 
Ad

More from Yakov Fain (11)

PDF
Type script for_java_dev_jul_2020
Yakov Fain
 
PDF
Using JHipster for generating Angular/Spring Boot apps
Yakov Fain
 
PDF
Using JHipster for generating Angular/Spring Boot apps
Yakov Fain
 
PDF
TypeScript for Java Developers
Yakov Fain
 
PDF
Reactive Streams and RxJava2
Yakov Fain
 
PDF
Using JHipster 4 for generating Angular/Spring Boot apps
Yakov Fain
 
PDF
Java Intro: Unit1. Hello World
Yakov Fain
 
PDF
Running a Virtual Company
Yakov Fain
 
PDF
Princeton jug git_github
Yakov Fain
 
PDF
Surviving as a Professional Software Developer
Yakov Fain
 
PDF
Becoming a professional software developer
Yakov Fain
 
Type script for_java_dev_jul_2020
Yakov Fain
 
Using JHipster for generating Angular/Spring Boot apps
Yakov Fain
 
Using JHipster for generating Angular/Spring Boot apps
Yakov Fain
 
TypeScript for Java Developers
Yakov Fain
 
Reactive Streams and RxJava2
Yakov Fain
 
Using JHipster 4 for generating Angular/Spring Boot apps
Yakov Fain
 
Java Intro: Unit1. Hello World
Yakov Fain
 
Running a Virtual Company
Yakov Fain
 
Princeton jug git_github
Yakov Fain
 
Surviving as a Professional Software Developer
Yakov Fain
 
Becoming a professional software developer
Yakov Fain
 

Recently uploaded (20)

PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
July Patch Tuesday
Ivanti
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Biography of Daniel Podor.pdf
Daniel Podor
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
July Patch Tuesday
Ivanti
 

Seven Versions of One Web Application

  • 1. Yakov Fain, Farata Systems 7 Versions of One Web Application
  • 3. We’ll  Review  7  Versions  of  the  UI  of  this  Single  Page  Applica?on   SPA:  One  Web  page,  AJAX  calls  bring  the  data  as  needed,  CSS  hides/shows  HTML  elements  
  • 4. …  and  the  7  versions  are…   1.  HTML/AJAX   2.  HTML  +  Responsive  Web  Design   3.  With  jQuery  library     4.  With  Ext  JS  framework   5.  Modularizing  HTML5   6.  With  jQuery  Mobile   7.  With  Sencha  Touch  
  • 6. V1:  HTML,  JS,  CSS,  AJAX,  JSON   //  Loading  data    with  AJAX  and  parsing  JSON                                   func9on  loadData(dataUrl)  {    var  xhr  =  new  XMLH+pRequest();        xhr.open('GET',  dataUrl,  true);      xhr.onreadystatechange  =  func9on()  {      if  (xhr.readyState  ==  4)  {        if  (xhr.status  ==  200)  {          var  jsonData  =  xhr.responseText;            //parse  json  data          var  campaignsData  =  JSON.parse(jsonData).campaigns;          showCampaignsInfo(campaignsData);        }  else  {          console.log(xhr.statusText);        }      }    }    xhr.send(null);   }  
  • 9. V2:  Responsive  Web  Design(RWD)   •  Should  we  create  separate  versions  for  desktop  and   mobile?   •  How  many  versions  of  the  UI  to  create?   •  Can  we  have  a  single  HTML  version  for  all  devices?   •  CSS  Media  Queries  –    layouts  based  on  screen  width   •  Seing  CSS  Breakpoints   •  Pros  and  Cons  of  RWD    
  • 10. Remember  the  wireframe  for  desktops?  
  • 11. Wireframing  for  a  table  in  portrait    
  • 13. Wireframing  for  smaller  phones   These  are  the  wireframes  for  3  phone  screens  
  • 14. V2:  Demo   1.  Basic  Media  Queries   2.  Responsive  Header   3.  Responsive   Dona?on   4.  Responsive  Final  
  • 15. RWD  Pros  and  Cons   •  RWD  is  good  for  publishing  info.  Mobile  frameworks  can  be  a   beker  choice  for  interac?ve  apps   •  RWD  allows  to  have  a  single  app  code  base   •  Mobile  versions  of  an  app  may  need  limited  func?onality  and   specific  naviga?on   •  RWD  means  larger  traffic  (heavy  CSS)  –  no  good  for  slower   connec?ons   •  Mobile  frameworks  offer  more  na?ve  look  and  feel  of  the  UI     Libraries  of  responsive  UI  components:   Bootstrap:  hkp://getbootstrap.com   Seman?c  UI:  hkp://seman?c-­‐ui.com          
  • 16. V3:  With  jQuery  Library   •  Learning  jQuery  is  easy  for  designers  –  mostly  HTML.   •  40  –  50%  of  top  Web  sites  use  jQuery  (see  bultwith.com)         •  It’s  a  light-­‐weight  addi?on  to  your  app  –  33Kb  gzipped,  minified   •  Shorter  than  in  JS  syntax  for  DOM  Browsing     •  $()  –  pass  it  a  String,    pass  it  a  func?on     •  There  are  thousands  plugins  in  jQuery  Plugin  Registry  
  • 17. DOM  Querying  &  Func?on  Chaining  
  • 18. An  AJAX  call  in  jQuery   The  shortcut  methods:  $.get(),  $.post(),  $.getJSON()  
  • 19. V3:  Demo  with  jQuery  
  • 20. V4:  With  Sencha  Ext  JS  Framework   •  Ext  JS  has  rich  library  of  enterprise-­‐grade  components,  e.g.  grids,  charts   •  Cool  code  generator  Sencha  CMD   •  Promotes  MVC  architecture   •  Some  code  reuse  for  mobile  app  with  Sencha  Touch   •  The  “weight”  of  the  app  substan?ally  increases   •  If  you  decided  to  go  with  Ext  JS,  there  is  no  easy  way  out   •  Doesn’t  support  Responsive  Web  Design   •  Has  steep  learning  curve  –  has  no  HTML,  but  new  JS-­‐based  syntax  
  • 21. Ext  JS:    index.html  and  app.js  
  • 22. Ext  JS:    index.html  and  app.js  
  • 24. Genera?ng  a  project  with  Sencha  CMD   sencha  -­‐sdk  /Library/ext-­‐4.2  generate  app  HelloWorld  /Users/yfain11/hello  
  • 25. The  View  Fragment:  DonateForm.js    
  • 26. V4:  Demo  with  Ext  JS  
  • 27. V5:  Modularizing  UI   •  Large  apps  should  be  modularized  to  avoid  loading  all  code  at  once.   •  Mul?ple  <script> tags  may  depend  on  each  other  and  have  to   be  loaded  in  certain  order.   •  Need  to  be  able  to  specify  dependencies  between  the  modules.   Need  to  avoid  pollu?ng  global  scope  and  name  conflicts.     Manually  wri?ng  Modules  doesn’t  solve  these  issues.   •  Today:  CommonJS  and  Async  Module  Defini?on  (AMD)  specs   •  Tomorrow:  ECMAScript  6  spec  (a.k.a.  Harmony)  defines  modules.  
  • 28. One  way  of  implemen?ng  Module  Pakern   Passing  inside  the  module  a  reference  to  the  global  window  object    
  • 29. CommonJS  is  an  effort  to  standardize  JS  APIs.   CommonJS  Modules  defines  3  variables  for  modules:                -­‐  requires          -­‐  exports          -­‐  module   Node.js  framework  implements  CommonJS  Modules  spec  and   provides  these  global  variables.  
  • 30. Code  Sample  With  CommonJS  
  • 31. CommonJS  Pros  and  Cons   Pros:     •  Simple  API     Cons:   •  Mainly  for  the  server-­‐side  JavaScript.  Web  browsers  don’t  have     require,  export,  and  module  variables.       •  The  require  method  is  synchronous.       •  CommonJS  API  is  suitable  for  loading  JS  files,  but  can’t  load  CSS     and  HTML.  
  • 32. Asynchronous  Module  Defini?on  (AMD)   AMD  is  a  proposal  for  async  loading  of  both  the  module  and  its   dependencies  in  Web  browsers.       You  provide  define  and  require  func?ons:     define(! module_id, // optional! [dependencies],! function (){! // This function runs once when the module and its dependencies are loaded! }! );! ! ! require(["main"], function() {! console.log(”The module main is loaded");! });! !   ! ! ! The  func?on  define  defines  the  module  and  returns  it  once  it’s  needed.     The  require  executes  the  given  func?on  checking  that  the  dependencies  were  loaded.    
  • 33. Save  The  Child  Modularized  With  RequireJS   Lis?ng  modules  in  config.js  
  • 34. V5  Demo:  With  RequireJS  
  • 36. “Way  To  Give”  Module  Defini?on  
  • 37. V6:  With  jQuery  Mobile   •  Easy  to  learn.  Built  on  top  of  jQuery  Core  library   •  HTML5  allows  crea?ng  custom  non-­‐visible  akributes.  They   have  to  start  with  data-:   <div data-role="page" id="Stats"> •  The  UI  shows  one  page  at  a  ?me   •  Light-­‐weight  (90Kb  gZipped)  
  • 38. Mul?-­‐Page  Template   <body> <!-- Page 1 --> <div data-role="page" id="Donate” > ... </div> <!-- Page 2 --> <div data-role="page" id="Stats” > ... </div> </body> The  content  of  mul?ple  pages  is  located  in  one  file.     When  the  app  starts,  only  the  first  page  is  displayed  
  • 39. Mul?-­‐Page  Template  (cont.)   <body> <!-- Page 1 --> <div data-role="page" id="Donate"> <div data-role="header" >...</div> <div data-role="content" >...</div> <div data-role="footer" >...</div> </div> <!-- Page 2 --> <div data-role="page" id="Stats"> ... </div> </body>
  • 40. Naviga?on  Bar   <div data-role="navbar"> <ul> <li> <a href="#Who-We-Are">Who We Are</a> </li> <li> <a href="#What-We-Do">What We Do</a> </li> <li> <a href="#Where-We-Work">Where We Work</a> </li> <li> <a href="#Way-To-Give">Way To Give</a> </li> </ul> </div>
  • 42. The  Back  Bukon   <div data-role="page" id="Stats" data-add-back-btn="true"> <div data-role="header" > <h1>Statistics</h1> </div> Statistics will go here </div>
  • 43. Single-­‐Page  Template   An  HTML  file  contains  the  content  of  a  single  page.     <div data-role="navbar"> <ul> <li> <a href="page-1.html" data-transition="slideup">Page #1</a> </li> <li> <a href="#" class="ui-state-persist">Page #2</a> </li> <li> <a href="page-3.html" data-transition="slideup">Page #3</a> </li> <li> <a href="page-4.html" data-transition="slideup">Page #4</a> </li> </ul> </div>
  • 44. V6:  Demo  With  jQuery  Mobile  
  • 45. V7:  With  Sencha  Touch   •  Sencha  Touch  is  a  smaller  brother  of  Ext  JS   •  It  comes  with  mobile  versions  of  lists,   forms,  toolbars,  bukons,  charts,  audio,   video,  carousel  etc.   •  Jumpstart  development  with  genera?ng   the  app  with  Sencha  CMD.   •  Package  the  Sencha  Touch  app  as  na?ve  
  • 46. The  app.JS   Ext.applica?on({          name:  'SSC',            requires:  [                  'Ext.MessageBox'          ],            views:  [                  'About',                  'CampaignsMap',                  'DonateForm',                  'DonorsChart',                  'LoginForm',                  'LoginToolbar',                  'Main',                  'Media',                  'Share',                  'ShareTile'          ],            stores:  [                  'Campaigns',                  'Countries',                  'Donors',                  'States',                  'Videos'          ],x            controllers:  [                  'Login'          ],            launch:  func?on()  {                  //  Destroy  the  #appLoadingIndicator  element                  Ext.fly('appLoadingIndicator').destroy();                    //  Ini?alize  the  main  view                  Ext.Viewport.add(Ext.create('SSC.view.Main'));          },            onUpdated:  func?on()  {                  Ext.Msg.confirm(                          "Applica?on  Update",                          "This  applica?on  has  just  successfully  been  updated   to  the  latest  version.  Reload  now?",                          func?on(bukonId)  {                                  if  (bukonId  ===  'yes')  {                                          window.loca?on.reload();                                  }                          }                  );          }   });  
  • 50. jQuery  Mobile  or  Sencha  Touch?   Use  jQuery  Mobile  if:     •  You  are  afraid  of  being  locked  up  with  any  one  vendor.     •  You  need  your  applica?on  to  work  on  most  of  the  mobile  pla€orms.   •  You  prefer  declara?ve  UI  and  hate  debugging  JavaScript.  
  • 51. jQuery  Mobile  or  Sencha  Touch?   Use  Sencha  Touch  if:     •  You  like  to  have  a  rich  library  of  pre-­‐created  UI   •  Your  applica?on  needs  smooth  anima?on   •  You  are  into  MVC     •  You  want  to  package  your  applica?on  as  a  na?ve  one   •  You  want  your  applica?on  to  look  as  close  to  the  na?ve  ones     as  possible  
  • 52. V7:  Demo  With  Sencha  Touch  
  • 53. Where  to  go  next?   Google  Dart  Language:   hkps://www.dartlang.org     Google  Angular  Dart  Framework:   hkps://github.com/angular/angular.dart    
  • 54. Links   •  7  versions  of  the  Save  The  Child  app:   hkp://savesickchild.org   •  Enterprise  Web  Dev  book:   hkp://oreil.ly/1hxK5hl       •  My  employer:       hkp://faratasystems.com     •  My  Twiker:  @yfain