SlideShare a Scribd company logo
Brendan Kowitz
                                                  @brendankowitz
                            Live Backchannel: #dddbrisbane #web03




Going Offline with JS
  and JavaScript Application Development
Overview
    • Introduction

1 • JavaScript on my Server!
    • Dependencies, Patterns, Templates
2   • Client-side JavaScript

3 • WinJS (Windows 8)
    • Wrap up
What are the issues?
• How to we reuse our own libraries?
• How do we tackle dependency / module
  management?
• How do we structure our projects?
• How do we test our projects?
• What tools do we use?
What can we gain?
• Vast open source community
• Mostly platform independent
• Some of the fastest Dynamic Language
  interpreters around*
• Reduce language ambiguity
What can we build?




                                                     Windows 8
Node.js + Railsway.js   jQuery Mobile + Spine.js
                                                   JavaScript Metro
Server-side
• Exploring Node.js
• Dependency Management
  – Node.js Package Manager
• Railway.js MVC
Dependency Management
• Downloading Dependent Libraries
  – .NET has Nuget (this also works for JS in .NET
    projects)
  – Ruby has Gems
  – Node.js uses NPM (Node.js Package Manager)
Dependency Management --cont
   • Using those libraries in your page
       – CommonJS specification
            • RequireJS
            • Node.js
            • When.js
       – Script Loaders (load scripts in parallel)
            • YepNope
            • Yabble
            • LABjs


http://lmgtfy.com/?q=commonjs
Railway.js
•   railway init blog && cd blog
•   npm install -l
•   railway generate crud post title content
•   railway server 8888
•   open http://127.0.0.1:8888/posts
Testing from the server
• Node.js
  – Zombie.js
  – Tobi.js
  – … many others
Server-side demo
Client-side JavaScript




     jQuery Mobile + Spine.js
Common Client-Side Patterns
    • Free for all




http://xkcd.com/292/
Common Client-Side Patterns
•   Namespaces
•   Module Pattern
•   Sandbox
•   .. MVC
JavaScript Refresher
(function(){
            var Person = function(firstName, lastName){
                       this.firstName = firstName;
                       this.lastName = lastName;
            };

           Person.find = function(id) {
                      console.log('Trying to find ' + id);
           };

           Person.fn = Person.prototype;
           Person.fn.fullName = function(){
                      return this.firstName + ' ' + this.lastName;
           };

           var john = new Person('John', 'Smith');

           console.log(john.fullName());
           Person.find(1);
}());
MVC: Spine.js




http://addyosmani.com/blog/building-apps-spinejs/
Testing Part 2
• Client-side
  – QUnit
  – Jasmine (BDD)
  – (Many others)
Spine.js demo
Windows 8 Metro - WinJs
• App starts like any web page - HTML page
  loads
• HTML page loads its files
  – WinJS script & styles
  – Your app’s scripts & styles
