【正文】
{ frozen } bold : Integer = 1 { frozen } name : String style : Integer = 0 ... + getFont(name : String) : Font + getName() : String ... or { abstract } ... // there are attributes, but not shown createButton(target : Button) : ButtonPeer + getColorModel() : ColorModel ... FinalClass { leaf } ... // there are methods, but not shown 玦 nterface粆 Runnable run() AlarmClock run() ... an empty partment without ellipsis means there is definitely no members (in this case, no attributes) 上海交通大學計算機科學與工程系 2022/8/17 39 DCD中方法體的表示 Register ... endSale() enterItem(id, qty) makeNewSale() makePayment(cashTendered) { ProductSpecification spec = (id)。 (spec, qty)。 } { public void enterItem( id, qty ) { ProductSpecification spec = (id)。 (spec, qty)。 } } UML notation : A method body implementation may be shown in a UML note box. It should be placed within braces, which signifies it is semantic influence (it is more than just a ment). The synax may be pseudocode, or any language. It is mon to exclude the method signature (public void ...), but it is legal to include it. 上海交通大學計算機科學與工程系 2022/8/17 40 R e g i s t er. . .S a l ed at e. . .1 . . .. . .D o m a i n M o d e lU s e C a s e M o d e lD e s i g n M o d e l: R e gi s t e re nt e r I t e m( i t em I D , qu a n ti t y ): P r o du c t C at a l o gs p e c : = ge t S p ec i f i c a t i o n ( i t e m ID ). . .i ns pi r e st h e n a m e sa nda t tr i b u te so f s o m es o f t w a r ec l a s s es i nt h e d e s i gnm ak eN ew S al e ( )S a m p l e U P A r t i f a c t R e l a t i o n s h i p s f o r D e s i g n C l a s s D i a g r a m sR e g i s t er...m ak eN ew S al e ( )e nt e r I t e m ( . . . )...P r o d uc t C a ta l og...g et S p e c i f i c at i on ( . . . )...1*. . .. . .. . .1S a l ed at e......u s e c a s er e a l i z a t i o n s( U C R s )d es i g nc l a s sd i a g r a m s( D C D s )t h e d e s i gn c l a s s e sd i s c o v e r e d w hi l ed es i g n i n g U C R s a r es u m m a r i z e d i n D C D sr e q ui r e s U C R ss u g g es t s d om a i nc o n c e p t s上海交通大學計算機科學與工程系 3. 將設計映射為代碼 上海交通大學計算機科學與工程系 2022/8/17 42 ?交互圖和 DCD可以作為代碼生成過程的輸入 ?實現(xiàn)模型包括源代碼,數(shù)據(jù)庫定義,源代碼, JSP/XML/HTML 上海交通大學計算機科學與工程系 2022/8/17 43 編程和開發(fā)過程 ?現(xiàn)代方法 : Designwhileprogramming ?但是我們經常在編程前進行可視化建模 上海交通大學計算機科學與工程系 2022/8/17 44 ?設計中也包括決策和創(chuàng)新工作 ?代碼的生成 = 機械翻譯過程 ? ? 不完全對 ? 需要修改,詳細的問題將出現(xiàn)并被解決 上海交通大學計算機科學與工程系 2022/8/17 45 R e q u i r e m e n t sA n a ly s i sD e s ig nI m p l e m e n t a t io na n d T e s t in gI t e r a t iv e C y c le so f D e v e l o p m e n tR e q u i r e m e n t sA n a ly s i sD e s ig nI m p l e m e n t a t io na n d T e s t in gR e q u i r e m e n t sA n a ly s i sD e s ig nI m p l e m e n t a t io na n d T e s t in gT i m e上海交通大學計算機科學與工程系 DCD創(chuàng)建類的定義 上海交通大學計算機科學與工程系 2022/8/17 47 定義帶有方法和簡單屬性的類 public class SalesLineItem { private int quantity。 public SalesLineItem(ProductSpecification spec, int qty) { ... } public Money getSubtotal() { ... } } SalesLineItem quantity : Integer getSubtotal() : Money ProductSpecification description : Text price : Money