Your SlideShare is downloading. ×

Slides

2,139
views

Published on

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,139
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 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´veloppement d’EPITA e Modifiers Parallel Example July 5, 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 Attempts Image Processing Dollar macro Implementation Attempts Extensions Modifiers Dollar macro Parallel Example Extensions Conclusion Modifiers Parallel Example Conclusion2 / 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 Attempts jQuery1 is a [...] JavaScript Library that 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 Image Processing Heavily rely on Method Chaining Implementation Attempts Dollar macro $(”a”) Extensions .addClass(”external”) Modifiers Parallel .attr(”target”, ” blank”) Example .click(function () { /∗ analytics call ∗/ }) Conclusion4 / 19 Christopher Chedeau
  • 5. Chaining Operator in Climb Method Chaining in Javascript function Object() {} It works in any Object Introduction Method Chaining Object.prototype = { Oriented language: jQuery methodA: function () { C++ Method Chaining Extended // do something Climb Java Image Processing return this; Implementation Attempts }, PHP Dollar macro Extensions methodB: function () { C# 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 Extended .eq(1) Climb .parent() Image Processing Implementation Attempts Dollar macro Extensions Modifiers Parallel Example Conclusion6 / 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 Extended .eq(1) Climb .parent() Image Processing Implementation Attempts SQL Query Dollar macro Extensions SQL(”select”) Modifiers Parallel .field(”∗”) 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 Extended .eq(1) Climb .parent() Image Processing Implementation Attempts SQL Query Dollar macro Extensions SQL(”select”) Modifiers Parallel .field(”∗”) 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 Example .opening(8 connectivity) Conclusion .save(”lena opening.png”)7 / 19 Christopher Chedeau
  • 10. Chaining Operator in Climb Straight Common Lisp Implementation Introduction Method Chaining jQuery Method Chaining Common Lisp methods do not belong to classes 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 Conclusion8 / 19 Christopher Chedeau
  • 11. Chaining Operator in Climb Straight Common Lisp Implementation Introduction Method Chaining jQuery Method Chaining Common Lisp methods do not belong to classes 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 times8 / 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 Implementation (load ”lena.jpg”) Attempts Dollar macro ) Extensions ) Modifiers Parallel (8−connectivity)) Example ”lena opening.png”) Conclusion9 / 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 Implementation (load ”lena.jpg”) Attempts Dollar macro ) Extensions ) Modifiers Parallel (8−connectivity)) Example ”lena opening.png”) Conclusion Functions executed last are written first9 / 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 Implementation (load ”lena.jpg”) 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 name9 / 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 Conclusion10 / 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 features10 / 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 Modifiers (action)) Parallel Example Conclusion11 / 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 Modifiers (action)) Parallel Example We introduce the quote ’ modifier Conclusion11 / 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 Conclusion12 / 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 Conclusion12 / 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
  • 22. Chaining Operator in Climb Grouped Actions Image(”lena.png”) Introduction .preprocess() Method Chaining jQuery Method Chaining Extended .background() Climb .fill(red) Image Processing Implementation Attempts Dollar macro Extensions Modifiers .foreground() Parallel .fill(green) Example Conclusion .13 / 19 Christopher Chedeau
  • 23. Chaining Operator in Climb Grouped Actions Image(”lena.png”) [lena] Introduction .preprocess() [lena, proc] Method Chaining jQuery . Method Chaining Extended .background() [lena, proc, background] Climb .fill(red) [lena, proc, background] Image Processing Implementation .end() [lena, proc] Attempts Dollar macro . Extensions Modifiers .foreground() [lena, proc, foreground] Parallel .fill(green) [lena, proc, foreground] Example .end() [lena, proc] Conclusion . Feels more like a hack Hard to know which methods push to the stack Elements in the stack cannot be garbage collected13 / 19 Christopher Chedeau
  • 24. Chaining Operator in Climb Introduction of // Macro ($ (load ”lena.png”) Introduction (preprocess) Method Chaining jQuery Method Chaining Extended (// Climb ((background) Image Processing Implementation (fill red)) Attempts Dollar macro Extensions ((foreground) Modifiers Parallel (fill green)))) Example Conclusion14 / 19 Christopher Chedeau
  • 25. Chaining Operator in Climb Introduction of // Macro ($ (load ”lena.png”) Introduction (preprocess) Method Chaining jQuery Method Chaining Extended (// Climb ((background ) Image Processing Implementation (fill red)) Attempts Dollar macro Extensions ((foreground ) Modifiers Parallel (fill green)))) Example Conclusion Explicit dispatch of the value14 / 19 Christopher Chedeau
  • 26. Chaining Operator in Climb Introduction of // Macro ($ (load ”lena.png”) Introduction (preprocess) Method Chaining jQuery Method Chaining Extended (// Climb ((background) Image Processing Implementation (fill red)) Attempts Dollar macro Extensions ((foreground) Modifiers Parallel (fill green))) Example Conclusion (combine )) Explicit dispatch of the value Last value of branch can be collected14 / 19 Christopher Chedeau
  • 27. Chaining Operator in Climb Example Introduction Method Chaining Otsu Sauvola 1 Sauvola 5 jQuery Method Chaining Extended Climb Image Processing Implementation Attempts Dollar macro Extensions Modifiers Parallel Otsu - Sauvola 1 Otsu - Sauvola 5 Sauvola 1 - 5 Example Conclusion15 / 19 Christopher Chedeau
  • 28. Chaining Operator in Climb Example ($ (load ”lenagray.png”) Introduction Method Chaining jQuery Method Chaining Extended Climb Image Processing Implementation Attempts Dollar macro Extensions Modifiers Parallel Example Conclusion16 / 19 Christopher Chedeau
  • 29. Chaining Operator in Climb Example ($ (load ”lenagray.png”) Introduction (// Method Chaining jQuery Method Chaining Extended Climb Image Processing Implementation Attempts Dollar macro Extensions Modifiers Parallel Example Conclusion16 / 19 Christopher Chedeau
  • 30. Chaining Operator in Climb Example ($ (load ”lenagray.png”) Introduction (// Method Chaining (’(timer−start) jQuery Method Chaining Extended Climb Image Processing Implementation Attempts Dollar macro Extensions Modifiers Parallel Example Conclusion16 / 19 Christopher Chedeau
  • 31. Chaining Operator in Climb Example ($ (load ”lenagray.png”) Introduction (// Method Chaining (’(timer−start) (otsu) jQuery Method Chaining Extended Climb Image Processing Implementation Attempts Dollar macro Extensions Modifiers Parallel Example Conclusion16 / 19 Christopher Chedeau
  • 32. Chaining Operator in Climb Example ($ (load ”lenagray.png”) Introduction (// Method Chaining (’(timer−start) (otsu) jQuery Method Chaining ’(timer−print ”Otsu”) Extended Climb Image Processing Implementation Attempts Dollar macro Extensions Modifiers Parallel Example Conclusion16 / 19 Christopher Chedeau
  • 33. Chaining Operator in Climb Example ($ (load ”lenagray.png”) Introduction (// Method Chaining (’(timer−start) (otsu) jQuery Method Chaining ’(timer−print ”Otsu”) (save ”otsu.png”)) ; $1 Extended Climb Image Processing Implementation Attempts Dollar macro Extensions Modifiers Parallel Example Conclusion16 / 19 Christopher Chedeau
  • 34. Chaining Operator in Climb Example ($ (load ”lenagray.png”) Introduction (// Method Chaining (’(timer−start) (otsu) jQuery Method Chaining ’(timer−print ”Otsu”) (save ”otsu.png”)) ; $1 Extended (’(timer−start) (sauvola (box2d 1)) Climb Image Processing ’(timer−print ”Sauvola 1”) (save ”sauvola1.png”)) ; $2 Implementation Attempts Dollar macro Extensions Modifiers Parallel Example Conclusion16 / 19 Christopher Chedeau
  • 35. Chaining Operator in Climb Example ($ (load ”lenagray.png”) Introduction (// Method Chaining (’(timer−start) (otsu) jQuery Method Chaining ’(timer−print ”Otsu”) (save ”otsu.png”)) ; $1 Extended (’(timer−start) (sauvola (box2d 1)) Climb Image Processing ’(timer−print ”Sauvola 1”) (save ”sauvola1.png”)) ; $2 Implementation Attempts (’(timer−start) (sauvola (box2d 5)) Dollar macro Extensions ’(timer−print ”Sauvola 5”) (save ”sauvola5.png”))) ; $3 Modifiers Parallel Example Conclusion16 / 19 Christopher Chedeau
  • 36. Chaining Operator in Climb Example ($ (load ”lenagray.png”) Introduction (// Method Chaining (’(timer−start) (otsu) jQuery Method Chaining ’(timer−print ”Otsu”) (save ”otsu.png”)) ; $1 Extended (’(timer−start) (sauvola (box2d 1)) Climb Image Processing ’(timer−print ”Sauvola 1”) (save ”sauvola1.png”)) ; $2 Implementation Attempts (’(timer−start) (sauvola (box2d 5)) Dollar macro Extensions ’(timer−print ”Sauvola 5”) (save ”sauvola5.png”))) ; $3 Modifiers Parallel (// Example (#(diff $1 $2) Conclusion16 / 19 Christopher Chedeau
  • 37. Chaining Operator in Climb Example ($ (load ”lenagray.png”) Introduction (// Method Chaining (’(timer−start) (otsu) jQuery Method Chaining ’(timer−print ”Otsu”) (save ”otsu.png”)) ; $1 Extended (’(timer−start) (sauvola (box2d 1)) Climb Image Processing ’(timer−print ”Sauvola 1”) (save ”sauvola1.png”)) ; $2 Implementation Attempts (’(timer−start) (sauvola (box2d 5)) Dollar macro Extensions ’(timer−print ”Sauvola 5”) (save ”sauvola5.png”))) ; $3 Modifiers Parallel (// Example (#(diff $1 $2) (save ”diff1.png”)) Conclusion16 / 19 Christopher Chedeau
  • 38. Chaining Operator in Climb Example ($ (load ”lenagray.png”) Introduction (// Method Chaining (’(timer−start) (otsu) jQuery Method Chaining ’(timer−print ”Otsu”) (save ”otsu.png”)) ; $1 Extended (’(timer−start) (sauvola (box2d 1)) Climb Image Processing ’(timer−print ”Sauvola 1”) (save ”sauvola1.png”)) ; $2 Implementation Attempts (’(timer−start) (sauvola (box2d 5)) Dollar macro Extensions ’(timer−print ”Sauvola 5”) (save ”sauvola5.png”))) ; $3 Modifiers Parallel (// Example (#(diff $1 $2) (save ”diff1.png”)) Conclusion (#(diff $1 $3) (save ”diff2.png”)) (#(diff $2 $3) (save ”diff3.png”))))16 / 19 Christopher Chedeau
  • 39. Chaining Operator in Climb Example ($ (load ”lenagray.png”) Introduction (// Method Chaining (’(timer−start) (otsu) jQuery Method Chaining ’(timer−print ”Otsu”) (save ”otsu.png”)) ; $1 Extended (’(timer−start) (sauvola (box2d 1)) Climb Image Processing ’(timer−print ”Sauvola 1”) (save ”sauvola1.png”)) ; $2 Implementation Attempts (’(timer−start) (sauvola (box2d 5)) Dollar macro Extensions ’(timer−print ”Sauvola 5”) (save ”sauvola5.png”))) ; $3 Modifiers Parallel (// Example (#(diff $1 $2) (save ”diff1.png”)) Conclusion (#(diff $1 $3) (save ”diff2.png”)) (#(diff $2 $3) (save ”diff3.png”)))) ; Otsu: 101ms ; Sauvola 1: 263ms ; Sauvola 5: 3407ms16 / 19 Christopher Chedeau
  • 40. Chaining Operator in Climb Conclusion Introduction Method Chaining Chaining Operator jQuery Method Chaining • Ease of use Extended • Entire API has to be rethought Climb Image Processing Related Work Implementation Attempts Dollar macro • Implementation of two Component Tree Extensions algorithms ([NC04], [BGL+ 07]) Modifiers Parallel • Overhaul of Value representation Example • Rationalization of Site Set interface Conclusion Next Steps • New design patterns from dynamic languages • Explore image processing in the browser17 / 19 Christopher Chedeau
  • 41. Chaining Operator in Climb Questions ? Introduction Method Chaining jQuery Method Chaining Extended Climb Image Processing Implementation Attempts Dollar macro Extensions Modifiers Parallel Example Conclusion18 / 19 Christopher Chedeau
  • 42. Chaining Operator in Climb Bibliography Introduction Christophe Berger, Thierry G´raud, Roland Levillain, e Method Chaining jQuery Nicolas Widynski, Anthony Baillard, and Emmanuel Method Chaining Extended Bertin, Effective component tree computation with Climb application to pattern recognition in astronomical Image Processing Implementation imaging, Proceedings of the IEEE International Attempts Dollar macro Conference on Image Processing (ICIP) (San Extensions Modifiers Antonio, TX, USA), vol. 4, September 2007, Parallel pp. IV–41–IV–44. Example Conclusion L. Najman and M. Couprie, Quasi-linear algorithm for the component tree, IS&T/SPIE Symposium on Electronic Imaging, In Vision Geometry XII, 2004, pp. 18–22.19 / 19 Christopher Chedeau