Bounty hunting is a difficult line of work. Think about it: 1) Jobs are generally consulting gigs rather than full-time employment. 2) You're brought in at the last minute, usually to clean up someone else's mess, under a lot of pressure to save the day. 3) There are long hours, difficult problems to solve, and any benefits or vacation days come out of your own back pocket. So give Boba Fett and Greedo a little respect. They're willing to go flying off to the seedy backwaters of the galaxy, at great personal expense, mind you, turning over every stone until they find the Rebel scum they've been told to bring in. All because the megalomaniacal creeps they work for run huge bureaucratic organizations filled with nothing but boot-licking sycophants and lackeys who can't seem to catch one measly smuggler and his smelly walking-carpet sidekick. And if they should happen to run across this smuggler, who knows what kind of lethal stunt this half-witted, scruffy-looking nerf herder is liable to pull to get away from them. Here's just one example:
Shocking, isn't it? I know. It's called the StrategyPattern, and if you're not looking out for it, well you might just end up with some brand new ventilation courtesy of Han's blaster. Here's how it works:
Let's say you find yourself in a particular context, like, say, a cantina on a desert planet. Bartender gives you a drink, and you're parched, so you reach for it. But wait!! Is that beaker really filled with good old Membrosia? How do you know nobody has slipped the bartender a couple hundred galactic credits along with a bottle marked "Membrosia", but which is really heavily spiked with carsunum? What does the bartender care? All he knows is he gets a free bottle and two hundred credits out of the deal - makes no difference to him. People keel over in his place all the time. Seems like a pretty good strategy for knocking you off, wouldn't you say?
Here's another strategy pattern scenario I bet you didn't think about:
Boba Fett is a bounty hunter.
He happens to walk into the Mos Eisley cantina on a day when they're giving away stuff to all the cantina patrons: today, it's fuzzy animals. (Don't ask me. Some corporate marketing idiot from the cantina's Membrosia distributor thought it would be a good promotional gimmick.)
So when Boba Fett takes his basket of stuff from the barkeep and opens it up to see what he got, he discovers a litter of adorable kittens named Blossom, Minty, Butterscotch, Cotton Candy, Blue Belle, Snuzzle, and Rainbow Dash.
Here's what happens when Boba Fett plays with each kitten, and it's just the cutest thing you've ever seen. Almost brings a tear to your eye:
Greedo is also a noble bounty hunter, but he has a dark secret: he just loves fuzzy, adorable kittens! He's so excited when he sees what Boba Fett got that he completely forgets about the Strategy Pattern! Oh no! Greedo beware! While Greedo is distracted, Han has slipped the barkeep a bribe along with another group of "fuzzy animals":
What does poor Greedo get in his basket? That's right: a really nasty confusion of weasels (that's the right term for a collection of weasels; I looked it up) named Lefty, One Eye, Sanchez, Scar, Ashes, Blade, and (oddly enough) Rainbow Dash! Greedo flew halfway across the galaxy to bring Han back to Jabba, but instead here's what he gets for his troubles:
So what's the morale of this tale? If you're a galactic bounty hunter and you ever find yourself in a desert planet cantina that's giving away baskets of fuzzy animals, be super careful, because what you think is gonna be a litter of kittens might just turn out to be a confusion of weasels. And, oh yeah, the Strategy Pattern is a good way to achieve some nice decoupling in your design. But seriously, don't forget about the weasel part.
|Share this post :|