ARP和iteration::two的Cairngorm或AS2Patterns的Application Framework都很相似,都是借用了Core J2EE Patterns。
以AS2Patterns為例,由最外觀UI到Server,主要包括:View, View Helper, FrontController, Command, BusinessDelegate, ServiceLocator(, Service),Data以Value Object組成,通訊以AddEventListener和EventBroadcaster聯繫。
結構圖
流程圖
筆記- AS2Patterns結構跟MVC相似,藍色為Model、橙色為View、綠色為Controller。
- 所有Component是放在View,也就是與Movie Clip關聯的Class,但直接控制Component卻是ViewHelper,由於它不是與Movie Clip關聯,所以無可避免要用View.getInstance().component.property的方式來讀取更新Component,有時甚至用_root.view_mc.component.property。所以在ARP裡,ViewHelper被認為有害,破壞View封裝性,不建議使用。
- 每一個Command,就是一個Use Case。
- BusinessDelegate負責Call Remoting Service,ServiceLocator則設定Gateway Path。
|