設計樣式(Design Pattern)是將系統開發的成功經驗法則有規則地整理而成,可讓系統開發者避免不必要的錯誤嘗試。本研究提出一個應用於系統開發的新方法,它是以MVC(Model-View-Controller) 設計樣式為核心並結合XML技術的設計樣式,我們稱之為DMVC (Document-based MVC) 。 MVC設計樣式是在系統設計過程中將應用系統分離為三類元件,清楚區分資料本身、資料展現與系統邏輯,以實現分別開發與整合利用(Divide and Conquer)的理想。這樣的設計尤其適合應用於開發網際為基礎的(Web-based)應用系統,其互動方式是以處理使用者要求(Request)為主。本研究在Model與Controller的互動中加入Abstract Factory和Façade 等設計樣式來減少兩元件的相依性,使得Controller與Model可僅僅透過XML文件進行溝通合作。另一方面,我們將系統邏輯中的運作流程資訊描述於XML文件上,當使用者工作流程因需求更改而變動時,Controller控制View的展現順序可彈性地配合調整,而這些系統邏輯的變動並不影響View的外觀設計。 DMVC藉由XML的跨平台、跨語言以及人機可讀等特性,將系統運作資訊抽離於程式碼而放置於XML文件上,不僅可以降低系統維護時的複雜度,最重要的是更降低了Model、View、Controller元件的耦合度(couple),再利用性也因此提高。
This paper proposes an improvement approach for software development, named DMVC (Document-based Model-View-Controller) design pattern. DMVC, based on XML and MVC, improve flexible on modification especially when system requirement change and software maintenance. DMVC is based on MVC concepts, but separates the “Software Requirements” outside on documented files. These documented files are especially on XML formatted files and become parts of application system. For solving decouple and interaction problem, we add two low-level design patterns, “Abstract Factory” and “Façade”, between Model and Controller to reduce dependency. Therefore, Controller and Model can collaborate just by XML document. We also describe an application flow that is made by XML document, so the display logic of view can be adapted when workflow or requirement change. Consequently, DMVC generate an improved design pattern to assist in large application system development. To base on the XML characteristics of interoperability and human-machine readable, the benefit of DMVC is not only improving maintainability, but more decoupling Model、View、Controller components. Keyword: Design Patterns、MVC、Document-based MVC、XML、Web