Mediator パターン は、ソフトウェアのデザインパターンの一つで、統一されたインタフェース の集合を提供するパターンである。Mediator パターンは、GoFによって記述された 23 のパターンの一つであり、このパターンは、プログラムの動作する振る舞いを変更できるという点で、振る舞いに関するパターンと考えられている。
通常、プログラムは複数の(時には多数の)クラスからなり、ロジックと計算がクラスに配置される。しかし、プログラムでクラスの数が増えるに従い、特に保守やリファクタリングをする際、クラス間の通信の問題が複雑になり、プログラムを読んだり保守したりすることが困難になる。さらに、他のクラスに影響を与える可能性があるため、変更も難しくなる。
Mediator パターンを用いると、オブジェクト間の通信は mediator によってカプセル化され、オブジェクト同士で直接通信せず、mediator を介して行うようになる。これにより通信するオブジェクト同士の依存関係を削減し、結合の度合いを下げることができる。
登場するクラス
Mediator (仲裁人、調停者)
Colleague (同僚) オブジェクト間のコミュニケーションのインタフェースを定義する。
ConcreteMediator
Mediator インターフェイスを実装し、Colleague オブジェクト間の通信を調整する。全ての Colleague の存在と、通信の目的について知っている。
ConcreteColleague
Mediator を介して他の Colleagues と通信する。
関連項目
デザインパターン (ソフトウェア)
外部リンク
⇒Mediator Pattern in Java
⇒Mediator Pattern in C#
⇒Jt JEE Pattern Oriented Framework
表
話
編
生成に関するパターン
Abstract factory
Builder
Factory method
Prototype
Singleton
構造に関するパターン
Adapter
Bridge
Composite
Decorator
Facade
Flyweight
Proxy
振る舞いに関するパターン
Chain of responsibility
Command
Interpreter
Iterator
Mediator
Memento
Observer
State
Strategy
Template method
Visitor
並行性に関するパターン
Active object(英語版)
Balking(英語版)
Double-checked locking(英語版)
Event-based asynchronous(英語版)
Guarded suspension(英語版)
Join(英語版)
ロック
モニタ
Proactor(英語版)
Reactor
Readers?writer lock(英語版)
Scheduler(英語版)
Thread pool(英語版)
スレッド局所記憶
アーキテクチャに関するパターン
Front Controller(英語版)
Interceptor(英語版)
MVC
MVVM
多層アーキテクチャ
Specification(英語版)
出版-購読型モデル
Naked objects(英語版)
Service Locator(英語版)
Active Record
Identity map(英語版)
Data Access Object
Data Transfer Object
その他のパターン
依存性の注入 (DI)
遅延読み込み
モックオブジェクト
Null object(英語版)
Object pool(英語版)
Servant(英語版)
Type tunnel(英語版)
関連する人々
ギャング・オブ・フォー
エーリヒ・ガンマ
リチャード・ヘルム
ラルフ・ジョンソン
ジョン・ブリシディース
クリストファー・アレグザンダー
グラディ・ブーチ
ケント・ベック
ウォード・カニンガム
マーティン・ファウラー
ロバート・セシル・マーティン(英語版)
ジム・コプリエン(英語版)
ダグラス・C. シュミット(英語版)
リンダ・ライジング(英語版)
関連項目
アナリシスパターン
アンチパターン
一覧
カテゴリ
コモンズ
.mw-parser-output .asbox{position:relative;overflow:hidden}.mw-parser-output .asbox table{background:transparent}.mw-parser-output .asbox p{margin:0}.mw-parser-output .asbox p+p{margin-top:0.25em}.mw-parser-output .asbox{font-size:90%}.mw-parser-output .asbox-note{font-size:90%}.mw-parser-output .asbox .navbar{position:absolute;top:-0.90em;right:1em;display:none}
この項目は、ソフトウェアに関連した書きかけの項目です。この項目を加筆・訂正などしてくださる協力者を求めています(PJ:コンピュータ/P:コンピュータ)。
.mw-parser-output .hlist ul,.mw-parser-output .hlist ol{padding-left:0}.mw-parser-output .hlist li,.mw-parser-output .hlist dd,.mw-parser-output .hlist dt{margin-right:0;display:inline-block;white-space:nowrap}.mw-parser-output .hlist dt:after,.mw-parser-output .hlist dd:after,.mw-parser-output .hlist li:after{white-space:normal}.mw-parser-output .hlist li:after,.mw-parser-output .hlist dd:after{content:" ・\a0 ";font-weight:bold}.mw-parser-output .hlist dt:after{content:": "}.mw-parser-output .hlist-pipe dd:after,.mw-parser-output .hlist-pipe li:after{content:" |\a0 ";font-weight:normal}.mw-parser-output .hlist-hyphen dd:after,.mw-parser-output .hlist-hyphen li:after{content:" -\a0 ";font-weight:normal}.mw-parser-output .hlist-comma dd:after,.mw-parser-output .hlist-comma li:after{content:"、";font-weight:normal}.mw-parser-output .hlist-slash dd:after,.mw-parser-output .hlist-slash li:after{content:" /\a0 ";font-weight:normal}.mw-parser-output .hlist dd:last-child:after,.mw-parser-output .hlist dt:last-child:after,.mw-parser-output .hlist li:last-child:after{content:none}.mw-parser-output .hlist dd dd:first-child:before,.mw-parser-output .hlist dd dt:first-child:before,.mw-parser-output .hlist dd li:first-child:before,.mw-parser-output .hlist dt dd:first-child:before,.mw-parser-output .hlist dt dt:first-child:before,.mw-parser-output .hlist dt li:first-child:before,.mw-parser-output .hlist li dd:first-child:before,.mw-parser-output .hlist li dt:first-child:before,.mw-parser-output .hlist li li:first-child:before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child:after,.mw-parser-output .hlist dd dt:last-child:after,.mw-parser-output .hlist dd li:last-child:after,.mw-parser-output .hlist dt dd:last-child:after,.mw-parser-output .hlist dt dt:last-child:after,.mw-parser-output .hlist dt li:last-child:after,.mw-parser-output .hlist li dd:last-child:after,.mw-parser-output .hlist li dt:last-child:after,.mw-parser-output .hlist li li:last-child:after{content:")\a0 ";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li:before{content:" "counter(listitem)" ";white-space:nowrap}.mw-parser-output .hlist dd ol>li:first-child:before,.mw-parser-output .hlist dt ol>li:first-child:before,.mw-parser-output .hlist li ol>li:first-child:before{content:" ("counter(listitem)" "}.mw-parser-output .navbar{display:inline;font-size:75%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}.mw-parser-output .infobox .navbar{font-size:88%}.mw-parser-output .navbox .navbar{display:block;font-size:88%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em}