"[T]he advantage to being a wicked bastard is that everyone pesters the Lord on your behalf; if the volume of prayers from my saintly enemies means anything, I'll be saved when the Archbishop of Canterbury is damned. It's a comforting thought."
Flashman, Flashman at the Charge

And the advantage in taking 20 weeks off is I still have a Flashman quotation left laying around to use. What have I been up to? Not much:

  • 3 new Django content management sites
  • A Django social network for an episode of PBS' Frontline, God in America
  • An ecommerce site powered by Satchmo
  • My first Microsoft MVC2 Project (another big social network, done under NDA)

August was a rough month. After a slow July, the Satchmo site and the .NET site were competing for all of my attention, made worse by the fact each project was a learning experience for me. Forced to work in a Windows environment, I would happily work with MVC2 again. I'm spoiled by Django and I have reservations about the amount of ecosphere .NET projects drag around with them, but it's a huge improvement over a WebForms site. I'll never get over my objections to magic happening in compiled files somewhere on a machine (I want to be able to open a text file and see what's going wrong if there's a problem), so .NET will never be my first choice solution. My mind is also bent by Django since it's the first MVC framework I really worked with and because it is the one I know best (I'm just starting to learn CakePHP while working with Croogo, which seems like a nice lightweight PHP CMS solution), so some of the issues I have with MVC2 are just a case of expecting things to work a different way. But there are some design decisions I disagree with:

  • I'll start with the big one: I'm not a huge believer in Controllers for web apps. There's a new Python framework whose name I've forgotten two days later that describes itself as an MV framework, which basically describes Django as well. I can see putting security logic in controllers (that's what I did when I rolled my own for .NET way back when), but given the amount of security and sanity-checking a routing engine gives you to begin with, I don't think it's a lot of overhead to put into the views. Actually, that's not true. If you need to write the same security logic into multiple views, that's not good. But Django's use of decorators works for me. MVC2's controller attributes serve pretty much the same function, just in the controllers. Which brings me to the next issue . . .
  • Django, Rails and most other MVC frameworks intentionally make it difficult to put logic into the presentation layer. Because MVC2 just uses .aspx pages as the View layer, it allows people to re-invent WebForms.
  • My personal opinion is that everything about a model belongs in the model. This was my one fundamental disagreement with Django's design up until the last release. Until 1.2, some validation had to be done in forms. Forms are just a way of interacting with a model, but there's no contract to use a particular form. You could build a dozen different forms for a model or not use a form at all, which means there was no single location for business logic. Where Django made it hard to centralize rules for a model, it's just about impossible in MVC2. Logic goes in the Controller, not the Model. There's no way (that I could fine, I could be totally wrong) to hook into a Save event or similar. And things get further confused with the Repository Model and View Model concepts, where you build "models" as a data access layer and as a convenience object for strongly binding a view to an object. It feels wrong-headed to me.
  • The build process still feels horribly complex for .NET projects. It typically consists of a batch file tied to one or more large XML files describing the different deployment locations. It runs a build, moves stuff around and then you manually drag and drop the files and diff the folders because of course no Windows server admin dares to have FTP open anymore and you're not going to get SFTP access either. And then maybe you need to restart IIS, maybe you don't. In comparison to the Nant build scripts I'm used to, my Fabric deployment files for Django projects look like the slow kid in class: a dozen lines top, another 5 or so if I have a second deployment location.
  • I've finally wrapped my thick head around using South for migrations in Django. If there's something similar for MVC2 projects, please let me know.

As for Satchmo, I don't know if I'd use it again. I had heard it, for better and for worse, included everything plus two kitchen sinks. I went with it because I figured if I got over my head, the amount of options and sizable user community could save me. They did, but it still felt like an elephant gun solution and it was harder than I expected to customize it. Actually, that's not fair: once I learned my way around, it was pretty easy to customize, but all that work happened in uncharted territory. While it has decent documentation, the documentation is written for people who just want to set a site up, tweak some settings in the admin and be ready to go. While you can add/ customize all sorts of things, you're on your own for much of it. All of which suggests I ought to donate some time back to the project in the form of documentation. I guess I would use it again given it can do most anything, provides a lot straight out of the box and gave me a feeling of security you don't get from hand-rolling your own credit card processing logic. I'll just keep an eye open for other Django ecommerce solutions like LFS. And I've heard good things from people using Shopify.

While those two projects dragged on into September, the Frontline site launched. It's a testament to Django (with some help from django-db-log— now replaced by the more attractive but also more confusing Sentry) that the launch went so smoothly. It's a different experience, knowing that after 10pm on a given night, thousands of people are going to hit your newly-launched site. A small number of edge cases issues cropped up, but it's reassuring to have fixed and deployed a patch before I get an email from the client about the issue. The only real issue I ran into was a performance problem on the directory listing pages: because one of the sorting options is by views (and the default option at that), the query was running incredibly slowly and forced me to denormalize the view data from a separate table (the views are in a separate table so I could track who viewed a profile and when) into the profiles table itself. Once that was done (and once I added a bit of template caching to the page), the problem disappeared.

Totally (almost) unrelated to work, one music note from my missing months: we caught the Paste Tour at The Middle East in Boston. This came up in a discussion last night when someone told us they'd recentl seen Sufjan Stevens in concert. If you know me at all, you should be proud: I didn't get up and walk away, I didn't spit out my drink (not that I'd ever spit beer in general or Boddington's in specific). Instead I was just a jerk and asked if Sufjan played his 25 minute new album closer that features costume changes during the song (don't look at me like that, I heard it on an episode of the otherwise-fantastic Musicheads podcast)? The answer: yes he did and it was awesome. There was confetti and white people going as crazy as people who attend Sufjan Stevens shows are capable of going. Which, one imagines, isn't very far at all but still requires an expensive therapist to sort out the ennui afterwards.

No thanks. We walked into The Middle East late due to traffic and a restaurant who thought the slow food movement should be extended to the table service and walked directly into a screaming match between Jesse Sykes' guitarist Phil Wandscher (late of Whiskeytown) and one or more patrons who were standing in directly in front of the stage and texting. That segued into a typically raucous set from Langhorne Slim; if he gets near your town, go see him— it might have been the 'Gansett tallboys talking, but Michelle asked me how likely it was she could land him for next year's Cochecho Arts Festival, so he might be closer than you think.

So that was all dark and boozy and ceilings so low Langhorne Slim nearly decapitated himself jumping off drums and amps. And then Jason Isbell showed up and here comes my point along with him: he was a complete mess. I saw his eyes as he walked out from backstage and got a little nervous: while Michelle tolerates the Drive-By Truckers for me, she loves Jason Isbell. And here he came looking like he was going to fall off the stage. And then he ripped off an hour plus set that might be the best show I've ever seen. My eyes have looked like his any number of times. None of those times have I had the hand-eye coordination to unlock a door on the first try. Somehow he played the best guitar I've ever witnessed close up. I suppose it's like getting to Carnegie Hall, "Practice man, practice". I can't see Sufjan Stevens, Animal Collective or Soul Collective ever letting themselves free like that. For me, music, art in general, should be about Dionysus, not Apollo: let yourself go. Free your ass, etc., etc. It pains me to be at a show and see someone doing that White Guy Dance where he's kinda shaking his ass, but his elbows are welded to his hips for fear of annoying other patrons or (God forbid! Heaven forfend!) ever looking a little goofy. You see those "Dance Like No One is Looking" bumper stickers on plenty of Volvos, but I never see the drivers doing it.