jang: (Default)
Whilst SQLAlchemy does it all automagically, nicely reminds me of Hibernate, and is basically more complete out-of-the-box, there was some whining from the local Django fanboy about dropping the ORM. So, I persisted: django-model-utils provides a cast() method that'll appropriately downcast on request.

Why you would ever not want to downcast is beyond me; however, there are cost implications to doing so (a join, perhaps a second DB roundtrip - it all depends on how clever your ORM is). Having said that, the cost in terms of this particular problem still looks low compared to what it's been doing before.

Since we're basically just using pgsql as a persistence tool, I don't really care how it may or may not split my object attributes across tables (the alternative is a big munged table with lots of NULLs; Postgres has a potential third alternative using its own inherited tables, but they all amount to much of the same thing). We're typically looking at pulling back anything from a dozen to a few hundred objects, none of which is huge; so this isn't too big a deal.

The non-geeky day

I had the damp people come and measure my kitchen again; a great deal drier, will need a repeat monitoring visit, though, and next time they'll come armed and ready to tent the party wall.

After that, I headed in late. Stopped off for the morning coffee. Louise (the Dutch girl in Pret) asked if I wanted anything with that. It wasn't clear if she was directing the question to me or the woman standing next to me, so I asked, "did you mean me, or her?" That sounds awfully brusque ("who's she, the cat's mother?") so I apologised and corrected myself: I should have said, "do you mean me or the young lady to my right?"

"Ooh," said she (the cat's mother), "I like the young part," and actually honest-to-god fluttered her eyelashes at me as she blushed. Clearly I still have it.

Anyway, having so improved someone's day, I headed into Berkeley Square. There was a chap lying on the pavement, looking up between his feet at the door to the library building. He seemed quite bemused. Having ascertained that he wasn't hurt, just embarrassed, I hauled him up slightly more carefully than I might a sack of spuds and headed inside to discover that my early-morning rant on the failings of Django's ORM had led to a mini IRC explosion. "Why would you need that?" Well, perhaps you're doing something marginally more complicated than writing yet another blog. Meanwhile, I kept a weather-eye out of the window on the old chap I'd helped up; whilst he had said he was alright (refused the offer of a sit-down, coffee/scotch, fetching any further help, etc.), he did seem to just wander around a little aimlessly for about forty minutes before picking a destination and sticking with it.

The end of the geeky day

I must confess that I was irritated by the "why would you ever want to do that?"s on IRC. The problem here is that the chap in question and I have a completely different notion of what KISS means. To me it means: express the problem simply and clearly using the tools available to you in your language of choice; to him it means: it's easier to just hack some more elifs in.

The discussion culminated with a "I'm not even sure what an abstract factory is, why would you ever want to use one of those?" to which I was, at least, able to say, "why don't you ask the Django guys why they used one for their ENGINE?"

That all is irrelevant, because now we need to figure out what approach we're going to take to support i18n in user-supplied content; this is a big deal, I think, and very hard to express in a sensible UI, too. We're pretty much at the point of being able to produce a first-pass import of the metadata from the old system into the new to figure out what's broken; it's pretty much an accident that it handles Korean at the moment.

I will probably use SQLAlchemy to cast the old system's data into an object model that our new system groks :-)

In other news, as a cunning approach to handling repeated instances of sub-forms, and the attendant issues with handling the resulting data analysis, we appear to have reinvented the computed goto.


jang: (Default)

October 2011

23 242526272829


RSS Atom

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 25th, 2017 12:48 pm
Powered by Dreamwidth Studios