42. めざす姿
Slide 42Copyright 2017 @nuits_jp
class Class Model
Presentation
RestauranListConsole
FindRestaurants
+ FindNearbyRestaurantsAsync(): IList<Restaurant>
GourmetService
+ SearchGourmetInfosAsync(): IList<GourmetInfo>
GeoCoordinator
Usecase
Integration
GourmetSearchResult
GourmetInfo
Restaurant
①
②
③
43. class Class Model
Presentation
RestauranListConsole
FindRestaurants
+ FindNearbyRestaurantsAsync(): IList<Restaurant>
GourmetService
+ SearchGourmetInfosAsync(): IList<GourmetInfo>
GeoCoordinator
Usecase
Integration
GourmetSearchResult
GourmetInfo
Restaurant
現在の構造
Slide 43Copyright 2017 @nuits_jp
45. class Class Model
Presentation
RestauranListConsole
FindRestaurants
+ FindNearbyRestaurantsAsync(): IList<Restaurant>
GourmetService
+ SearchGourmetInfosAsync(): IList<GourmetInfo>
GeoCoordinator
Usecase
Integration
GourmetSearchResult
GourmetInfo
Restaurant
NGポイント:密結合
Slide 45Copyright 2017 @nuits_jp
46. NGポイント:密結合
Slide 46Copyright 2017 @nuits_jp
• クラスとクラスが直接依存関係にある
• 各レイヤー間が密結合状態となっている
class Class Model
FindRestaurants
+ FindNearbyRestaurantsAsync(): IList<Restaurant>
GourmetService
+ SearchGourmetInfosAsync(): IList<GourmetInfo>
new
use
47. class Class Model
Presentation
RestauranListConsole
FindRestaurants
+ FindNearbyRestaurantsAsync(): IList<Restaurant>
GourmetService
+ SearchGourmetInfosAsync(): IList<GourmetInfo>
GeoCoordinator
Usecase
Integration
GourmetSearchResult
GourmetInfo
Restaurant
NGポイント:密結合
Slide 47Copyright 2017 @nuits_jp
62. class Class Model
FindRestaurants
+ FindNearbyRestaurantsAsync()
GourmetService
+ SearchGourmetInfosAsync()
«interface»
IGourmetService
+ SearchGourmetInfosAsync()
new
use
インターフェースの抽出結果
Slide 62Copyright 2017 @nuits_jp
利用箇所の依存性は分離できたが
インスタンス生成箇所がクラスに
依存している。
65. class Class Model
FindRestaurants
+ FindNearbyRestaurantsAsync()
GourmetService
+ SearchGourmetInfosAsync()
«interface»
IGourmetService
+ SearchGourmetInfosAsync()
new
use
インターフェースの抽出結果
Slide 65Copyright 2017 @nuits_jp
利用箇所の依存性は分離できたが
インスタンス生成箇所がクラスに
依存している。
67. 疎結合の実現
Slide 67Copyright 2017 @nuits_jp
class Class Model
FindRestaurants
+ FindNearbyRestaurantsAsync()
GourmetService
+ SearchGourmetInfosAsync()
«interface»
IGourmetService
+ SearchGourmetInfosAsync()
Program
injection
new
use