Design for the web
July 20, 2007 | co.mments
Exhibit 1: Wads and Wads about using ETags to reduce bandwith and workload with Spring and Hibernate. Too much to distill into a quote. But Gavin Terrill's article is a great read; he does things like making sure not to use any machine/physical context to calc the Etag, so it'll be consistent across a cluster of servers. Frankly, awareness of this sort of thing is lacking in the Java space. As Floyd Marinescu observed in the comments: "It would be cool to see a generalized etag caching framework added to some of today's modern Java webframeworks." Yes it would.
Exhibit 2: Django's support for ETags, which I can quote: "django.middleware.common.CommonMiddleware: Handles ETags based on the USE_ETAGS setting. If USE_ETAGS is set to True, Django will calculate an ETag for each request by MD5-hashing the page content, and it'll take care of sending Not Modified responses, if appropriate." That's it - you're done.
Exhibit 3: Rails support for Etag, again quotable in full: "Rendering will automatically insert the etag header on 200 OK responses. The etag is calculated using MD5 of the response body. If a request comes in that has a matching etag, the response will be changed to a 304 Not Modified and the response body will be set to an empty string."
The relative verbosity of programming languages isn't the interesting thing; nor is typing doctrine. What's interesting is the culture of frameworks and what different communities deem valuable. My sense of it is that on Java, too many web frameworks - think JSF, or Struts 1.x - consider the Web something you work around using software patterns. The goal is get off the web, and back into middleware. Whereas a framework like Django or Rails is purpose-built for the Web; integrating with the internal enterprise is a non-goal.
ETag support is just one example; there are so many things frameworks like Rails/Django do ranging from architectural patterns around state management, to URL design, to testing, to template dispatching, to result pagination, right down to table coloring that the cumulative effect on productivity is startling. I suspect designing for the Web instead of around it is at least as important as language choice.
It's hard to explain sometimes just how time-consuming it can be to get Web things done on some Java frameworks. This post will be a handy thing to point at next time I'm lost for words :)
July 20, 2007 06:18 AM
Post a comment
TrackBack URL for this entry: