Chapter 10. Coordinating Your Objects with the Command and Mediator Patterns

<feature> <title>In This Chapter</title> <objective>

Using the Command pattern to build a command toolkit

</objective>
<objective>

Creating command queues and implementing an undo command

</objective>
<objective>

Understanding the Mediator design pattern

</objective>
<objective>

Connecting objects using the Mediator design pattern

</objective>
<objective>

Building a Web site based on a mediator

</objective>
</feature>

You’re consulting for GlobalHugeCo, the computer manufacturer, when the Chief Information Officer comes in, looks at a monitor on the wall, and says, “Uh oh.”

“What’s the problem?” you ask.

“We run servers for different regions of the world, and it’s mission-critical that we keep those servers operating.”

“And there’s a problem?” you ask.

The CIO looks wearily at the monitor on the wall and says, “We’ve got a 24-hour Crisis Center that handles calls from our major customers. If there’s a problem with the servers, we know about it instantly. However, there’s a problem with the Crisis Center.”

“And that is?”

“Our software is so confusing that the Crisis Center typically gets all bollixed up before it can handle any problem. If there’s a problem with the Asia server, our techs have to connect to the Asia server, run diagnostics, and disconnect again. Meanwhile, a problem with the Euro server might have come up, and they have to connect to the Euro server, reboot it, and disconnect. Then the U.S. server starts ...

Get Design Patterns For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.