• Your code wires up to app lifetime events
• Start the app
• … and events happen
Windows 8 Metro - WinJs
Working with Async
   • Promise Pattern
   • jQuery 1.5+
            $.when($.ajax("http://www.example.org/somedata.json”))
              .then(myFunc, myFailure);


   • WinJS
            WinJS.xhr({
              url:"http://www.example.org/somedata.json"
            }).then(function (response) {
                updateDisplay(
                  JSON.parse(response.responseText));
            });


http://wiki.commonjs.org/wiki/Promises/A
Navigation
• Multi page (Not recommended in MSDN doco)
   –   Default behavior of browser
   –   Navigation loads a new page
   –   Drops script context
   –   Have to serialize state that gets passed across pages
       (use WinJS to help)
• Single Page
   –   One page as far as browser is concerned
   –   DOM elements changed programmatically
   –   Keeps script context and state for app lifetime
   –   Harder to design an app in a single HTML file
Fragments
• We want separate HTML files
  – Easier to design
  – Easier to maintain
• Fragments
  – Separate files, plus a loader that will bring them in
  – In ui.js: WinJS.UI.Fragments namespace
Navigation & Fragments
function navigated(e) {
  WinJS.UI.Fragments.clone(e.detail.location, e.detail.state)
    .then(function (frag) {
      var host = document.getElementById('contentHost');
      host.innerHTML = '';
      host.appendChild(frag);
    });
}

WinJS.Navigation.addEventListener("navigated", navigated);

WinJS.Navigation.navigate("/html/home.html");
demo
Further Reading
Mozilla Chromeless




   “The “Chromeless” project experiments with the idea of removing the current
   browser user interface and replacing it with a flexible platform which allows for the
   creation of new browser UI using standard web technologies such as HTML, CSS and
   JavaScript.”




http://mozillalabs.com/chromeless
Wrap up

     1                   2                      3



Problems with JS    JavaScript Patterns     Windows 8
CommonJS            Spine.js              JavaScript Metro
Node.js             PhoneGap
Railway.js          QUnit
Tobi.js
brendan.kowitz@readify.net

Thank you.                    http://www.kowitz.net

                              @brendankowitz




        http://hg.kowitz.net/ddd
Ad

More Related Content

What's hot (19)

Node JS Crash Course
Node JS Crash CourseNode JS Crash Course
Node JS Crash Course
Haim Michael
 
Mean Stack for Beginners
Mean Stack for BeginnersMean Stack for Beginners
Mean Stack for Beginners
JEMLI Fathi
 
Node js - Enterprise Class
Node js - Enterprise ClassNode js - Enterprise Class
Node js - Enterprise Class
Glenn Block
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
Women in Technology Poland
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
Yos Riady
 
Node js crash course session 1
Node js crash course   session 1Node js crash course   session 1
Node js crash course session 1
Abdul Rahman Masri Attal
 
Using Javascript in today's world
Using Javascript in today's worldUsing Javascript in today's world
Using Javascript in today's world
Sudar Muthu
 
Sfd hanoi2012 nguyen ha duong yang node.js-intro
Sfd hanoi2012 nguyen ha duong yang   node.js-introSfd hanoi2012 nguyen ha duong yang   node.js-intro
Sfd hanoi2012 nguyen ha duong yang node.js-intro
Vu Hung Nguyen
 
Javascript Update May 2013
Javascript Update May 2013Javascript Update May 2013
Javascript Update May 2013
RameshNair6
 
Learnhowtotamethejavascriptmonsterwithvjetjside
LearnhowtotamethejavascriptmonsterwithvjetjsideLearnhowtotamethejavascriptmonsterwithvjetjside
Learnhowtotamethejavascriptmonsterwithvjetjside
Justin Early
 
JavaScript History
JavaScript HistoryJavaScript History
JavaScript History
Rhio Kim
 
Javascript now and in the future
Javascript now and in the futureJavascript now and in the future
Javascript now and in the future
Denis Stoyanov
 
Intro to nodejs
Intro to nodejsIntro to nodejs
Intro to nodejs
Abhinav Dhasmana
 
Aleact
AleactAleact
Aleact
Hyun Je Moon
 
Web workers
Web workers Web workers
Web workers
Ran Wahle
 
8 Most Effective Node.js Tools for Developers
8 Most Effective Node.js Tools for Developers8 Most Effective Node.js Tools for Developers
8 Most Effective Node.js Tools for Developers
iMOBDEV Technologies Pvt. Ltd.
 
Lessons in Open Source from the MongooseJS ODM
Lessons in Open Source from the MongooseJS ODMLessons in Open Source from the MongooseJS ODM
Lessons in Open Source from the MongooseJS ODM
Valeri Karpov
 
Single Sign On in Ruby - Enterprise Ready!
Single Sign On in Ruby - Enterprise Ready!Single Sign On in Ruby - Enterprise Ready!
Single Sign On in Ruby - Enterprise Ready!
Nikos Dimitrakopoulos
 
Dojo, from scratch to result
Dojo, from scratch to resultDojo, from scratch to result
Dojo, from scratch to result
Nikolai Onken
 
Node JS Crash Course
Node JS Crash CourseNode JS Crash Course
Node JS Crash Course
Haim Michael
 
Mean Stack for Beginners
Mean Stack for BeginnersMean Stack for Beginners
Mean Stack for Beginners
JEMLI Fathi
 
Node js - Enterprise Class
Node js - Enterprise ClassNode js - Enterprise Class
Node js - Enterprise Class
Glenn Block
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
Women in Technology Poland
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
Yos Riady
 
Using Javascript in today's world
Using Javascript in today's worldUsing Javascript in today's world
Using Javascript in today's world
Sudar Muthu
 
Sfd hanoi2012 nguyen ha duong yang node.js-intro
Sfd hanoi2012 nguyen ha duong yang   node.js-introSfd hanoi2012 nguyen ha duong yang   node.js-intro
Sfd hanoi2012 nguyen ha duong yang node.js-intro
Vu Hung Nguyen
 
Javascript Update May 2013
Javascript Update May 2013Javascript Update May 2013
Javascript Update May 2013
RameshNair6
 
Learnhowtotamethejavascriptmonsterwithvjetjside
LearnhowtotamethejavascriptmonsterwithvjetjsideLearnhowtotamethejavascriptmonsterwithvjetjside
Learnhowtotamethejavascriptmonsterwithvjetjside
Justin Early
 
JavaScript History
JavaScript HistoryJavaScript History
JavaScript History
Rhio Kim
 
Javascript now and in the future
Javascript now and in the futureJavascript now and in the future
Javascript now and in the future
Denis Stoyanov
 
Web workers
Web workers Web workers
Web workers
Ran Wahle
 
Lessons in Open Source from the MongooseJS ODM
Lessons in Open Source from the MongooseJS ODMLessons in Open Source from the MongooseJS ODM
Lessons in Open Source from the MongooseJS ODM
Valeri Karpov
 
Single Sign On in Ruby - Enterprise Ready!
Single Sign On in Ruby - Enterprise Ready!Single Sign On in Ruby - Enterprise Ready!
Single Sign On in Ruby - Enterprise Ready!
Nikos Dimitrakopoulos
 
Dojo, from scratch to result
Dojo, from scratch to resultDojo, from scratch to result
Dojo, from scratch to result
Nikolai Onken
 

Viewers also liked (20)

Pantomime Scene Outline - Pairs
Pantomime Scene Outline - PairsPantomime Scene Outline - Pairs
Pantomime Scene Outline - Pairs
renee
 
Joseph C. Volpe Appointed Mortgage Loan Officer
Joseph C. Volpe Appointed Mortgage Loan OfficerJoseph C. Volpe Appointed Mortgage Loan Officer
Joseph C. Volpe Appointed Mortgage Loan Officer
Hyperion Bank
 
El alcohol
El alcohol El alcohol
El alcohol
Yolanda García-Uceda Serrano
 
Some Poetic Delights
Some Poetic DelightsSome Poetic Delights
Some Poetic Delights
Pradip Banerjee
 
Larguiee ...77
Larguiee ...77Larguiee ...77
Larguiee ...77
erik ordoñez
 
Trade in ideas
Trade in ideasTrade in ideas
Trade in ideas
Springer
 
Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)
Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)
Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)
poponapolitica
 
