Welcome to the Coffee House The Coffee House

by Solveig Haugland


Brenda and Lacey Explain Dating Design Patterns

Grumpy Sid Sid and Zeke and the whole town of Deadville were pretty excited last week. They learned all about patterns and how to apply them to their Java programming. It started to get out of hand, and they started coming up with Cattle Design Patterns, Coffee Design Patterns, Massage Parlor Design Patterns, and then it all started to get out of hand.

Here's how it all happened.

It all started because Zeke said that what he wished he had was some darned Dating Design Patterns. "Finding a woman, and then knowing what the heck to do with her once you've found her, is about as complicated a system as I've come across," he complained. "Why don't these fellers turn their four big brains on something really useful? I can just hack together a system and it'll run, at least, but my  server is getting absolutely no client requests for services, if you catch my meaning."

Lacey and Brenda, making lattes behind the counter, started laughing. "There are Dating Design Patterns, you ornery old cowpoke. You just need to ask us and we'll give you everything you need to know. We are women, after all, and we can deploy an EJB faster than the rest of you put together."

"Oh, stop rubbing it in. I was feeling poorly that day. Anyway, what do you mean? You got some design patterns that are composed of that there three-part rule, which expresses a relation between a certain context, a problem, and a solution?"

Sid looked at Zeke like he'd just given birth to a three-horned cow. "You're talkin' funny, mister. You sound like that there Christopher Alexander fella that they was quoting about ever other darned minute."

"Well, I just want to use the right terminology. This is important. C'mon, Brenda, Lacey, give us a pattern. We'll sit quiet like and listen to you."

"Well, all right." Brenda shut down the latte machine and she and Lacey perched on the counter in front of the big mirror, each with a bed red pencil. "Let's look at first things first. Y'all are moaning about not knowing what to say to a woman , right? You can't get yourself into a conversational state."

"Oh lord, yes. That's a tough one. I can't think of anything when I'm sitting there lookin' at a pretty girl," yelled someone in a big black hat in the back.

"Well, that's because your CPU is running at 99% and you ain't got no system resources free to think up something to say," replied Lacey.  "Even once you calm down a bit, it'd take you several minutes to come up with what you're going to say, package it up in a nice sentence, wait til she's free so you can create a connection, and then send that little conversation over with all the right arguments over to her. Why, she could be three days gone by then."

"All right, let's think about this. You want to think of something to say to a lady, but if you wait til you need it in order to come up with what to say, you don't have the system resources to do it, or it takes one heck of a long time. Right?" And Lacey wrote up on the mirror:

Problem
You want to send a request to a server, but cannot access sufficient system resources to create the request object. And then you feel stupid.
"Now, how would you solve this?"

Black hat in the back yelled out again, "Well, if I was codin' that problem it's easy. This is connection pooling, plain and simple."

"That's all there is to it," said Brenda. "You gotta create a pool of things to say to a gal ahead of time. Just make a whole bunch of'em, and then when it's time you just have to pick one that ain't gonna throw an exception. Always have an extra in mind, too, in case she don't like the first one." And she wrote on the mirror:

Solution

Use a Diving in the Conversation Pool to create multiple coarse-grained conversational objects that can be used to create connections with a variety of servers. Catch exceptions with a try-again block.


"That's an awful neat solution," admitted Zeke. "So what kinds of things could we talk about? I've been told that foaling ain't a proper topic to ask a lady."

"Yes, try to stay clear of the whole blood and guts thing," replied Lacey. "It's not that complicated. Just act like you're incredibly interested in her and you're getting paid two bits for every little thing you find out. What's her name, where's she from and why she's here,  what she's been doing in town, and at that point if you're on the ball you can offer to show her the hot spots or escort her to anything going on that a lady might like, like a concert or our county fair. It's just a nice classic straightforward gentlemanly approach." And she wrote on the board:

Strategies

SmallTalk Strategy

Ignorant Facade Strategy

"I love the  Ignorant Facade Strategy too," she went on. "You just pretend not to know stuff and ask. Women have been using this one for years and we call it Ol'Reliable. Because you can always count on people to be opinionated, even a nice well-bred lady from the east. If you ask her when she thinks we're going to invade Iran, or what she thinks you should buy for your sister's new baby since you're just an ignorant man and you need a woman's opinion, or to resolve a debate between you and your friend about whether women appreciate a good display of gunplay, she'll talk to you and make no mistake. This is a great one since men are known far and wide for knowing nothing' about women, and you can ask her about anything woman-oriented, like the right size for a man's belt buckle in proportion to his boots, or you could even ask her to take square-dancing lessons with you since you ain't allowed to sign up alone."

"Or there's another approach," said Brenda. "You can get one of us or another respectable lady to walk around with you and start conversations with ladies for you, and then introduce you to them."

"Oh, Brenda," exclaimed Lacey in righteous indignation. "That's not a strategy of Diving in the Conversation Pool. That' s a related pattern, and in a whole nother category. The Gang Of Outlaws came up that one, anyway."

"Don't get all structuralist on me," yelled Brenda. "I think that a strategy should be more loosely defined so as not to preclude a functionalist approach as appropriate."

This, of course, is where things really got out of hand. Yelling epithets like "Aristotelian!" and "Micro-architecture fascist!" the women fought long and hard, cheered on by the rather randy crowd of cowboys until Lacey managed to throw Brenda out the door and into the horsetrough, and started looking around for another challenge.

So the cowboys shuffled on home to check their livestock and their servers and their Amazon rankings, but with more knowledge than they'd woken up with, and they dreamed that night of common themes relating to the recurrence of a problem/solution pair, in a particular context (a king-sized bed with lots of baby oil).



Solveig Haugland is an independent writer and trainer based in Colorado. She has a lot of different projects going--outdoor sports footwear, OpenOffice.org and StarOffice, patterns, Java, and dating. And Java and dating.

Her projects are usually well behaved, sitting in their separate directories and waiting patiently to be brought up again, but occasionally they get bored and start checking each other out. Occasionally the projects even have rowdy parties in the middle of the night and wake up in the wrong directory in the wrong clothes, which is how dating design patterns thing happened. See additional results of this improper intermingling of patterns and dating logic at www.datingdesignpatterns.com.

You can contact her through her OpenOffice.org training and books Web site, www.getopenoffice.org, or via solveig@getopenoffice.org.