L'etat, c'est moi
Mere Complexities sells the consulting and development services of me, Paul Wilson.
Conferences
Archive
Applications with databases
There are two ways of thinking about database applications: the application is the front end to the database; the database persists the application’s domain objects. They are different, tend towards different architectures, and are both valid.
Aye oh, Aye oh, it's off to AYE we go
Well, I bet no-one’s ever used that one about going to AYE before.
Anyway, last week we started off on our month long trip from San Francisco to Phoenix for AYE. Some photos are here.
Foreign keys vs Static Typing
| static typing | foreign keys |
|---|---|
| provides metadata on the structure of the application, useful to tools and developers | provides metadata on the structure of the application, useful to tools and developers |
| helps prevent (programmer) errors entering application code at compile time | helps prevent (programmer) errors corrupting data at runtime |
| absence of static typing may be more than compensated by good unit testing | absence of foreign keys in a single-application database may be compensated for by good functional testing |
| adds overhead to application code maintenance slowing down rate of change | adds significant overhead to test code, slowing down rate of change of data and application code to new requirements |
| often requires moderate to significant test scaffolding | nearly always requires significant test scaffolding |
| first line of defence against human error | second line of defence against human error |
| Directing (as opposed to Enabling) | Directing |
| Help’s prevent surprises: when a method says it is returning a Customer, you know you’re going to get a Customer | Help’s prevent surprises: when an order has a foreign key to the customers table, you know that there’s a valid customer at the other end. |
Though, the thing that ties static typing and foreign keys closest together for me is the the faint retort of the bolt gun as yet another sacred cow is slaughtered. Of course, all you lispy/small-talky types were always hip to dynamic typing. Me though, I’d always been taught that big serious applications – where someone can lose their job – needed static goodness. Foreign keys too. And Checked Exceptions were the great new Java thing.
Update:Forgot about the directing/enabling bit. Also: to be continued…..
Update 2:Remembered about preventing surprises.
The right question
A few nights ago in a San Francisco restuarant I asked for a glass of Chardonnay. There were two on the menu: the waitress could have asked if I’d like a Coppola Gold Label or Merryvale Starmont; I wouldn’t have known.
“Do you prefer crisp or buttery” she said. I could answer that.
Foreign keys
Busy getting ready for our US holiday; no time to blog, but it’s worth noting that Richie is finding that foreign keys are getting in the way of tests. Alan had a similar experience not so long ago. I leave you with this thought:
Foreign keys === Static Typing
Test Driven Development - Frequently Asked Questions
Q:Are you telling me that I should change the structure of my application just to make it easier to test?
A:Yes.
Q:No way?
A:Yes way.
Q:No way?
A:Yes way.
Q:Isn’t that putting the cart before the horse?
A:No. You’re confusing developing software with horses and carts. It’s a surprisingly common mistake. That and the programming / building bridges mixup.
Getting my holiday reading together

Too geeky. I think I need to get some non-fiction in there.
Update: I, of course, meant less-friction. Thanks Anthony.