정찬훈 강사 프로필 (사진관리)
정찬훈 강사 프로필 (사진관리)정찬훈 강사 프로필 (사진관리)
정찬훈 강사 프로필 (사진관리)
찬훈 정
 
Laser drilling
Laser drillingLaser drilling
Laser drilling
Springer
 
El factor humano de la negociacion (lectura liviana)gaby
El factor humano de la negociacion (lectura liviana)gabyEl factor humano de la negociacion (lectura liviana)gaby
El factor humano de la negociacion (lectura liviana)gaby
gabyah1702
 
Handbook of healthcare operations management
Handbook of healthcare operations managementHandbook of healthcare operations management
Handbook of healthcare operations management
Springer
 
Diabetic Retinopathy Detection
Diabetic Retinopathy DetectionDiabetic Retinopathy Detection
Diabetic Retinopathy Detection
SPb_Data_Science
 
Prominin new insights on stem & cancer stem cell biology
Prominin new insights on stem & cancer stem cell biologyProminin new insights on stem & cancer stem cell biology
Prominin new insights on stem & cancer stem cell biology
Springer
 
Electromagnetic Frequency Spectrum Presentation
Electromagnetic Frequency Spectrum PresentationElectromagnetic Frequency Spectrum Presentation
Electromagnetic Frequency Spectrum Presentation
Andile Ngcaba
 
