AOL has been generously hosting builds of the toolkit in their CDN for some time, but using these builds has always seemed scary. Configuring local and remote copies of the same thing hardly seems like fun. Also, lots of people ask us for a way to "just include one file to get Dojo". It's an obvious thing to do, and it turns out the cross-domain infrastructure that AOL donated is the perfect solution to both problems!
In response to Amit Green's excellent suggestion, I've constructed a couple of very small "wrapper" files that will let you include the "Ajax" build of Dojo from various versions through the cross-domain loader. Including the latest stable Dojo couldn't be simpler:
It's also trivial to test out the latest 0.4.1 Release Candidate:
That's all there is to it!
From here on in, your pages can use the
dojo.require() system to pull in anything that's part of the "stock" distribution, and by following James' detailed documentation and test page, you can also load your own custom packages while still loading the main system from a separate domain.
So for a little while I've been giving this talk on the current state of mobile web app development and why Ajax (as we know it) isn't gonna be the next big thing on phones. Last week, to my tremendous embarrassment, I was asked to give a summarized version of the same talk in front of a lot of folks who actually work on the phone browsers I've been slagging. Of course, me being embarrassed didn't make the state of play on phones any better, but in discussions afterward it became clear that a lot of the people working on these browsers really do get what users want. Not surprisingly, the ones with the best understanding of how to improve the experience were the same people that don't have their bills paid by the OpCos. And then there was J2ME.
Long story short, between XML, XHTML, J2ME, WAP, and BREW it seems the mobile content industry has been so preoccupied trying to stuff useful data into sausages for delivery that they totally forgot why the web won: it lets you be lazy.
The web lets Moore's Law play out to the advantage of people who don't want to understand XML, XHTML, what a "mobile variant" or "compact profile" is, or why they should really think about entering into some sort of totally lame legal agreement with Evil OpCo X. That is to say, HTML and "tag soup" let every Joe and Srinivas put something into the commons for everyone else to see. Even if it's was "broken", you still get best-effort results, and that implies that every successive hardware generation can work harder to do the "right thing". Why is this totally awesome? 'Cause I get to be lazier as a result.
So here's a quick note to the folks who are holding on to the J2ME or XML pipe dreams: you're infrastructure. Cope. Yes, you'll still be "ubiquitous", but you'll never be loved, and don't imagine that you're hard to replace. The really creative stuff isn't going to get done on top of you until you learn to start applying those cycles to letting people be lazy. And I don't mean "here, have a gig of tools that you can use to produce a 'hello world' once you learn this programming language". I mean "so what can I do with Notepad?"
Actually, maybe that's what we should call it: The Law of Notepad: if creative people can't make something awesome using the lamest of production tools, your platform is gonna loose.
The IE team was kind enough to invite me to a small launch party last night, and while there I ran into someone who was asking how you do "real work" on IE. It's a strange enough thing for a webdev to say, but the setting made it that much more interesting. I guess there's a whole generation of webdevs who would like to put their heads in the sand and pretend that IE doesn't exist. Getting to a productive point when debugging hard problems on IE requires a good toolchain. Here's my setup.
The basic pieces are:
- A high-end mac laptop, stuffed to the gills with RAM and a fast HD. Sadly the MBPs max out at 2GB of RAM today. It's a significant limiting factor when trying to work with multiple VMs
- A fast external storage device of some sort. In my case, that's a samba server with a half terabyte of soft-RAID'd disk on switched gigabit ethernet
- Windows licenses. I use both Win2K and XP. I recommend older if you can get it, just because the older the Windows version, the less RAM the OS will soak up. Configure your VMs for the minimum operating memory you can get away with, you can always bump it up later.
- Virtualization software. These days I'm using Parallels, but previously I've used both VirtualPC and VMWare. They'll all get you where you want to go so long as you can quickly make VM clones.
As for the choice of Mac, you can try to get away with something else, but if you support Safari or Mac users in general, it pays to have something that can run not just Safari, but all of the other mac versions of the various browsers your organization might care about. That, and OS X is the best desktop Unix available on the market today (sorry Ubuntu, you're not quite there yet).
Here's how I set up my environment:
- Create a new VM. In it, install/register/jump-through-MS-hoops for the baseline version of the OS(es) you're going to be using. Don't even think of running windows update or installing a service pack yet.
- Configure the VM to use the right local networking setup
- In this new VM, install the Microsoft Script Editor, Ethereal, Drip, the MS web developer toolbar and whatever other debugging tools you use universally when debugging for IE
- Shut down this VM and copy it off to your mass storage device. Give it a name like "XP_baseline"
- For each OS Service Pack, do much the same thing. Install the service pack (avoiding browser upgrades if possible), shut the VM down, and pickle it off to cold storage
- Once you've got a VM with a pristine version of the last OS service pack, start doing the same thing, but with major browser revs. If you can't find an installer for a particular IE rev, try the Evolt Browser Archive.
- At the end of the last step, you should have a "mostly" up-to-date version of both OS and browser. Once you've got a copy of that in cold storage, only then should you run Windows Update. Mmmm...watch that VM reboot!
- This is now your "working VM". Keep it on the local disk for on-the-go development and debugging. Also, keep this VM patched as MS releases updates.
- For each new major browser rev, do NOT use your "working VM" as your baseline. Instead, pull your last major browser/OS rev snapshot out of cold storage, copy it, upgrade the copy, and put that back in the drawer
At this point, you're going to have ton of space eaten up on your external drive with VMs that you might only use very occasionally, and that's OK. Disk is cheap and if you've done stuff the way I recommend, your vms are probably going to be less than 3GB in size each. Should you make the mistake of installing, say, VisualStudio then at least disk is still cheap. At this point, you're set up to respond to the thorniest bugs, and do it faster and more accurately than your co-workers/competition.
Need to test something on IE 5.5? No sweat, just thaw out that VM and give it a whirl. Clients reporting a problem on IE 6 that you can't reproduce? Try the "naked" version of IE 6. Odds are you'll be able to reproduce it there, and with some binary-search style patch application, you can pinpoint down to the individual hotfix when things got fixed.
At this point I should probably disclaim any and all liability you might incur with regards to your Windows EULAs. I'm not advocating that you violate your licensing terms with Microsoft, and depending on your agreement with them, you might be required to do something in addition to these instructions in order to stay in compliance, despite this really being a workaround for Microsoft's design-time failures. Follow this recipe at your own risk.
Every software entrepreneur I know dreams of building a platform business. Not just wistful "wouldn't it be nice" stuff, no, I mean an all-consuming lust to become that which others build on. Led down the garden path by the example of Microsoft's dominance in the desktop market, believers in the platform strategy view ubiquity and control as the backstop against comoditization and a foothold for launching new attacks against the competition. The part that's not so obvious is that becoming a platform means that you first have to come close to winning the market on non-platform merits at which point, voila!, you're a platform...so long as you haven't made it impossible to build on your stuff.
I got to thinking about this because the tiny sliver of time that Java occupies in my mind these days is generally dedicated to dissecting it's rise and fall. The more time I spend on it, the more I realize that what's happened to Java in the last couple of years is a failure to recognize a couple of things:
- that Java won, despite it's myriad warts
- that winning is not a god-given right
- that you can't expect to win on your own terms
In fact, Java never won on its own terms. It won by having enough pluck and backing to build up a real, honest-to-god platform. The platform became a platform because it got used for enough good things that it came close (enough) to winning the market for a certain class of apps. Java the language is a pitiful mess. Java the platform? Now that's a thing of fucking beauty. Not only did Sun build the alliances necessary to ensure that Java would be available to whoever wanted it, the "Pure Java" marketing actually worked.
The result is a system that won because it created an environment where, no matter what the OS, developers could plug in a set of Java libraries (I'm ignoring the JAR cluster-fsck for now) and know that it would all "just work" thanks to a common bytecode interpreter. Now, other languages have used a similar form of platform aikido to catapult themselves into utility. Python, PHP, Perl, and Ruby spring to mind as languages that don't really mind their C dependency chains. Quite the contrary! The communities around these languages (rightly) consider being able to "swig up" some C or C++ hairball as something they can script as a core feature. It allows them to turn one platform win into another. Which is exactly where Sun continues to self-destruct.
Instead of understanding that they won the platform war and will inevitably lose the language skirmishes, the Java camp seems hell-bent on trying to shoehorn Java (the language) into ever more places that it doesn't belong. JSR 290? Gimmie a freaking break.
All of this points to a bright future that Sun, currently, seems too limp-willed to exploit. There's an amazing amount of good code that people have churned out in Java. The "Pure Java" thing actually played! Instead of allowing the partisans to throw stones at folks who want to run other, more productive, languages on top of the JVM (aka: the platform), Sun should follow through on it's baby steps and start giving real respect to the dynamic languages folks who want to help them continue to win on a platform (not language) basis. Hiring the JRuby guys and shipping jrunscript (aka: Rhino) in Java 6 are good first steps, but they don't go far enough. The atmosphere has to change. Acrimony needs to be turned into understanding, and real investment needs to be made in making the platform successful, even if it comes at the cost of one particular language.
It's not too late. I hope.
Here are the slides from my talk on Mobile Ajax development. I've got a longer-ish blog post in the works about getting a working emulation environment set up, but it's taking much longer than I'd anticipated to try to track down some of these things (if you know anyone at SonyErickson or Obigo, drop me a line). Hopefully next time I give this talk I'll be able to include a demo of the "foldable interface" thing I keep muttering on and on about.
There's some fun data in the slides that the carriers would really rather not have disseminated, not that their collective folly hasn't been laid bare qualitatively already.