Web Info & Tutorials

December 7th, 2007

GWT CONFERENCE: VOICES THAT MATTER SUMMARY

So I’ve been blogging all this week from the Voices That Matter: Google Web Toolkit Conference. For those who requested a summary of my posts on various sessions, they are…

Really, there were three highlights of the conference for me, two of them reminders, and one of them a surprise.

  1. GWT is a compiler. Let me amplify: it is a compiler, not just a Java to JavaScript converter. It inlines methods, removes dead code, optimizes loops, all those things that a compiler can and should do. And if you play by the GWT rules, you will not leak memory. Want a faster, smaller app? Wait 3 months and recompile with the newest version. Eventually, the compiler will produce better, more efficient JavaScript than you can produce by hand.
  2. The security concerns for GWT are the same as for all sophisticated Ajax applications: the more state and control logic you put in the client, the more you open yourself up to really nasty attacks. In a sense, the fact that GWT makes writing sophisticated client side code so easy and obscures which Java code is in the client and which in the server, it can increase the potential for making these mistakes.
  3. The surprise? The conference was not attended by that many GWT newbies or web developers looking to bring their Struts apps into the Ajax light. A show of hands brought home the fact that the audience consisted of mostly folks with Swing/AWT/SWT experience (though they also worked with webapps).

This last item made this the most unusual conference I have attended. Usually, when a technology is barely a year old, you expect the first conference to consist of newbies listening to the vendor and a few select clients talk about the technology and their early adopter experiences. If any of the attendees have written apps of their own, they suffer from all of the "version 1 on a new technology" problems, i.e. in version one you don’t have your model quite right, your UI is a bit off and fighting with your model, and you’ve brought other, inappropriate platform idioms to the new technology. With version 2 you fix all of the version 1 problems and introduce a bunch of new ones. With version 3 your model is pretty good and in harmony with your UI and you’ve started to introduce some framework code that makes you more productive.

Well, the folks at the conference were already past version 3 on some pretty slick desktop apps, and the resulting ports to GWT had even the GWT team scratching their heads and saying "wow, I didn’t know you could do that with a browser."

All in all, a very promising start to a conference. If year 2 improves on year 1 and adds a few more tool vendors, as I expect it will, I will definitely attend.

December 7th, 2007

COMET. NOT AS PAINFUL AS YOU THINK!

Simon Willison was worried that the amount of complexity involved with Comet meant it was out of bounds to all but the most dedicated JavaScript hackers but after playing with it, concluded:

I’m pleased to admit that I was wrong: Comet is probably about 90% of the way to being usable for mainstream projects, and the few remaining barriers (Bayeux authentication chief amongst them) are likely to be solved before too long. I expect to see many more sites start deploying Comet powered features over the next twelve months.

For Simon's presentation he built the slideshow itself as a Comet app. He could move the slideshow forwards and backwards, and anyone connected would also see the slides move. A nice touch. He used Jetty as the web server, and Dojo as the client:

JAVASCRIPT:
  1.  
  2. dojo.require("dojox.cometd");
  3. jQuery(function($) {
  4.     dojox.cometd.init("http://example.com/cometd");
  5.     dojox.cometd.subscribe("/slideshow/change", function(comet) {
  6.         $('#currentSlide').attr('src', comet.data.src);
  7.     });
  8. });
  9.  
  10. function publishSlide(src) {
  11.     dojox.cometd.publish("/slideshow/change", {
  12.         'src': src
  13.     });
  14. }
  15.  

December 7th, 2007

TAKING A PEAK AT HTML 5

Lachlan Hunt has taken some time to walk us through some of the HTML 5 features that relate to new markup.

Work on HTML 5, which commenced in 2004, is currently being carried out in
a joint effort between the
W3C HTML
WG
and
the WHATWG.
Many key players are participating in the W3C effort including representatives
from the four major browser vendors: Apple, Mozilla, Opera, and Microsoft;
and a range of other organizations and individuals with many diverse interests
and expertise.

Note that the
specification
is still a work in progress and quite a long
way from completion. As such, it is possible that any feature discussed in
this article may change in the future. This article is intended to provide
a brief introduction to some of the major features as they are in the current
draft.

Take a look at the structure of HTML docs to come. No more div-hell:

Bloggers will be able to use the new article tag:

HTML:
  1.  
  2. <article id="comment-2">
  3.   <header>
  4.     <h4><a href="#comment-2" rel="bookmark">Comment #2</a>
  5.         by <a href="http://example.com/">Jack O'Niell</a></h4>
  6.     <p><time datetime="2007-08-29T13:58Z">August 29th, 2007 at 13:58</time>
  7.   </p></header>
  8.   <p>That's another great article!</p>
  9. </article>
  10.  

And in general, Lachlan walks through how the pieces work together, including the video and audio tags.

December 7th, 2007

MAKING SURE YOU GET NEW INSTANCES IN JAVASCRIPT

John Resig has posted on simple collection instantiation, which delves into the filthy lowercase fault that grouping crapper separate into:

JAVASCRIPT:

  1.  
  2. var foo = User(); // forgot to ingest the "new" operator
  3.  

The illusion “new” changes the scoping, allowing “this” to do the correct thing. Evangelist walks finished an example, and then makes a generic solution:

JAVASCRIPT:

  1.  
  2.  
  3. // makeClass - By Evangelist Resig (MIT Licensed)
  4. function makeClass(){
  5.   return function(args){
  6.     if ( this instanceof arguments.callee ) {
  7.       if ( typeof this.init == “function” )
  8.         this.init.apply( this, args );
  9.     } else
  10.       return new arguments.callee( arguments );
  11.   };
  12. }
  13.  
  14. var User = makeClass();
  15. User.prototype.init = function(first, last){
  16.   this.name = prototypal + ” “ + last;
  17. };
  18. var individual = User(“John”, “Resig”);
  19. user.name
  20. // => "John Resig"
  21.