사진교육프로그램 8강
사진교육프로그램 8강사진교육프로그램 8강
사진교육프로그램 8강
digitone
 
Ecommerce Hotelero III
Ecommerce Hotelero IIIEcommerce Hotelero III
Ecommerce Hotelero III
Juan Mi Llompart
 
Non proliferative diabetic retinopathy by phaneendra akana
Non proliferative diabetic retinopathy by phaneendra akanaNon proliferative diabetic retinopathy by phaneendra akana
Non proliferative diabetic retinopathy by phaneendra akana
Mohan Phaneendra Akana
 
디지털카메라강좌 제2강
디지털카메라강좌 제2강디지털카메라강좌 제2강
디지털카메라강좌 제2강
tailofmoon
 
Pantomime Scene Outline - Pairs
Pantomime Scene Outline - PairsPantomime Scene Outline - Pairs
Pantomime Scene Outline - Pairs
renee
 
Joseph C. Volpe Appointed Mortgage Loan Officer
Joseph C. Volpe Appointed Mortgage Loan OfficerJoseph C. Volpe Appointed Mortgage Loan Officer
Joseph C. Volpe Appointed Mortgage Loan Officer
Hyperion Bank
 
Trade in ideas
Trade in ideasTrade in ideas
Trade in ideas
Springer
 
Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)
Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)
Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)
poponapolitica
 
정찬훈 강사 프로필 (사진관리)
정찬훈 강사 프로필 (사진관리)정찬훈 강사 프로필 (사진관리)
정찬훈 강사 프로필 (사진관리)
찬훈 정
 
Laser drilling
Laser drillingLaser drilling
Laser drilling
Springer
 
El factor humano de la negociacion (lectura liviana)gaby
El factor humano de la negociacion (lectura liviana)gabyEl factor humano de la negociacion (lectura liviana)gaby
El factor humano de la negociacion (lectura liviana)gaby
gabyah1702
 
Handbook of healthcare operations management
Handbook of healthcare operations managementHandbook of healthcare operations management
Handbook of healthcare operations management
Springer
 
Diabetic Retinopathy Detection
Diabetic Retinopathy DetectionDiabetic Retinopathy Detection
Diabetic Retinopathy Detection
SPb_Data_Science
 
Prominin new insights on stem & cancer stem cell biology
Prominin new insights on stem & cancer stem cell biologyProminin new insights on stem & cancer stem cell biology
Prominin new insights on stem & cancer stem cell biology
Springer
 
Electromagnetic Frequency Spectrum Presentation
Electromagnetic Frequency Spectrum PresentationElectromagnetic Frequency Spectrum Presentation
Electromagnetic Frequency Spectrum Presentation
Andile Ngcaba
 
사진교육프로그램 8강
사진교육프로그램 8강사진교육프로그램 8강
사진교육프로그램 8강
digitone
 
Non proliferative diabetic retinopathy by phaneendra akana
Non proliferative diabetic retinopathy by phaneendra akanaNon proliferative diabetic retinopathy by phaneendra akana
Non proliferative diabetic retinopathy by phaneendra akana
Mohan Phaneendra Akana
 
디지털카메라강좌 제2강
디지털카메라강좌 제2강디지털카메라강좌 제2강
디지털카메라강좌 제2강
tailofmoon
 
Ad

Similar to Going Offline with JS (20)

Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
Jibanananda Sana
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
Yakov Fain
 
A Journey Begin with Node.js
A Journey Begin with Node.jsA Journey Begin with Node.js
A Journey Begin with Node.js
Khalid Farhan
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
Ganesh Kondal
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Aaron Rosenberg
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
 
