Thursday, February 12, 2009

jquery rocks! now back to GWT

Update: read the followup to this post, Why I left GWT and came crawling back to jquery.
I just finished a project that includes a rich, complex web interface built on jquery, and now it's time to report the good, the bad, and the ugly.

The Good

Certain things can be expressed with incredible succinctness in jquery. In a finished project there are snippets of code sprinkled throughout that really evoke a smile. Certainly other projects have a lot to learn from the expressive power of jquery.

The Bad

One core principle behind jquery is the idea of progressive enhancement; that is, you start with HTML markup that would render reasonably well in a browser even with no javascript enabled. Then you add in some well placed jquery "enhancements" via selectors, plugins, etc. and the page literally comes alive.
The problem is, projects have deadlines. When a business person funds a project, they don't really care if the site runs without javascript enabled. So, in the push to launch the project, the ideals of progressive enhancement quickly fall by the wayside.

The Ugly

In reaching for the ideal of progressive enhancement, jquery performs weakly in one important feature of traditional software engineering: encapsulation. Certainly the code within plugins is encapsulated, but the markup on which those plugins operate is completely exposed. The very power of selectors and plugins for progressively enhancing existing markup are also their downfall: when the markup needs to change for some reason, you must carefully review/debug/bang-your-head-over all the selectors and plugins and the assumptions they made about the markup that are no longer true.

Back to GWT

I'm starting a new project now, and I'll be doing this one on GWT. Is it because GWT is better than jquery? No, that is certainly not true in the general case. To breathe new life into an existing web site, there is perhaps nothing better than jquery. No, I'll be doing this project on GWT because progressive enhancement is not relevant. The ability to encapsulate DOM structures and behavior together, and then refactor wildly (with no fear of breaking carefully crafted selectors and plugins) will be essential to this project. And so it's back to GWT.
Fear not, jquery, my friend. We have built great things together, and there will be other times.






Review and annotate PDF files without Adobe messiness

A technical writer at work sent me a document for review, and told me to use Adobe's commenting tools to annotate it. I open it up in Reader and -- surprise -- there aren't any commenting tools!

I expected this to happen, because it wasn't the first time this had happened to me. Adobe Reader can only annotate PDF documents when the author has enabled specific usage rights. Apparently most technical writers either don't understand this, or they all have the full Adobe Acrobat and simply have never encountered the problem.

The quick solution: grab PDF-XChange Viewer (which allows mere mortals to annotate any PDF document), and leave the Adobe mess for someone else.

p.s. the small "portable" version includes all the commenting tools (second Download button in the link above, as of this writing) ... not sure why the full version is so much bigger.