SlideShare a Scribd company logo
Canopy walk through
Single-Page Apps (SPAs)
Benjamin Howarth
What is a single-page app?
•
•
•
•
•

Single HTML file
Responsive CSS
Javascript “modules”
Underlying API
Tend to follow Model-View-ViewModel (MVVM) pattern
Examples of SPAs
Why SPA?
• Consistent user experience across
desktop, mobile & tablet

• Partially-connected client
functionality

• In short, data-rich apps across a
modern, diverse web platform
Why not SPA?
• http://forums.asp.net/t/1891892.aspx/1?W
hen+not+to+SPA+

“One example would be a web site. Lots of
static data for presentation in regions or
areas. This could be done with client side
templating, but then you lose a lot of SEO
too, and web sites are often where SEO is
important. (In contrast, a SPA for a banking
app is not a place you'd want SEO). So there
are 2 examples: web sites and any place you
need SEO badly. There are ways to do SEO
in SPA, but its not a natural fit.”

• My response?
“Twitter”
Canopy view of single-page applications (SPAs)
• Asynchronous Module Definition
• Standard format for dependency injection
What is AMD?
Dependency injection for functional
programming languages
(no, you’re not seeing things)

in Javasript

• Dependencies are loaded into a
constructor function asynchronously

• The constructor is invoked only when all
dependencies have loaded

• The constructor returns an object – your
viewmodel
• KnockoutJS is a Javascript model binder

KnockoutJS
What is it, and why should I care?

• Turns JSON objects into “observables” e.g.
var something = ko.observable(false);
something(true); // changes value, and fires an event

• Binds Javascript objects to HTML templates, making
code reusable, neater, and easier to maintain

• Makes event-driven Javascript data binding supereasy, instead of $(“input”).change(function() { });
everywhere
• N.B. Every time you do this, a kitten dies.
BreezeJS
What is it, and why should I care?

• BreezeJS is LINQ for Web API with
JSON

• Web API returns JSON or ATOMcompatible XML, BreezeJS makes it
queryable in Javascript

• LINQ all the things!
Viewmodel
Bringing your JS together
Node.js isn’t scary compared to this…

RequireJS

(makes it
modular, gives you
dependency injection)

KnockoutJS
(gives you a “stronglytyped” event-driven JS
viewmodel)

BreezeJS

(used by your KO
viewmodel to get data
from the server)
Model

Bringing the server
and client together
One web, one ASP.NET

MVC
controller

Web API
controller

Viewmodel
(Javascript)

View
(HTML)

View
(OData)

View
(HTML)
• Views
•

MVC = MVVM

• Controller

MVC and MVVM working
together

•

MVC
•
•

2) Partial page using AJAX

•

•

1) Full page using MVC
#1 and #2 are done with the same controller

MVVM
•

Requests views using #2

• Model
•

MVC
•
•

•

O/RM of choice
JSON using Web API

MVVM
•

Breeze calling Web API

• Routes
•

Exported to MVVM routing library from MVC via JSON
Thanks for listening!
•
•
•
•

http://www.benjaminhowarth.com
http://www.codegecko.com
http://github.com/codegecko
@benjaminhowarth

More Related Content

PPTX
PPTX
Migrating MVVM Applications to HTML5
PDF
Integrating AngularJS into the Campus CMS
PPTX
Javascript for Wep Apps
PPTX
Backbonejs
PPT
KnockoutJS and MVVM
PDF
Specialisation 1-jquery-basics
PPTX
You know what iMEAN? Using MEAN stack for application dev on Informix
Migrating MVVM Applications to HTML5
Integrating AngularJS into the Campus CMS
Javascript for Wep Apps
Backbonejs
KnockoutJS and MVVM
Specialisation 1-jquery-basics
You know what iMEAN? Using MEAN stack for application dev on Informix

What's hot (20)

