2010年9月25日星期六

Some detainees apprehended by the CIA and

When these containers talk about how they are so useful because they implement "Inversion of Control" I end up very puzzled. Inversion of control is a common characteristic of frameworks, so saying that these lightweight containers are special because they use inversion of control is like saying my car is special because it has wheels.

The question, is what aspect of control are they inverting? When I first ran into inversion of control, it was in the main control of a user interface. Early user interfaces were controlled by the application program. You would have a sequence of commands like "Enter name", "enter address"; your program would drive the prompts and pick up a response to each one. With graphical (or even screen based) UIs the UI framework would contain this main loop and your program instead provided event handlers for the various fields on the screen. The main control of the program was inverted, moved away from you to the framework.

For this new breed of containers the inversion is about how they lookup a plugin implementation. In my naive example the lister looked up the finder implementation by directly instantiating it. This stops the finder from being a plugin. The approach that these containers use is to ensure that any user of a plugin follows some convention that allows a separate assembler module to inject the implementation into the lister.

Steve Dobbins has been bearing the brunt of that switch. He's president and CEO of Carolina Mills, a 75-year-old North Carolina company that supplies thread, yarn, and textile finishing to apparel makers--half of which supply Wal-Mart. Carolina Mills grew steadily until 2000. But in the past three years, as its customers have gone either overseas or out of business, it has shrunk from 17 factories to 7, and from 2,600 employees to 1,200. Dobbins's customers have begun to face imported clothing sold so cheaply to Wal-Mart that they could not compete even if they paid their workers nothing.

"People ask, 'How can it be bad for things to come into the U.S. cheaply? How can it be bad to have a bargain at Wal-Mart?' Sure, it's held inflation down, and it's great to have bargains," says Dobbins. "But you can't buy anything if you're not employed. We are shopping ourselves out of jobs."

It is illegal for the government to hold prisoners in such isolation in secret prisons in the United States, which is why the CIA placed them overseas, according to several former and current intelligence officials and other U.S. government officials. Legal experts and intelligence officials said that the CIA's internment practices also would be considered illegal under the laws of several host countries, where detainees have rights to have a lawyer or to mount a defense against allegations of wrongdoing.

Host countries have signed the U.N. Convention Against Torture and Other Cruel, Inhuman or Degrading Treatment or Punishment, as has the United States. Yet CIA interrogators in the overseas sites are permitted to use the CIA's approved "Enhanced Interrogation Techniques," some of which are prohibited by the U.N. convention and by U.S. military law. They include tactics such as "waterboarding," in which a prisoner is made to believe he or she is drowning.

Some detainees apprehended by the CIA and transferred to foreign intelligence agencies have alleged after their release that they were tortured, although it is unclear whether CIA personnel played a role in the alleged abuse. Given the secrecy surrounding CIA detentions, such accusations have heightened concerns among foreign governments and human rights groups about CIA detention and interrogation practices.


I'm going to start by talking about the various forms of dependency injection, but I'll point out now that that's not the only way of removing the dependency from the application class to the plugin implementation. The other pattern you can use to do this is Service Locator, and I'll discuss that after I'm done with explaining Dependency Injection.

没有评论:

发表评论