Your SlideShare is downloading. ×
Dojo Confessions
Rebecca Murphey @rmurphey Developer Day 2010, Durham, NC
2007                                                         I
                                                           ...
+   +
2009
Classes & Inheritance
Abstract APIs
for Common Tasks
“Templating makes your
              life so much
       ${yourStringHere}!”



Templates + Caching
+ String Interning
Consistency
across Components
Dependency
Management &
Build Tools
Backcompat Guarantee
Room to Grow
B u t I
       u e ry!!1 !
    jQ
DISCLAIMER: This presentation contains a comparison of toys. In the pursuit of fairness,...
jQuery
Dojo
$(function(){
    loadImages("interesting");

      $("#sidebar h1").click(function(){
          setTag(this);
      });

...
dojo.provide('Flickr.SearchTerm');

dojo.require('dijit._Widget');
dojo.require('dijit._Templated');
dojo.require('dojox.d...
omg wtf?
“It’s just JavaScript.”
– Peter Higgins, Dojo project lead
• dflick: evolving flickr tag search fun
• transformers: pub/sub deathmatch
I STI
               LL
          jQuer
                y!




Tell me more!
• twitterverse example app (github.com/
  phiggins42/twitterverse/)


• Dojo: The Definitive Guide (OʼReilly)
• docs.dojoca...
jQ ue  ry
I
    EVER !!1!
  4
• JavaScript MVC (esp. Controller)
• Custom events
• jQuery pub/sub

• pinboard.in/u:rmurphey/t:code-org/
Thanks.



www.rebeccamurphey.com
@rmurphey
http://pinboard.in/u:rmurphey/t:dojo/
Dojo Confessions
Dojo Confessions
Dojo Confessions
Upcoming SlideShare
Loading in...5
×

Dojo Confessions

3,734

Published on

I’ve been using, teaching, and evangelizing about jQuery for years. The library's simplicity is seductive; after a while, it kind of writes itself. So why did I venture into the unknown world of Dojo for a recent project? Find out what I learned about JavaScript code organization, inheritance, dependency management, and more in a whirlwind beginner's tour of a toolkit that answers some of the big questions surrounding JavaScript development.

Published in: Technology, Sports
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,734
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Transcript of "Dojo Confessions"

  1. 1. Dojo Confessions Rebecca Murphey @rmurphey Developer Day 2010, Durham, NC
  2. 2. 2007 I jQuer y! “Youʼll wonder why you ever considered another library.” – “Choosing jQuery,” blog.rebeccamurphey.com, December 3, 2007
  3. 3. + +
  4. 4. 2009
  5. 5. Classes & Inheritance
  6. 6. Abstract APIs for Common Tasks
  7. 7. “Templating makes your life so much ${yourStringHere}!” Templates + Caching + String Interning
  8. 8. Consistency across Components
  9. 9. Dependency Management & Build Tools
  10. 10. Backcompat Guarantee
  11. 11. Room to Grow
  12. 12. B u t I u e ry!!1 ! jQ DISCLAIMER: This presentation contains a comparison of toys. In the pursuit of fairness, we have included only toys that are members of the Toy Hall of Fame. The following slides are not meant to disparage or celebrate any particular toy in any particular way. No JavaScript libraries have been hurt in the performance of this presentation. We hope.
  13. 13. jQuery
  14. 14. Dojo
  15. 15. $(function(){ loadImages("interesting"); $("#sidebar h1").click(function(){ setTag(this); }); $("a#addlist").click(function(){ this.blur(); var tagname = prompt("Enter a tag to search Flickr for photos.",""); if (!tagname) return; $("div#sidebar") .append("<h1>"+tagname+"</h1>") .find("h1:last-child") .click(function(){ setTag(this); }); setTag($("div#sidebar h1:last-child")); }); $("a#removelist").click(function(){ jQuery: Node-focused this.blur(); if ($("div#sidebar h1.active").text() == "Interesting Photos") return; $("div#sidebar h1.active").remove(); setTag($("div#sidebar h1:last-child")); }); }); function loadImages(tag){ $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags="+tag +"&tagmode=any&format=json&jsoncallback=?", function(data){ $.each(data.items, function(i,item){ img = new Image(); img.src = item.media.m;
  16. 16. dojo.provide('Flickr.SearchTerm'); dojo.require('dijit._Widget'); dojo.require('dijit._Templated'); dojo.require('dojox.data.FlickrRestStore'); dojo.declare('Flickr.SearchTerm', [ dijit._Widget, dijit._Templated ], { templateString : '<h1>${term}</h1>', store : new dojox.data.FlickrRestStore(), constructor : function(config) { this.term = config.term; }, postCreate : function() { // listen for instructions to show the term d.subscribe('/term/show', this, '_show'); // send instructions to show the term when clicked this.connect(this.domNode, 'click', function() { d.publish('/term/show', [ this.term ]); Dojo: Component-focused }); }, _show : function(term) { // we can receive /term/show messages from any SearchTerm. // look to see if this one is related to this SearchTerm; // if not, set this SearchTerm as inactive if (term != this.term) { this.active = false; dojo.removeClass(this.domNode, 'active'); return;
  17. 17. omg wtf?
  18. 18. “It’s just JavaScript.” – Peter Higgins, Dojo project lead
  19. 19. • dflick: evolving flickr tag search fun • transformers: pub/sub deathmatch
  20. 20. I STI LL jQuer y! Tell me more!
  21. 21. • twitterverse example app (github.com/ phiggins42/twitterverse/) • Dojo: The Definitive Guide (OʼReilly) • docs.dojocampus.org • api.dojotoolkit.org • the code!
  22. 22. jQ ue ry I EVER !!1! 4
  23. 23. • JavaScript MVC (esp. Controller) • Custom events • jQuery pub/sub • pinboard.in/u:rmurphey/t:code-org/
  24. 24. Thanks. www.rebeccamurphey.com @rmurphey http://pinboard.in/u:rmurphey/t:dojo/

×