2010年9月25日星期六

Mariotti describes one episode from

Separating Configuration from Use
The important issue in all of this is to ensure that the configuration of services is separated from their use. Indeed this is a fundamental design principle that sits with the separation of interfaces from implementation. It's something we see within an object-oriented program when conditional logic decides which class to instantiate, and then future evaluations of that conditional are done through polymorphism rather than through duplicated conditional code.

What does the squeeze look like at Wal-Mart? It is usually thoroughly rational, sometimes devastatingly so.

John Mariotti is a veteran of the consumer-products world--he spent nine years as president of Huffy Bicycle Co., a division of Huffy Corp., and is now chairman of World Kitchen, the company that sells Oxo, Revere, Corning, and Ekco brand housewares.

He could not be clearer on his opinion about Wal-Mart: It's a great company, and a great company to do business with. "Wal-Mart has done more good for America by several thousand orders of magnitude than they've done bad," Mariotti says. "They have raised the bar, and raised the bar for everybody."

Mariotti describes one episode from Huffy's relationship with Wal-Mart. It's a tale he tells to illustrate an admiring point he makes about the retailer. "They demand you do what you say you are going to do." But it's also a classic example of the damned-if-you-do, damned-if-you-don't Wal-Mart squeeze. When Mariotti was at Huffy throughout the 1980s, the company sold a range of bikes to Wal-Mart, 20 or so models, in a spread of prices and profitability. It was a leading manufacturer of bikes in the United States, in places like Ponca City, Oklahoma; Celina, Ohio; and Farmington, Missouri.


If this separation is useful within a single code base, it's especially vital when you're using foreign elements such as components and services. The first question is whether you wish to defer the choice of implementation class to particular deployments. If so you need to use some implementation of plugin. Once you are using plugins then it's essential that the assembly of the plugins is done separately from the rest of the application so that you can substitute different configurations easily for different deployments. How you achieve this is secondary. This configuration mechanism can either configure a service locator, or use injection to configure objects directly.

没有评论:

发表评论