class Polygon ex Shape Shape Line Polygon Rectangle
- Slides: 11
大規模ソフトウェア開発の問題点 ファイル間をまたがった編集が必要 規模が大きくなればなるほど、編集が煩雑&ミスが増加 class Polygon ex. Shape { … Shape Line Polygon Rectangle Circle … repaint() ではなく repaint(Screen) に 変更したい・・・。 void set. XPoint(int x){ this. xpoint = x; Shape { class Polygon ex. … Screen. repaint(); set. XPoint(int x){ } void class Rectangle ex. Shape { … this. xpoint = x; … } Screen. repaint(); void set. Width(double w){ } this. width w; Shape { class Polygon =ex. … } Screen. repaint(); void set. XPoint(int x){ } class Circle ex. Shape { … this. xpoint = x; … } Screen. repaint(); void set. Radius(double r){ } this. radius = r; … } Screen. repaint(); } 2 } …
提案:関心事ごとに視点を切り替えられる IDE 複数ファイルにまたがる編集を一つのウィンドウで行える 関心事をエディタ上に抽出 抽出元のファイルに編集結果を反映 class Polygon ex. Shape { … set. XPoint(int x){ void this. xpoint = x; Screen. repaint(); } class Rectangle ex. Shape { … } 4 … set. Width(double w){ void this. width = w; Screen. repaint(); } class Circle ex. Shape { … … } set. Radius(double r){ void this. radius = r; Screen. repaint(); } … } Repainter /* FROM Rectangle */ void set. Width(double w){ … Screen. repaint(); Editor } /* FROM Circle */ void set. Radius(double r){ … Screen. repaint(); }
約3000行 Eclipseプラグインとして実装 抽出元ファイルとの同期 ドキュメントリスナを用い、編集を感知 キー入力のoffsetを利用し編集対象を特定 IDocumentのreplaceメソッドを用いる 編集があった! Listener set. Width @Rectangle j: 167 -218 n: 2 -53 set. Radius @Circle … 8 repaint() の代わりに update() にしたい… Repainter File class Rectangle { void set. Width(…){ … event. offset is 48 … void set. Width(…){ … Screen. repaint(); … repaint() update() Screen. repaint(); Screen. update(); } } … void set. Radius(…){ } … Screen. repaint(); File } class Circle { … }