data binding
play

DATA BINDING Client-side View of Data Client Server MY BLOG This - PowerPoint PPT Presentation

CS 498RK FALL 2016 DATA BINDING Client-side View of Data Client Server MY BLOG This is my first post. ADD POST API DATABASE MY BLOG 02/23/15 This is my first post. NEW POST Client Server MY BLOG This is my first post. ADD POST


  1. CS 498RK FALL 2016 DATA BINDING Client-side View of Data

  2. Client Server MY BLOG This is my first post. ADD POST API DATABASE MY BLOG 02/23/15 This is my first post. NEW POST

  3. Client Server MY BLOG This is my first post. ADD POST API DATABASE MY BLOG ? 02/23/15 This is my first post. NEW POST How is data being sent/received?

  4. Http

  5. HTTP Hypertext Transfer Protocol request-response protocol sent using TCP/IP sockets More details in “all about applying verbs to nouns” Socket lecture nouns: resources ( i.e., concepts) verbs: GET, POST, PUT, DELETE web.archive.org/web/20130116005443/http://tomayko.com/writings/rest-to-my-wife

  6. URL Uniform Resource Locator type of URI (Identifier) specifies the location of a resource on a network server responds with representations of resources and not the resources themselves Rest lecture web.archive.org/web/20130116005443/http://tomayko.com/writings/rest-to-my-wife

  7. URL ANATOMY moz.com/blog/solving-the-subdomain-equation-predicting-tra ff ic-and-value-when-merging-subdomains

  8. LOADING A PAGE IN A BROWSER representations of resources Browser HTML Other Resources cforms.js http://creativecommons.org creativecommons.css //Collapse Functions <a><span id="home- button"> http:/ /creativecommons.org String.prototype.tri </span></a> topbar #home-button{ function() { position: relative; HTTP GET HTTP GET <div id="logo"> return float: left; cc-logo.png <span> display: block; this.replace} Creative Commons height: 40px; </span> width: 150px; </div> } Document Object Model (DOM) #logo span topbar span { float: left; display: block; body img height: 40px; Rendered Page width: 150px; cursor: ul pointer; z-index: 1; top: 0;

  9. HTTP Request method url version GET /index.html HTTP/1.1 Host: www.example.com User-Agent: Mozilla/5.0 Accept: text/xml,application/ xml,application/xhtml+xml,text/html*/* request headers Accept-Language: en-us Accept-Charset: ISO-8859-1,utf-8 Connection: keep-alive <blank line> en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Example_session

  10. vs GET POST upload data from the browser retrieve representations of to server resources returns information from the no side e ff ects server no data in request body side e ff ects are likely data contained in request body

  11. HTTP Response version status code text explanation HTTP/1.1 200 OK Date: Mon, 23 May 2005 22:38:34 GMT Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux) response headers Content-Type: text/html; charset=UTF-8 Content-Length: 131 <!DOCTYPE html> <html> content … </html> en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Example_session

  12. HTTP Response HTTP/1.1 200 OK Date: Mon, 23 May 2005 22:38:34 GMT Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux) Content-Type: text/html; charset=UTF-8 Content-Length: 131 MIME Type <!DOCTYPE html> <html> … </html> en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Example_session

  13. HTTP STATUS CODES moz.com/learn/seo/http-status-codes

  14. More details in HTTPS Security lecture request and response messages are transmitted securely using encryption

  15. Ajax

  16. AJAX Asynchronous JavaScript and XML send and receive data without reloading page Before, every user interaction required the complete page to be reloaded

  17. AJAX Issue HTTP request to the server from Javascript Process response with Javascript in the browser

  18. AJAX TECHNOLOGIES HTML and CSS DOM XML XMLHttpRequest object JavaScript

  19. JSON AJAX doesn’t require XML JSON has become de facto standard data interchange format lightweight and simple format types: Number, String, Boolean, Array, Object, null objects are key/value pairs

  20. JSON CODE EXAMPLE { “camelids”: [ { “name”: “llama”, Look familiar? “height”: 1.8 }, { “name”: “alpaca”, “height”: 0.9 } ] }

  21. XMLHttpRequest var xhr = new XMLHttpRequest(); xhr.onreadystatechange = xhrHandler; xhr.open('get', 'llama.json'); xhr.send(null); http://www.w3.org/TR/XMLHttpRequest/

  22. XMLHttpRequest function xhrHandler() { if (xhr.readyState == 4 && xhr.status == 200) { var data = JSON.parse(xhr.responseText); myFunction(data); } }; CODEPEN

  23. AJAX CHALLENGES URL fragment hard to go back to a particular state identifier content retrieved by AJAX not easily indexable The same origin policy prevents some Ajax techniques from being used across domains JSONP callback-style programming is hard to maintain/test

  24. Client-side Templating

  25. TEMPLATES common way to generate dynamic HTML for multi-page web sites and apps separation of markup and data (content)

  26. SERVER-SIDE TEMPLATES server puts HTML and data together and sends it to the browser platforms like Rails, PHP, JSP http://www.w3.org/TR/XMLHttpRequest/

  27. CLIENT-SIDE TEMPLATES AngularJS browser receives HTML and data and puts it together server serves templates and data required by the templates made popular by AJAX

  28. Model View Controller

  29. MODEL VIEW CONTROLLER (MVC) introduced in 1970s as part of SmallTalk popular in desktop UI development (C++, Java) more recently introduced to the Web mental model makes it easier to extend, maintain, and test apps

  30. MODEL VIEW CONTROLLER (MVC) Separation between Model managing data Controller application logic View presenting the data

  31. MODEL VIEW CONTROLLER (MVC) state change Model Controller state and update user interaction notifications View

  32. MVC CHALLENGE non-trivial to get the data into the correct state, both in the View and in the Model

  33. Data Binding

  34. Just declare mapping between View and Model and have them sync automatically ?

  35. DATA BINDING automatically keep state in View and Model in sync frameworks provide sca ff olding to eliminate a lot of code

  36. EXAMPLE View Model MY BLOG blog blog.posts This is my first post.

  37. MENTAL MODEL Binding Target Binding Source Dependency Object Object Dependency Property Property Binding Object

  38. MENTAL MODEL OneWay Dependency Object Object TwoWay Dependency Property Property OneWayToSrc

  39. NEXT CLASS: ANGULARJS courses.engr.illinois.edu/cs498rk1/

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend