chaining operator in climb
play

Chaining Operator in Climb Method Chaining jQuery Method Chaining - PowerPoint PPT Presentation

Chaining Operator in Climb Introduction Chaining Operator in Climb Method Chaining jQuery Method Chaining Extended Climb Christopher Chedeau Image Processing Implementation Attempts Dollar macro LRDE Extensions Laboratoire de


  1. Chaining Operator in Climb Introduction Chaining Operator in Climb Method Chaining jQuery Method Chaining Extended Climb Christopher Chedeau Image Processing Implementation Attempts Dollar macro LRDE Extensions Laboratoire de Recherche et D´ eveloppement d’EPITA Modifiers Parallel Example July 3, 2011 Conclusion http://lrde.epita.fr/ 1 / 19 Christopher Chedeau

  2. Chaining Operator in Climb Introduction Method Chaining Introduction jQuery Method Chaining Method Chaining jQuery Method Chaining Extended Extended Climb Climb Image Processing Implementation Image Processing Attempts Dollar macro Implementation Attempts Extensions Modifiers Dollar macro Parallel Example Extensions Conclusion Modifiers Parallel Example Conclusion 2 / 19 Christopher Chedeau

  3. Chaining Operator in Climb jQuery ◮ Old browsers are full of compatibility issues Introduction Method Chaining jQuery Method Chaining Extended Climb Image Processing Implementation jQuery 1 is a [...] JavaScript Library that Attempts Dollar macro Extensions simplifies HTML document traversing Modifiers Parallel Example Conclusion 1 http://jquery.com/ 3 / 19 Christopher Chedeau

  4. Chaining Operator in Climb Method Chaining Introduction Method Chaining jQuery Method Chaining Extended ◮ Intuitive API Climb ◮ Heavily rely on Method Chaining Image Processing Implementation Attempts Dollar macro $(”a”) Extensions .addClass(”external”) Modifiers Parallel .attr(”target”, ” blank”) Example .click( function () { / ∗ analytics call ∗ / } ) Conclusion 4 / 19 Christopher Chedeau

  5. Chaining Operator in Climb Method Chaining in Javascript It works in any Object Introduction function Object() {} Method Chaining Object.prototype = { Oriented language: jQuery methodA: function () { Method Chaining ◮ C++ Extended // do something Climb ◮ Java Image Processing return this ; Implementation ◮ PHP Attempts } , Dollar macro ◮ C# Extensions methodB: function () { Modifiers Parallel // do something ◮ ... Example return this ; Conclusion } } ; var obj = new Object(); obj.methodA().methodB(); 5 / 19 Christopher Chedeau

  6. Chaining Operator in Climb Extended Chaining ◮ HTML Document Traversing Introduction $(”li”) // li: List Item Method Chaining jQuery .has(”ul”) // ul: Unordered List Method Chaining .eq(1) Extended Climb .parent() Image Processing Implementation Attempts Dollar macro Extensions Modifiers Parallel Example Conclusion 6 / 19 Christopher Chedeau

  7. Chaining Operator in Climb Extended Chaining ◮ HTML Document Traversing Introduction $(”li”) // li: List Item Method Chaining jQuery .has(”ul”) // ul: Unordered List Method Chaining .eq(1) Extended Climb .parent() Image Processing Implementation ◮ SQL Query Attempts Dollar macro Extensions SQL(”select”) Modifiers .field(” ∗ ”) Parallel Example .table(”users”) Conclusion .limit(10) 6 / 19 Christopher Chedeau

  8. Chaining Operator in Climb Extended Chaining ◮ HTML Document Traversing Introduction $(”li”) // li: List Item Method Chaining jQuery .has(”ul”) // ul: Unordered List Method Chaining .eq(1) Extended Climb .parent() Image Processing Implementation ◮ SQL Query Attempts Dollar macro Extensions SQL(”select”) Modifiers .field(” ∗ ”) Parallel Example .table(”users”) Conclusion .limit(10) ◮ Asynchronous Tasks $(” < div/ > ”) .fetch(”navigation.html”) // Asynchronous .addClass(”column”) .appendTo(”#side”) 6 / 19 Christopher Chedeau

  9. Chaining Operator in Climb Image processing Introduction Method Chaining jQuery Method Chaining ◮ Image processing chains can be expressed through Extended Climb method chaining Image Processing Implementation Attempts Image(”lena.jpg”) Dollar macro .togray() Extensions Modifiers .otsu() Parallel .opening(8 connectivity) Example Conclusion .save(”lena opening.png”) 7 / 19 Christopher Chedeau

  10. Chaining Operator in Climb Straight Common Lisp Implementation Introduction Method Chaining jQuery ◮ Common Lisp methods do not belong to classes Method Chaining Extended Climb (let ((img (load ”lena.jpg”))) Image Processing Implementation (setf img (togray img)) Attempts Dollar macro (setf img (otsu img)) Extensions (setf img (opening img (8-connectivity))) Modifiers Parallel (save img ”lena opening.png”)) Example Conclusion 8 / 19 Christopher Chedeau

  11. Chaining Operator in Climb Straight Common Lisp Implementation Introduction Method Chaining jQuery ◮ Common Lisp methods do not belong to classes Method Chaining Extended Climb (let ((img (load ”lena.jpg”))) Image Processing Implementation (setf img (togray img)) Attempts Dollar macro (setf img (otsu img)) Extensions (setf img (opening img (8-connectivity))) Modifiers Parallel (save img ”lena opening.png”)) Example Conclusion ◮ The temporary variable is written 8 times 8 / 19 Christopher Chedeau

  12. Chaining Operator in Climb Without Temporary Variable Introduction (save Method Chaining (opening jQuery Method Chaining (otsu Extended Climb (togray Image Processing (load ”lena.jpg”) Implementation Attempts Dollar macro ) Extensions ) Modifiers Parallel (8 − connectivity)) Example ”lena opening.png”) Conclusion 9 / 19 Christopher Chedeau

  13. Chaining Operator in Climb Without Temporary Variable Introduction (save Method Chaining (opening jQuery Method Chaining (otsu Extended Climb (togray Image Processing (load ”lena.jpg”) Implementation Attempts Dollar macro ) Extensions ) Modifiers Parallel (8 − connectivity)) Example ”lena opening.png”) Conclusion ◮ Functions executed last are written first 9 / 19 Christopher Chedeau

  14. Chaining Operator in Climb Without Temporary Variable Introduction (save Method Chaining (opening jQuery Method Chaining (otsu Extended Climb (togray Image Processing (load ”lena.jpg”) Implementation Attempts Dollar macro ) Extensions ) Modifiers Parallel (8 − connectivity)) Example ”lena opening.png”) Conclusion ◮ Functions executed last are written first ◮ Arguments are far away from function name 9 / 19 Christopher Chedeau

  15. Chaining Operator in Climb Introduction of Dollar $ Macro Dollar $ Macro Method Chaining Introduction Method Chaining ($ (load ”lena.jpg”) Image(”lena.jpg”) jQuery Method Chaining (togray) .togray() Extended Climb (otsu) .otsu() Image Processing (opening 8 − connectivity) .opening(8 connectivity) Implementation Attempts Dollar macro (save ”lena opening.png”)) .save(”lena opening.png”) Extensions Modifiers Parallel Example ◮ It takes a sequence of actions Conclusion 10 / 19 Christopher Chedeau

  16. Chaining Operator in Climb Introduction of Dollar $ Macro Dollar $ Macro Method Chaining Introduction Method Chaining ($ (load ”lena.jpg”) Image(”lena.jpg”) jQuery Method Chaining (togray ) .togray() Extended Climb (otsu) .otsu() Image Processing (opening 8 − connectivity) .opening(8 connectivity) Implementation Attempts Dollar macro (save ”lena opening.png”)) .save(”lena opening.png”) Extensions Modifiers Parallel Example ◮ It takes a sequence of actions Conclusion ◮ The result of each action is passed as first argument on the next ◮ Rewritten either with or without temporary variable ◮ Can express all the method chaining features 10 / 19 Christopher Chedeau

  17. Chaining Operator in Climb Modifiers Introduction Method Chaining jQuery Method Chaining Extended ◮ Not everything fits in the chaining pattern Climb Image Processing Implementation ($ (action) Attempts Dollar macro ’(print ”Something”) Extensions (action)) Modifiers Parallel Example Conclusion 11 / 19 Christopher Chedeau

  18. Chaining Operator in Climb Modifiers Introduction Method Chaining jQuery Method Chaining Extended ◮ Not everything fits in the chaining pattern Climb Image Processing Implementation ($ (action) Attempts Dollar macro ’(print ”Something”) Extensions (action)) Modifiers Parallel Example ◮ We introduce the quote ’ modifier Conclusion 11 / 19 Christopher Chedeau

  19. Chaining Operator in Climb Modifiers ◮ Normal behavior Introduction (before) Method Chaining jQuery (action arg) Method Chaining Extended (after ) Climb Image Processing Implementation Attempts Dollar macro Extensions Modifiers Parallel Example Conclusion 12 / 19 Christopher Chedeau

  20. Chaining Operator in Climb Modifiers ◮ Normal behavior Introduction (before) Method Chaining jQuery (action arg) Method Chaining Extended (after ) Climb Image Processing ◮ Quote ’ Modifier Implementation Attempts Dollar macro (before) $1, $2 ... Extensions Modifiers ’(action arg $1) Parallel (after ) Example Conclusion 12 / 19 Christopher Chedeau

  21. Chaining Operator in Climb Modifiers ◮ Normal behavior Introduction (before) Method Chaining jQuery (action arg) Method Chaining Extended (after ) Climb Image Processing ◮ Quote ’ Modifier Implementation Attempts Dollar macro (before) $1, $2 ... Extensions Modifiers ’(action arg $1) Parallel (after ) Example Conclusion ◮ Sharp # Modifier (before) $1, $2 ... #(action arg $1) (after ) 12 / 19 Christopher Chedeau

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