• Save
5 single page application principles developers need to know
Upcoming SlideShare
Loading in...5
×
 

5 single page application principles developers need to know

on

  • 7,296 views

An Introduction to 5 important principles Web Developers need to understand in order to build modern Single Page Web Applications

An Introduction to 5 important principles Web Developers need to understand in order to build modern Single Page Web Applications

Statistics

Views

Total Views
7,296
Views on SlideShare
7,280
Embed Views
16

Actions

Likes
4
Downloads
0
Comments
0

1 Embed 16

https://twitter.com 16

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

5 single page application principles developers need to know 5 single page application principles developers need to know Presentation Transcript

  • 5 Single Page ApplicationPrinciples Developers Need ToKnowChris Love@ChrisLoveProfessionalASPNET.com
  • Who Am I?ASP.NET MVPASP InsiderInternet Explorer User AgentAuthorSpeakerTweaker, Lover of Mobile Web, JavaScript, CSS & HTML5
  • Podcast InterviewsThe Tablet ShowChris Love Talks Surface Pro, Mobile Development and Morehttp://thetabletshow.com/?ShowNum=80Chris Love Does Enterprise Mobilityhttp://thetabletshow.com/?ShowNum=22Deep Fried BytesMobile Web Is Not What The Other Guys Say It Ishttp://deepfriedbytes.com/podcast/episode-74-mobile-web-is-not-what-the-other-guys-say-it-is/Technology & FriendsTalking About Touch & Mobile Webhttp://bit.ly/12IduAd
  • JavaScript LibrariesDeepTissueJS – A Touch Gesture Abstraction Libraryhttp://deeptissuejs.comPanoramaJS – JavaScript Library to Implement The Windows Phone Panorama Control in HTML5https://github.com/docluv/panoramajsToolbarJS – JavaScript Library to Implement a Mobile AppBar, like Windows Phonehttp://toolbarjs.comComing Soon!SPA – Single Page Application Router, View ManagerBackpack – Markup Manager leveraging LocalStorageFannyPack – Markup Manager leveraging on page markup??????
  • ResourcesSlide Deck – http://www.slideshare.net/docluv <- Only URL UNeed!Source Code – Coming Soon!Live Site - Coming Soon!
  • Brief History of Web Application ArchitectureWay Back in the Dark Ages….Static HTMLCGI/ASP – Enter the Dynamic Web PageASP.NET WebFormsWebServices
  • Brief History of Web Application ArchitectureServerBrowserRequestResponse HTML
  • Hello AJAXAsynchronous JavaScript and XMLBut Don’t Use XMLUse JSONInternet Explorer Introduced xmlHttpRequest objectProvides the Ability to Query the Server W/O Reloading the URLFirst Popularized by Google Maps
  • How AJAX WorksServerBrowserRequestResponse JSON
  • The World Is An API
  • What Is a SPA?Single Page Web ApplicationMeans a More ‘Native Like’ ExperienceHeavy Client-Side Application ModelLoads all Markup ‘on initial load’Tectonic Shift In the Way Web Sites Are Built
  • Principle #1 – Performance MattersHonor the 23 Rules of Web PerformanceUse HTML5 AdvantagesWebStorage Is Your Friend
  • YSlow Rules1. Minimize HTTP Requests2. Use a Content Delivery Network3. Avoid empty src or href4. Add an Expires or a Cache-Control Header5. Gzip Components6. Put StyleSheets at the Top7. Put Scripts at the Bottom8. Avoid CSS Expressions9. Make JavaScript and CSS External10. Reduce DNS Lookups11. Minify JavaScript and CSS12. Avoid Redirects13. Remove Duplicate Scripts14. Configure ETags15. Make AJAX Cacheable16. Use GET for AJAX Requests17. Reduce the Number of DOM Elements18. No 404s19. Reduce Cookie Size20. Use Cookie-Free Domains for Components21. Avoid Filters22. Do Not Scale Images in HTML23. Make favicon.ico Small and Cacheablehttp://yhoo.it/W7BFIw
  • Manage Your Sizehttp://bit.ly/PVlLOC91 Files Requests1.47MB15 JavaScript Files219KB56 Images872KB16 Domains
  • Principle #2 – Things You Did On The Server NowLive in the BrowserOnly one Request for HTML (sort of…)In the BrowserRoutingMarkup ManagementData Caching
  • Please Press #SPAs Reply on the URL hashPrevents the Browser from Requesting URL from ServerGoogle SEO ‘Recommends’ #!_escaped_fragement_ - http://bit.ly/1bFmIQTNeed a Route Management System
  • hashchange Eventwindow.addEventListener("hashchange", function (e) {//swap the View Here});
  • Markup ManagementInsert and Remove HTML on DemandIf(currentView){//insert before current view}else{//inset into the content wrapper}
  • Use WebStorage to Store MarkupKeep HTML Elements To A MinimumUsing localStorage to Storage Markup - http://bit.ly/13qi7R2localStorage.setItem(viewInfo.pageId,JSON.stringify(viewInfo));
  • Demo Time!
  • Principle #3 – Learn a JavaScript Templating LibraryTemplating Libraries Merge Data With MarkupDynamically Create Markup in the BrowserCheck out MicroJS - http://microjs.com/#templateMicro Templates - http://bit.ly/XLhd2xjsRender - http://bit.ly/145wNnSHandleBars * - http://handlebarsjs.com/
  • Using HandlebarsJS<script id="movie-list-template" type="text/x-handlebars-template">{{each}}<div><h1>{{title}}</h1><img src="{{poster}}" alt="{{title}}"/></div>{{/each}}</script>target.innerHTML = Handlebars.compile(template[i].innerHTML)(data);
  • Demo Time!
  • Principle #4 – Use CSS3Use For Modern LayoutsMedia Queries for Responsive Design
  • Get Fancy With AnimationsTransformsTransitionsKey-Frame AnimationsGreat for ‘page’ Transitions
  • Demo Time!
  • Principle #5 – Design With Offline In MindLeverage the AppCacheCreate a Manifest FileDon’t Let it be a Handicaphttp://bit.ly/117q27AMakes Sure Your App Will Work Without ConnectivityGood for Caching Images and ResourcesMakes the Browser look Local Before Going to the Server
  • Demo Time!
  • Dealing With Older BrowsersUPGRADE!!!!!!!
  • Dealing With Older BrowsersDetect Outdated BrowserFake Classic Request-Response