End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012
Alexandre Morgaut
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
Kasey McCurdy
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
Richard Rodger
 
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNode.js In The Enterprise - A Primer
Node.js In The Enterprise - A Primer
Naveen S.R
 
Mini-Training: Node.js
Mini-Training: Node.jsMini-Training: Node.js
Mini-Training: Node.js
Betclic Everest Group Tech Team
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
Stuart (Pid) Williams
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
async_io
 
PUG Challenge 2016 - The nativescript pug app challenge
PUG Challenge 2016 -  The nativescript pug app challengePUG Challenge 2016 -  The nativescript pug app challenge
PUG Challenge 2016 - The nativescript pug app challenge
Bronco Oostermeyer
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
Yoann Gotthilf
 
Node.js: The What, The How and The When
Node.js: The What, The How and The WhenNode.js: The What, The How and The When
Node.js: The What, The How and The When
FITC
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
Mark Roden
 
Java Script recruiting
Java Script recruitingJava Script recruiting
Java Script recruiting
Ihor Odynets
 
Express yourself
Express yourselfExpress yourself
Express yourself
Yaniv Rodenski
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
Jibanananda Sana
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
Yakov Fain
 
A Journey Begin with Node.js
A Journey Begin with Node.jsA Journey Begin with Node.js
A Journey Begin with Node.js
Khalid Farhan
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
Ganesh Kondal
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
 
End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012
Alexandre Morgaut
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
Kasey McCurdy
 
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNode.js In The Enterprise - A Primer
Node.js In The Enterprise - A Primer
Naveen S.R
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
Stuart (Pid) Williams
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
async_io
 
PUG Challenge 2016 - The nativescript pug app challenge
PUG Challenge 2016 -  The nativescript pug app challengePUG Challenge 2016 -  The nativescript pug app challenge
PUG Challenge 2016 - The nativescript pug app challenge
Bronco Oostermeyer
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
Yoann Gotthilf
 
Node.js: The What, The How and The When
Node.js: The What, The How and The WhenNode.js: The What, The How and The When
Node.js: The What, The How and The When
FITC
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
Mark Roden
 
Java Script recruiting
Java Script recruitingJava Script recruiting
Java Script recruiting
Ihor Odynets
 
Ad

Recently uploaded (20)

SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 

