« Optimizing with a narrow scope | Main | GridBagLayout, Best Done Visually »

Don't Laugh, I've Done the Commando Pattern

Sometimes April Fools isn't, and in the case of "Resign Patterns" I've actually used The Commando Pattern, in production. And to my knowledge it's still in production somewhere. While the article was tounge in cheek ther are some times wherer this is appropriate:

  • A Pattern of Last Resort
    When using the commando pattern it should be used only as a last resort. Diplomatic means (proper registration, coping with bugs) have failed, marginalization and containment (subclassing, replimplementation) are for whatever reason no other viable alternatives exist (plain old doing something else). But sometimes the net benifit is greater than the other costs, and it should also be considered in those cases as well.
  • Clean Execution
    When commandos operate in real life a good mission is one where not a single bullet is fired or any injury incurred except for what the mission dictated, and this is on either side of the conflict. Commandos are not equipped to handle a full military assult and they (usually) don't want to start major conflicts. If people know you are there then something has gone horribly wrong. Nothing is worse than cleaning up a botched special forces job (think American hostages in Iran and Jimmy Carter). Similarly when you use the commando pattern you want to do what is needed quickly, cleanly, and covertly. And if the president doesn't need to know neither does your manager. (But wouldn't it be great if this URL magically worked? Right away Mr. Architect.)
  • Take No Prisoners
    All you are interested in is is getting your job done, extracting High Value Targets or delivering specific items to well insulated places. If you need to track other event listeners or integrate yourself into the framework then probobly you should look at other options. Perhaps a "spy" or "co-opting" pattern should be used in such cases.

In my particular case the registration of URL handelers in the java.net.URL class had been taken hostage by the startup routines. Our program was much to dependant on forgein URLs and when transitive closure made putting all of our stuff in the boot class path untenable we had a problem. Registering a property wouldn't work because our classlaoder was not exposed to the system class path. So I went to the accessiblity of the hashtable storing the class objects for the URL protocols, opened it, insterted our protocol, locked the access back up again, and got out.

It's been many years since that mission, and now that it's been de-classified I can tell my story.

About

This page contains a single entry from the blog posted on April 2, 2004 9:36 AM.

The previous post in this blog was Optimizing with a narrow scope.

The next post in this blog is GridBagLayout, Best Done Visually.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33