Luar's Flash Playground:Application Framework: MVC與Core J2EE Patterns (ARP / Cairngorm / AS2Patterns)之研究 - AS2Patterns篇
Application Framework: MVC與Core J2EE Patterns (ARP / Cairngorm / AS2Patterns)之研究 - AS2Patterns篇 (21-07-2005)

ARP和iteration::two的CairngormAS2Patterns的Application Framework都很相似,都是借用了Core J2EE Patterns

以AS2Patterns為例,由最外觀UI到Server,主要包括:View, View Helper, FrontController, Command, BusinessDelegate, ServiceLocator(, Service),Data以Value Object組成,通訊以AddEventListener和EventBroadcaster聯繫。

結構圖
AS2PatternsClassDiagram.jpg

流程圖
AS2PatternsSequenceDiagram.jpg

筆記

  • 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。

本文章由發表。
同組文章