PPTX
Intro to Knockout.JS for Salesforce1
PDF
Ajax and RJS
PPT
Java script202
PPTX
Unobtrusive js
PDF
Visual resume
ODP
Compress
PPTX
MEAN stack
PPT
Get MEAN! Node.js and the MEAN stack
PPTX
EventBridge Patterns and real world use case
PDF
Session dotNed Saturday 28 januari 2017
PPTX
Isomorphic web apps with react
PPT
AngularJS - the folly of choice
PPTX
Welcome to Wijmo 5
PPTX
Overview of AJAX
PDF
Introduction to the MEAN stack
PDF
WordPress & Backbone.js
PPTX
Introduction to mean stack
PPTX
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
PDF
Angular JS - Wikilogia
PPTX
Wheel.js
Intro to Knockout.JS for Salesforce1
Ajax and RJS
Java script202
Unobtrusive js
Visual resume
Compress
MEAN stack
Get MEAN! Node.js and the MEAN stack
EventBridge Patterns and real world use case
Session dotNed Saturday 28 januari 2017
Isomorphic web apps with react
AngularJS - the folly of choice
Welcome to Wijmo 5
Overview of AJAX
Introduction to the MEAN stack
WordPress & Backbone.js
Introduction to mean stack
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
Angular JS - Wikilogia
Wheel.js
Ad

Viewers also liked (14)

PPTX
Single page application 02
PPT
Learningdom online education
PDF
2554 รวมรางวัลเกียรติยศจากอดีตถึงปี 2554
PPTX
cBio Cancer Genomics Portal: Network View
PPT
PPP for our Canadian penpals
PDF
ChesirePresentation
PPTX
Relatório de missões rio grande do sul e santa catarina
PPTX
Hello c
PPTX
Práctica 3
PPTX
StreetSeen: Factors Influencing the Desirability of a Street for Bicycling
PPTX
Task 2 - Mood Board
PPTX
Presentation1
PPTX
Young people do a lot of things with technology - does that include learning?
PPS
Chandeleur Les crêpes
Single page application 02
Learningdom online education
2554 รวมรางวัลเกียรติยศจากอดีตถึงปี 2554
cBio Cancer Genomics Portal: Network View
PPP for our Canadian penpals
ChesirePresentation
Relatório de missões rio grande do sul e santa catarina
Hello c
Práctica 3
StreetSeen: Factors Influencing the Desirability of a Street for Bicycling
Task 2 - Mood Board
Presentation1
Young people do a lot of things with technology - does that include learning?
Chandeleur Les crêpes
Ad

Similar to Canopy view of single-page applications (SPAs) (20)

PPTX
WebNetConf 2012 - Single Page Apps
DOCX
Single Page Application
PPTX
Single page applications
PPTX
Benefits of developing single page web applications using angular js
PPTX
Real World Single Page App - A Knockout Case Study
PPTX
Single Page Applications: Your Browser is the OS!
PPTX
Single Page Applications on JavaScript and ASP.NET MVC4
PDF
Single Page Application (SPA): A Comprehensive Guide for Beginners
PPT
single page application
PDF
Single page applications with backbone js
PDF
Single page applications
PDF
Single Page Apps
PDF
Angular webinar - Credo Systemz
PPTX
Angular jS Introduction by Google
 
PPT
Comparative analysis of java script framework
PDF
#1 | Introduction to Microsoft Blazor | Sameer Siddiqui
PPTX
Single page application
PDF
Javascript Client & Server Architectures
PDF
Single Page Apps
KEY
Sugarcoating your frontend one ViewModel at a time
WebNetConf 2012 - Single Page Apps
Single Page Application
Single page applications
Benefits of developing single page web applications using angular js
Real World Single Page App - A Knockout Case Study
Single Page Applications: Your Browser is the OS!
Single Page Applications on JavaScript and ASP.NET MVC4
Single Page Application (SPA): A Comprehensive Guide for Beginners
single page application
Single page applications with backbone js
Single page applications
Single Page Apps
Angular webinar - Credo Systemz
Angular jS Introduction by Google
 
