Saturday, July 21, 2007

The Value of Old Friends

I am surely the worst of friends.

If you're in my life on a daily basis, I can be (or I assume I am) as friendly a guy as you would want. But if you're out of sight, you're out of my mind. I am HORRIBLE about letting the very best of my friends fade out of my memory. My memory is not good, but it's really not that bad, either. I don't know why I don't call or email or visit, but I don't. And as I let them slip from my memory, I find I am losing something important, something of myself that I will greatly miss if it's gone.

For some reason, I have come to realize the mistake I'm making. So over the last few weeks I have been calling, visiting, and emailing the friends that are the main characters in so many of my best memories. Some have moved from Home, as I have, and some of those are quite far indeed. Others are still there, going on with different lives. But they're all somehow part of me, a part that I now know that I miss very much.

Tonight I was again reminded of how much I need my friends. One of the friends I grew up with came to my parent's house for dinner while we are in town visiting. She brought her two children - one of which I've met, the other (the 2-year-old) I have not. We talked about her life, and we talked about ours, the conversation suffering from neither the searches for wayward children nor from the years since we'd last talked. I was amazed at how easily the conversation came for her, my wife, and especially for me.

Last week I visited another of those old friends while visiting Home. Yesterday I called my best friend, and a bystander could not have known that it had been months instead of hours since I had heard his voice. I'm not the most emotionally articulate guy. My wife calls me moody. So maybe this post is a symptom of another mood swing.

But I've found something. Remembered something. And I think I know what it is, too: Home.

Anybody up for a game of spades? Play to 1000, no red twos, blind low is 200, bags, ...

Thursday, July 12, 2007

Domain-FIRST Design

I'm still working my way through Domain-Driven Design by Eric Evans. While the "captivation" factor has gone down, the "interest in subject matter" factor has gone WAY up.


I just read his chapter on Aggregates - twice. And I may go back and read other chapters again, too. There were two major revelations for me in the chapter on Aggregates.

The first was the subject matter of the chapter. It is a totally new concept to me. I had never really considered "partitioning" the domain model into regions of guaranteed logical integrity but between which the rules may be lazily enforced. I saw at once that this was both a very useful concept, but also very foreign to me, giving me my first reason to re-read the chapter.

But the most important revelation was that it finally dawned on me that he's not talking about domain-driven database schema. In my mind, he's talking about domain-first design.

I "cut my teeth" in fast-and-furious ASP-land. All I was doing for five years was designing small databases (less than ten tables), and exposing them through ASP pages. I always started with the database design, and my mind never strayed far from it. There was neither reason, application, nor time to do proper three-tiered or n-tiered design, since I was literally just binding controls to tables. I learned about three-tiered design during this time, and I tried more than once to apply it, but in my little databound world I couldn't make it fit.

Now, I'm in all-grown-up-.NET-land. Objects. Proper three-tiered design. But my databound mindset hasn't left me. When interviewing for my current contract, they asked how I'd approach designing an application. I answered honestly: I'd start with the database schema, and work my way up. Even five chapters into Domain-Driven Design I was thinking in terms of domain-driven database schema. When Evans talked about limiting certain relationships to one-way as a way to save work, I wondered what he was talking about - you could always join tables, regardless of which table's key you were selecting by. When Evans talked about Entity vs. Value objects, I struggled, thinking that Value objects would still need to be stored in a table, and making me wonder how you could tell the difference.

In the chapter on Aggregates, Evans finally broke through. The examples he gives are of multiple users of a large, distributed system comprised of objects in memory. And Evans specifically draws a contrast between handling update conflicts at the database level and at the domain-layer level. And that's when I got it. While I have ALWAYS designed my software starting with the database schema, Evans is trying with his book to give me a different starting point - the domain layer. He wants me to envision the ideal object model first, write it and unit test it, even before designing a database schema.

It will require discipline - real effort - to design anything without regard for database schema. To think in terms of objects and relationships, apart from tables and primary and foreign keys. I'm going to revisit the design I spent a week without kids hammering out at home. I may go back and re-read other chapters, this time applying them to object design instead of database design. And I'm going to grow as a developer, because I finally see the light.

Thank you Eric Evans!

Tuesday, July 03, 2007

Relaxing at High RPM

I may be the first guy in history to say this (the first guy to admit it?) - I'm borrowing my mother-in-law's sports car this week.

My mother-in-law - that quiet, unassuming little lady - just bought a Mazda Miata. For the gas mileage (yeah, right).

She then made the mistake of taking my wife and kids with her husband to Iowa for a week.

She may never see the Miata again.

It's my first real experience with a sports car. (Purists: Maybe you don't think it's a sports car, but I sure think it is :-) Claustrophobic, hot (the gearbox), noisy, rough, and touchy. Sometimes I think I'm riding on gravel in a shopping cart because of the suspension. But it's FUN!!! It rockets away from red lights, and that 50-50 weight distribution makes me look forward to turns. How I'll ever go back to my positively boring Honda Accord I'll never know. But Carrie tells me I need to cool my jets, that it's "not the right time" for us to get a two-seater. >sigh<

Yesterday she called and asked what I was doing. "Going for a drive," I said. She wanted to know where I was going. Then she wanted to know why. I think she's been a mom too long - she's forgotten that it can be fun to just drive on a windy rural road and enjoy the wind, the trees, the hills, and the turns. She never really understood what I was doing. I never cared.

Anybody want to buy a used Accord?