摘 要: 為了研究較好的軟件建模方法,運用UML中的5種圖對面向對象建模的方法進行討論及技術研究,提出如下建模過程:首先是系統需求;隨后分析問題領域,建立系統的用例圖;接著,建立系統的靜態結構模型,并將系統的功能需求分解到各個對象類,以確定各個對象類的責任;然后,建立系統的動態行為模型;最后,給出物理模型。通過實例,對UML的面向對象建模機制做了系統概述,表明UML是一種優秀的建模語言,使用UML有助于開發者對整個系統有清晰的認識,從而建立各種系統模型,為后期編碼工作做好充分的前期準備。關鍵詞:UML; 面向對象; 圖;靜態模型; 動態模型
中圖分類號:TN911-34; TP311 文獻標識碼:A
文章編號:1004-373X(2010)18-0047-04
Research on Method of Object-oriented Modeling Based on UML
YANG Shi-xin
(Computer Teaching and Research Section, Department of Public Couse, Xi’an Medical University, Xi’an 710021, China)
Abstract: In order to study a better method of software modeling, the five diagrams in UML is adopted to achieve the object-oriented modeling methods. The following modeling steps are proposed: analyze the areas of the problem, establish the use case diagram of the system; set up the static structure model of the system, decompose the system's functional requirements to each object class, determine the responsibility of each object class; and then establish the dynamic behavior model of decency and physical model. The object-oriented modeling mechanism of UML is summerized systematically through examples. It shows that UML is an excellent modeling language. UML will help the developers to have a clear understanding to the whole system, thus establish the system model and make the prophase preparation for later coding.Keywords: UML; object-oriented; state diagram; static model; dynamic model
0 引 言
面向對象方法已經成為軟件開發的主要方法[1],面向對象的分析方法以對象作為分析問題,解決問題的核心,并對問題空間進行直接映射,使計算機實現的對象與真實世界具有一一對應關系,符合人類認識規律,有效地解決了需求分析模型和軟件設計模型的不匹配現象。由于采用了數據抽象和封裝技術,面向對象的程序設計降低了各模塊間的耦合,可實現較高的代碼利用率。基于UML建模技術可以進行面向對象[2]的分析、設計、編程、測試以及面向對象的軟件過程,它以統一建模語言作為分析工具,利用面向對象的思想對問題域進行建模。本文針對建模的方法和技術進行了討論,并結合實例加以說明。
1 UML概述
統一建模語言(unified modeling language,UML)是一種發展演變而來的通用建模語言,運用廣泛,已得到很多工具的支持,并被用作行業標準,用于指定、顯現、構建和記錄系統密集過程的工件。……