Archive for the ‘web development’ Category

Developer Day Boston!

Sunday, July 12th, 2009

I’ve talked to various people about this lately, but just to make it official here: Developer Day is coming to Boston on August 15th. We’re still finalizing some of the details, but registration should be open in a couple of days, and we’re hoping that this will be the best one yet (which will be tough, because Durham and DC were both great!)

Be sure to follow @developer_day and check the site for more details - and if you’re not close to Boston, you can always demand a Developer Day of your very own.

Progressive Caching

Wednesday, April 15th, 2009

So I’ve been giving a new talk lately, titled Page Caching Resurrected. I brought it out for the first time at Developer Day in Durham, and just last night gave it again at CVREG in Richmond, VA (I was also supposed to give it at Locos por Rails, but ran into a buzzsaw of weather-related delays and cancellations).

Page caching is the most efficient of the markup caching methods that Rails provides, but it suffers from two major problems. First, page cached content is saved to the filesystem, where it is then publicly accessible - regardless of the protections originally placed around that content. Second, page caching is appropriate only for content that is relatively static - things that change quickly, or are relevant to particular users.

The talk I’ve been presenting introduces a technique for bypassing these problems. At the moment, I’m calling it “progressive caching,” though I’m open to alternative suggestions. Basically, the idea is that many pages in an application are mostly cacheable, with only a few distinct regions that change frequently or depend on the identity of the logged-in user. On my comic book site, for instance, the release list has only a few pieces of content that depend on the user:

My Pull List

Progressive caching this content would involve page caching the release list, and then firing off an AJAX request on the page load that, if a user is logged in, returns the appropriate data to fill in those chunks with client-side JavaScript.

This technique grows more powerful when it is paired with Rails Metal, which allows you to bypass some of the overhead of the Rails stack for specific requests. The sample app that I discuss in the talk, for instance, shows the following results:

Benchmarks

If you can’t read the numbers, that’s 617ms for a page running on my local machine, pulling back 150 or so covers and adding a tag to 45 of them based on the logged in user vs. 135ms for the same content with progressive caching. In fact, I was able to get the latter version down to 66ms, with some further optimizations.

All in all, progressive caching is a strategy that I think deserves a close look. I’ve worked on a number of applications that could benefit from it, and I imagine others have, as well.

Note: I’ve written a more in-depth exploration of the technique (with actual code!) on Viget Labs’ Extend blog.

Rubyconf, done(ish)

Friday, November 7th, 2008

Second day of Rubyconf (for most people; first day for me, unfortunately) is done, and that includes my talk, “All I Need to Know* I Learned by Writing My Own Web Framework (* about Ruby and the web).” This talk was a little different for me—it’s something that I’ve thought about for a while, but the titular framework has been competing for my attention for quite a while (with the Rails Rumble, the US elections, and any number of other events). Over the last few weeks, I’ve been able to devote more and more attention to it, and the results (both code and presentation) pretty much came to fruition today.

I think the presentation went pretty well, all told—not my best presentation, but far from my worst. Importantly, I got some good feedback, and am excited to continue working on this topic. If you’re interested in seeing what this is all about, the code lives (or will eventually live) at GitHub, and my slides are here:

Testing iPhone web applications

Monday, March 10th, 2008

One of the ongoing frustrations with web application development for the iPhone is testing - until last week, you were either forced to use an actual iPhone with some manipulation to get your development site accessible to it, or to experiment with “simulators” that are really nothing more than constrained views (I’m looking at you, iPhoney). Luckily, however, the release of the iPhone SDK solves this problem once and for all.

While most of the SDK is targeted at native application development, it also includes an iPhone simulator that accurately recreates the experience - from proper scaling to rotation, and even including multi-touch. If you’re developing web apps for the iPhone, you owe it to yourself to suffer through the 2.1GB download just for this tool alone.

the iPhone simulator in action

And just as a note - if you’re trying to run the simulator after installing the SDK, it might be called “Aspen Simulator” instead of “iPhone simulator.” Not sure what’s up with that, but there it is.

Progressive enhancement and process

Sunday, February 3rd, 2008

A knitted wireframe - by cfox74

So here’s a question: how do you design your process artifacts to take progressive enhancement into consideration? (Wow, I think I just used my monthly quota of buzzwords.) In other words, how do you create wireframes, comps, and buildouts that show 1) the structure and look of a site at full-functionality, with fancy JavaScript and whatnot all over the place, as well as 2) the same site as it functions without the scripting?

Take Rails 2’s scaffold-generated index action, for instance. When you first create it, you get a list of records with view, edit, and destroy links - those destroy links, however, are wholly JavaScript-dependent; on clicking them, the page creates a form with a couple of hidden fields (including _method=”delete”, to get Rails to treat the request as if it came in via the HTTP DELETE method), requests confirmation from the user, and submits the form.

Without JavaScript, on the other hand, you’d have to have the form already on the page - which is easy, and is transparent from the point of view of the artifacts I’m talking about - but the confirmation question is different. Do you have to change the visible form to include, say, a checkbox that must be selected to confirm the delete? Or do you insert a new page in the process - so on clicking the delete link, you get a new page back asking you to confirm?

This may not seem so intimidating, but it is the simplest case. Consider the case where you want to show and hide various sections of a page as the user needs them. Without JavaScript, this would require full-page loads - which means that your design process will have to accommodate that by either revising the requirements or splitting the functionality across multiple new pages. This is easy enough to do in Rails, by using respond_to to return full pages for HTML requests and partials for JS requests, but means that your design documents will have to account for just that many more possible states.

This question is obviously closely-related to that of representing Ajax and other dynamic functionality in your design process, so it’s entirely possible that a satisfactory answer to that problem will work here, too - but I’ve yet to see a really good solution in that case, either. Any comments?

(photo from cfox74 on Flickr)