Going Offline with JS

  • 1. Brendan Kowitz @brendankowitz Live Backchannel: #dddbrisbane #web03 Going Offline with JS and JavaScript Application Development
  • 2. Overview • Introduction 1 • JavaScript on my Server! • Dependencies, Patterns, Templates 2 • Client-side JavaScript 3 • WinJS (Windows 8) • Wrap up
  • 3. What are the issues? • How to we reuse our own libraries? • How do we tackle dependency / module management? • How do we structure our projects? • How do we test our projects? • What tools do we use?
  • 4. What can we gain? • Vast open source community • Mostly platform independent • Some of the fastest Dynamic Language interpreters around* • Reduce language ambiguity
  • 5. What can we build? Windows 8 Node.js + Railsway.js jQuery Mobile + Spine.js JavaScript Metro
  • 6. Server-side • Exploring Node.js • Dependency Management – Node.js Package Manager • Railway.js MVC
  • 7. Dependency Management • Downloading Dependent Libraries – .NET has Nuget (this also works for JS in .NET projects) – Ruby has Gems – Node.js uses NPM (Node.js Package Manager)
  • 8. Dependency Management --cont • Using those libraries in your page – CommonJS specification • RequireJS • Node.js • When.js – Script Loaders (load scripts in parallel) • YepNope • Yabble • LABjs http://lmgtfy.com/?q=commonjs
  • 9. Railway.js • railway init blog && cd blog • npm install -l • railway generate crud post title content • railway server 8888 • open http://127.0.0.1:8888/posts
  • 10. Testing from the server • Node.js – Zombie.js – Tobi.js – … many others
  • 12. Client-side JavaScript jQuery Mobile + Spine.js
  • 13. Common Client-Side Patterns • Free for all http://xkcd.com/292/
  • 14. Common Client-Side Patterns • Namespaces • Module Pattern • Sandbox • .. MVC
  • 15. JavaScript Refresher (function(){ var Person = function(firstName, lastName){ this.firstName = firstName; this.lastName = lastName; }; Person.find = function(id) { console.log('Trying to find ' + id); }; Person.fn = Person.prototype; Person.fn.fullName = function(){ return this.firstName + ' ' + this.lastName; }; var john = new Person('John', 'Smith'); console.log(john.fullName()); Person.find(1); }());
  • 17. Testing Part 2 • Client-side – QUnit – Jasmine (BDD) – (Many others)
  • 19. Windows 8 Metro - WinJs • App starts like any web page - HTML page loads • HTML page loads its files – WinJS script & styles – Your app’s scripts & styles • Your code wires up to app lifetime events • Start the app • … and events happen
  • 20. Windows 8 Metro - WinJs
  • 21. Working with Async • Promise Pattern • jQuery 1.5+ $.when($.ajax("http://www.example.org/somedata.json”)) .then(myFunc, myFailure); • WinJS WinJS.xhr({ url:"http://www.example.org/somedata.json" }).then(function (response) { updateDisplay( JSON.parse(response.responseText)); }); http://wiki.commonjs.org/wiki/Promises/A
  • 22. Navigation • Multi page (Not recommended in MSDN doco) – Default behavior of browser – Navigation loads a new page – Drops script context – Have to serialize state that gets passed across pages (use WinJS to help) • Single Page – One page as far as browser is concerned – DOM elements changed programmatically – Keeps script context and state for app lifetime – Harder to design an app in a single HTML file
  • 23. Fragments • We want separate HTML files – Easier to design – Easier to maintain • Fragments – Separate files, plus a loader that will bring them in – In ui.js: WinJS.UI.Fragments namespace
  • 24. Navigation & Fragments function navigated(e) { WinJS.UI.Fragments.clone(e.detail.location, e.detail.state) .then(function (frag) { var host = document.getElementById('contentHost'); host.innerHTML = ''; host.appendChild(frag); }); } WinJS.Navigation.addEventListener("navigated", navigated); WinJS.Navigation.navigate("/html/home.html");
  • 25. demo
  • 27. Mozilla Chromeless “The “Chromeless” project experiments with the idea of removing the current browser user interface and replacing it with a flexible platform which allows for the creation of new browser UI using standard web technologies such as HTML, CSS and JavaScript.” http://mozillalabs.com/chromeless
  • 28. Wrap up 1 2 3 Problems with JS JavaScript Patterns Windows 8 CommonJS Spine.js JavaScript Metro Node.js PhoneGap Railway.js QUnit Tobi.js
  • 29. [email protected] Thank you. http://www.kowitz.net @brendankowitz http://hg.kowitz.net/ddd

Editor's Notes

  • #4: Javascript can have a lot of challenges in general
  • #7: Node's goal is to provide an easy way to build scalable network programs.Node tells the operating system that it should be notified when a new connection is made, and then it goes to sleep. If someone new connects, then it executes the callback. Each connection is only a small heap allocation.
  • #15: jQuery gives us a great api and it doesn’t restrict how we can structure out applications, this doesn’t mean that we shouldn’t have a nice structureDon’t use jQuery’s namespace, create your own, be your own app
  • #20: A pure js library that provides the windows metro style for js applicationsProvides the controlsStyle sheets (fonts, margins etc..)Touch interface for win8Helpers, PatternsDesigned for easy toolabilityWinJS is a library not a framework..load whatever pieces you require
  • #21: A pure js library that provides the windows metro style for js applicationsProvides the controlsStyle sheets (fonts, margins etc..)Touch interface for win8Helpers, PatternsDesigned for easy toolabilityWinJS is a library not a framework..load whatever pieces you requirePromises: Provides a mechanism to schedule work to be done on a value that has not yet been computed. It is an abstraction for managing interactions with asynchronous APIs.