Comparative analysis of java script framework
#1 | Introduction to Microsoft Blazor | Sameer Siddiqui
Single page application
Javascript Client & Server Architectures
Single Page Apps
Sugarcoating your frontend one ViewModel at a time

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Machine Learning_overview_presentation.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Spectroscopy.pptx food analysis technology
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Mushroom cultivation and it's methods.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
1. Introduction to Computer Programming.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
A comparative study of natural language inference in Swahili using monolingua...
Network Security Unit 5.pdf for BCA BBA.
Machine Learning_overview_presentation.pptx
A comparative analysis of optical character recognition models for extracting...
TLE Review Electricity (Electricity).pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Empathic Computing: Creating Shared Understanding
Spectroscopy.pptx food analysis technology
NewMind AI Weekly Chronicles - August'25-Week II
Univ-Connecticut-ChatGPT-Presentaion.pdf
Mushroom cultivation and it's methods.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
Heart disease approach using modified random forest and particle swarm optimi...
Group 1 Presentation -Planning and Decision Making .pptx
Per capita expenditure prediction using model stacking based on satellite ima...
1. Introduction to Computer Programming.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Diabetes mellitus diagnosis method based random forest with bat algorithm
MIND Revenue Release Quarter 2 2025 Press Release
A comparative study of natural language inference in Swahili using monolingua...

Canopy view of single-page applications (SPAs)

  • 1. Canopy walk through Single-Page Apps (SPAs) Benjamin Howarth
  • 2. What is a single-page app? • • • • • Single HTML file Responsive CSS Javascript “modules” Underlying API Tend to follow Model-View-ViewModel (MVVM) pattern
  • 4. Why SPA? • Consistent user experience across desktop, mobile & tablet • Partially-connected client functionality • In short, data-rich apps across a modern, diverse web platform
  • 5. Why not SPA? • http://forums.asp.net/t/1891892.aspx/1?W hen+not+to+SPA+ “One example would be a web site. Lots of static data for presentation in regions or areas. This could be done with client side templating, but then you lose a lot of SEO too, and web sites are often where SEO is important. (In contrast, a SPA for a banking app is not a place you'd want SEO). So there are 2 examples: web sites and any place you need SEO badly. There are ways to do SEO in SPA, but its not a natural fit.” • My response? “Twitter”
  • 7. • Asynchronous Module Definition • Standard format for dependency injection What is AMD? Dependency injection for functional programming languages (no, you’re not seeing things) in Javasript • Dependencies are loaded into a constructor function asynchronously • The constructor is invoked only when all dependencies have loaded • The constructor returns an object – your viewmodel
  • 8. • KnockoutJS is a Javascript model binder KnockoutJS What is it, and why should I care? • Turns JSON objects into “observables” e.g. var something = ko.observable(false); something(true); // changes value, and fires an event • Binds Javascript objects to HTML templates, making code reusable, neater, and easier to maintain • Makes event-driven Javascript data binding supereasy, instead of $(“input”).change(function() { }); everywhere • N.B. Every time you do this, a kitten dies.
  • 9. BreezeJS What is it, and why should I care? • BreezeJS is LINQ for Web API with JSON • Web API returns JSON or ATOMcompatible XML, BreezeJS makes it queryable in Javascript • LINQ all the things!
  • 10. Viewmodel Bringing your JS together Node.js isn’t scary compared to this… RequireJS (makes it modular, gives you dependency injection) KnockoutJS (gives you a “stronglytyped” event-driven JS viewmodel) BreezeJS (used by your KO viewmodel to get data from the server)
  • 11. Model Bringing the server and client together One web, one ASP.NET MVC controller Web API controller Viewmodel (Javascript) View (HTML) View (OData) View (HTML)
  • 12. • Views • MVC = MVVM • Controller MVC and MVVM working together • MVC • • 2) Partial page using AJAX • • 1) Full page using MVC #1 and #2 are done with the same controller MVVM • Requests views using #2 • Model • MVC • • • O/RM of choice JSON using Web API MVVM • Breeze calling Web API • Routes • Exported to MVVM routing library from MVC via JSON

Editor's Notes

  • #8: After this, pull up code sample #1