understanding javascript
play

Understanding JavaScript Event-Based Interactions Saba Alimadadi - PowerPoint PPT Presentation

Understanding JavaScript Event-Based Interactions Saba Alimadadi Sheldon Sequeira Ali Mesbah Karthik Pattabiraman Motivation JavaScript Widely used, very popular Event driven, dynamic, asynchronous Difficult to understand the


  1. Understanding JavaScript Event-Based Interactions Saba Alimadadi Sheldon Sequeira Ali Mesbah Karthik Pattabiraman

  2. Motivation • JavaScript – Widely used, very popular – Event driven, dynamic, asynchronous • Difficult to understand the dynamic behavior and the control flow – Lower level events – Their interactions 1 !

  3. Challenge 1: Event Propagation html b a r() t r igge r ed head body body P div div a div p ! p f oo () t r igge r ed table h1 table q uy () t r igge r ed caption tr U se r td td b a{ () t r igge r ed C lick button label input table textarea button b a r() t r igge r ed 2 !

  4. Challenge 2: Asynchronous Events Timeout for page expiry Server request for login Server response for login U se r logs in 3 !

  5. Challenge 2: Asynchronous Events Timeout for page expiry Server request for login Server response for login V ie w galle r y Server request Server request Server response Server response 3 !

  6. Challenge 2: Asynchronous Events Timeout for page expiry Server request for login Server response for login Server request V ie w slidesho w Server request Server response Server response Timeout for next image 3 !

  7. Challenge 2: Asynchronous Events Timeout for page expiry Server request for login Server response for login Server request Server request Server response Server response Timeout for next image Server request image Server response Timeout callback Timeout callback page expiry 3 !

  8. Challenge 3: DOM State function submissionHandler(e) { ! $('#regMsg').html("Submitted!"); html var email = $('#email').val(); ! if (isEmailValid(email)) { ! informServer(email); ! head Body $('#submitBtn').attr("disabled", true); } ! } ! P div a srvrMsg . . . ! function informServer(email) { ! p regMsg div $.get('/register/', { email } , function(data) { $(’#srvrMsg').append(data); caption form }); ! } ! label input submitBtn 5 !

  9. Summary of Challenges • Event propagation • Asynchronous events • Implications of events 6 !

  10. Approach JavaScript Trace Transformation Collection Model Behavioral Visualization Model Creation 7 !

  11. JavaScript Transformation • Interposing on DOM events JavaScript • Capturing timeouts and XHRs Transformation • Recording function traces Trace Collection • Extracting DOM mutations Model Creation Model Visualization 8 !

  12. Trace Collection • Interposing on DOM events JavaScript • Capturing timeouts and XHRs Transformation • Recording function traces Trace Collection • Extracting DOM mutations DOM events Model Creation functions => Detailed Trace timeouts Model XHRs Visualization DOM mutations 9 !

  13. Behavioral Model Creation • Customized graph JavaScript Transformation • Nodes: episodes Trace Collection • Links: temporal and causal Model Creation Model Visualization 10 !

  14. Model: Episodes Source Source Trace Trace Source Trace DOM Event XHR Event Submission isEmail inform Timing Event Anonymous Anonymous clearMsg Handler Valid Server (Click) (Response) (TO Callback) e data Target: SubmitBtn email XHR ID: 1 TO ID: 1 Result Result Result email body body body fieldset fieldset fieldset text input text input text input button div button div button div XHR ID: 1 Timeout ID: 1 – A period of JavaScript execution – Start and end points 11 !

  15. Model: Links Source Source Trace Trace Source Trace DOM Event XHR Event Submission isEmail inform Timing Event Anonymous Anonymous clearMsg Handler Valid Server (Click) (Response) (TO Callback) e data Target: SubmitBtn email XHR ID: 1 TO ID: 1 Result Result Result email body body body fieldset fieldset fieldset text input text input text input button div button div button div XHR ID: 1 Timeout ID: 1 emporal ausal 12 !

  16. Model: Story Source Source Trace Trace Source Trace DOM Event XHR Event Submission isEmail inform Timing Event Anonymous Anonymous clearMsg Handler Valid Server (Click) (Response) (TO Callback) e data Target: SubmitBtn email XHR ID: 1 TO ID: 1 Result Result Result email body body body fieldset fieldset fieldset text input text input text input button div button div button div XHR ID: 1 Timeout ID: 1 13 !

  17. Visualization: Overview JavaScript Transformation Trace Collection Model Creation Model Visualization 14 !

  18. Visualization: Zoom Level 1 15 !

  19. Visualization: Zoom Level 1 Visualization: Zoom Level 2 ! 1 !

  20. Implementation • Clematis https://github.com/saltlab/clematis • Languages: Java, JavaScript • Transform JavaScript & inject toolbar via proxy • Provide a RESTful API for retrieving data • Render a web-based visualization 17 !

  21. Usage Scenario 18 !

  22. Usage Scenario 18 !

  23. Usage Scenario 18 !

  24. Usage Scenario 18 !

  25. Evaluation RQ1) Does using Clematis decrease the task completion duration for web application comprehension? RQ2) Does using Clematis increase the task completion accuracy for web application comprehension? RQ3) Are there any certain categories of tasks for which Clematis improves the performance most? 19 !

  26. Industrial Controlled Experiment • Participants – 20 software developers (from a large SW company) – Experimental group: Clematis – Control group: Chrome, Firefox & Firebug • Procedure – 5 minute tutorial on Clematis – Tasks: control flow, feature location, DOM mutations, … • Data collection – Task completion duration & accuracy 20 !

  27. Results: Duration Average Time (mm:ss) Per Task Task ! Clematis ! Other ! T1 ! 7:00 ! << ! 11:27 ! (39% ! ) ! T2 ! 3:51 ! << ! 7:27 ! (48% ! ) ! T3 ! 2:02 ! << ! 6:18 ! (68% ! ) ! T4 ! 2:44 ! < ! 4:00 ! (32% ! ) ! Average Time (mm:ss) in Total Task ! Clematis ! Other ! All ! 15:37 ! << ! 29:12 ! (47% ! ) ! 21 !

  28. Results: Accuracy Average Accuracy (%) Per Task Task ! Clematis ! Other ! T1 ! 84 ! >> ! 28 ! (67% ! ) ! T2 ! 97 ! >> ! 57 ! (41% ! ) ! T3 ! 100 ! > ! 80 ! (20% ! ) ! T4 ! 95 ! >> ! 30 ! (68% ! ) ! Average Accuracy (%) in Total Task ! Clematis ! Other ! All ! 90 ! >> ! 35 ! (61% ! ) ! 22 !

  29. Results Duration Accuracy Task ! Improvement ! Task ! Improvement ! T1 ! (39% ! ) ! T1 ! (67% ! ) ! T2 ! (48% ! ) ! T2 ! (41% ! ) ! T3 ! (68% ! ) ! T3 ! (20% ! ) ! T4 ! (68% ! ) ! T4 ! (32% ! ) ! Task ! Description ! T1 ! Following control flow in presence of asynchronous events ! T2 ! Finding DOM mutations caused by a DOM event ! T3 ! Locating the implementation of a malfunctioning feature ! T4 ! Detecting control flow in presence of event propagation ! 23 !

  30. 16:40 25:00 33:20 41:40 50:00 0:00 8:20 T7 − Ctrl T7 − Exp Consistent Performance Duration (mm:ss) T8 − Ctrl T8 − Exp Duration (mm:ss) T9 − Ctrl T9 − Exp T10 − Ctrl ● T10 − Exp Total − Ctrl ● Total − Exp 0 20 40 60 80 100 T1 − Ctrl ● T1 − Exp ● ● T2 − Ctrl Accuracy (%) T2 − Exp ● Accuracy (%) T3 − Ctrl ● T3 − Exp T4 − Ctrl ● ● T4 − Exp ● Total − Ctrl ● Total − Exp 24 !

  31. 1 !

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