中国高校课件下载中心 》 教学资源 》 大学文库

复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 16 - UML类图

文档信息
资源类别:文库
文档格式:PPT
文档页数:32
文件大小:1.44MB
团购合买:点击进入团购
内容简介
复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 16 - UML类图
刷新页面文档预览

Chapter 16 UML类图 ●●●●● ●●●● ●●。●●

Chapter 16 UML类图

●●●●● ●●●● 简介 ●●● ●●● ●●●● ●UML用类图表示类,接口及其关联 类图用于静态对象建模 类图和概念图之间的关系 Domain model Register 1 Captures conceptual perspective is Complete: Boolean /total Register Sale Design Model time is Complete: Boolean DCD: software end saleo currentSale/total perspective enterItem(.) make Payment(.) makeLineltem()

简介 ⚫ UML用类图表示类,接口及其关联 ⚫ 类图用于静态对象建模 ⚫ 类图和概念图之间的关系 Register ... endSale() enterItem(...) makePayment(...) Sale time isComplete : Boolean /total makeLineItem(...) Register ... Sale time isComplete : Boolean /total Captures 1 1 1 Domain Model conceptual perspective Design Model DCD; software perspective currentSale

表示法(文本格式) SuperclassFoo used to distinguish the package name from the class name ●●●●● SuperclassFoo( abstract ●●●● unofficially, the second alternative class OrStaticAttribute: Int Is common ●●● ●●● 3 common compartments privateAttribute ●●●● ssumed Private Attribute 1. classifier name Initialized Attribute: Bool true aCollection: VeggieBurger[ o java. awt: Font 2. attributes attribute Legally BeNull String [0.11 finalConstantAttribute: Int=5(readonly 1 java. awt. Font /derivedAttribute 3. operations plain: Int =0 readonly classorStaticMethodo bold: Int =1 readOnly y publicMethodo assumedPublicMethodo style: Int =0 an interface protectedMethodo keyword getFont(name: String): Font packageVisibleMethod getName0: String methodWithParms(parm1: String parma: Float methodReturns Something(: Veggie Burger Interface》 methodThrows Exception( exception IOException Runnable abstractMethodo abstractMethod20 abstract) //alternate runo finalMethodo( leaf)//no override in subclass ynchronizedMethodoi guarded y interface subclassing Subclass Foo Purchaseorder association with ellipsis".means there may be elements, but not shown multiplicities blank compartment officially means "unknown but as a convention will be used to mean "no members

表示法(文本格式) java.awt::Font or java.awt.Font plain : Int = 0 { readOnly } bold : Int = 1 { readOnly } name : String style : Int = 0 ... getFont(name : String) : Font getName() : String ... «interface» Runnable run() - ellipsis “…” means there may be elements, but not shown - a blank compartment officially means “unknown” but as a convention will be used to mean “no members” SubclassFoo ... run() ... SuperclassFoo or SuperClassFoo { abstract } - classOrStaticAttribute : Int + publicAttribute : String - privateAttribute assumedPrivateAttribute isInitializedAttribute : Bool = true aCollection : VeggieBurger [ * ] attributeMayLegallyBeNull : String [0..1] finalConstantAttribute : Int = 5 { readOnly } /derivedAttribute + classOrStaticMethod() + publicMethod() assumedPublicMethod() - privateMethod() # protectedMethod() ~ packageVisibleMethod() «constructor»SuperclassFoo( Long ) methodWithParms(parm1 : String, parm2 : Float) methodReturnsSomething() : VeggieBurger methodThrowsException() {exception IOException} abstractMethod() abstractMethod2() { abstract } // alternate finalMethod() { leaf } // no override in subclass synchronizedMethod() { guarded } 3 common compartments 1. classifier name 2. attributes 3. operations interface implementation and subclassing Fruit ... ... PurchaseOrder ... ... 1 association with multiplicities dependency officially in UML, the top format is used to distinguish the package name from the class name unofficially, the second alternative is common order an interface shown with a keyword

图形格式 ●●●●● ●●●● ●●● (Rational Software Modeler) ●●● ●●●● AC卫ass 口 privateAttribute o publicAttribute 工 nteger o staticattribute ● lOAn10 peration St112 o abstractOperation (

图形格式 (Rational Software Modeler)

●●●●● ●●●● UML中的类型 ●●● ●●● ●●●● 类 接 ●枚举 ●数据类型 inter face》 enuunerat1on》 Person Iterator 运年级 o name: String o一年级 e haslEt ( o二年级 o三年级 (primitive) 9 Date

UML中的类型 ⚫ 类 ⚫ 接口 ⚫ 枚举 ⚫ 数据类型

●●●●● ●●●● 属性表示:文本和关联线 ●●● ●●● ●●●● 对数据类型对象使用属性文本,对引用对象使用关联线 Register Sale applying the guideline to show attributes as id: Int time: date time attribute text versus as currentsale association lines Register has THREE attributes Store 1. id 2. currentSale address: Address 3. location location phone: PhoneNumber

属性表示:文本和关联线 Register id: Int ... Sale time: DateTime ... 1 applying the guideline to show attributes as attribute text versus as association lines Store address: Address phone: PhoneNumber ... 1 Register has THREE attributes: 1. id 2. currentSale 3. location currentSale location 对数据类型对象使用属性文本,对引用对象使用关联线

●●●●● ●●●● 属性表示:混合文本和关联线 ●●● ●●● ●●●● using the attribute Register text notation to indicate Register has o currentSale: Sale a reference to one Sale instance OBSERVE: this style Register Sale visually emphasizes the connection between these classes o currentSale using the association notation to indicate Register has a reference to one Sale instance thorough and Register unambiguous, but some currentsale: Sale people dislike the possible redundancy currentsale

属性表示:混合文本和关联线 Register ... ... Sale ... ... 1 Register currentSale : Sale ... Sale ... ... using the attribute text notation to indicate Register has a reference to one Sale instance using the association notation to indicate Register has a reference to one Sale instance OBSERVE: this style visually emphasizes the connection between these classes currentSale Register currentSale : Sale ... Sale ... ... 1 thorough and unambiguous, but some people dislike the possible redundancy currentSale

●●●●● ●●●● 属性表示:导航箭头 ●●● ●●● ●●●● thorough and Register Sale unambiguous, but some current sale: Sale people dislike the possible redundancy currentsale Company Person

属性表示:导航箭头 Register currentSale : Sale ... Sale ... ... 1 thorough and unambiguous, but some people dislike the possible redundancy currentSale Company Person 1 *

●●●●● ●●●● 属性表示:多重性 ●●● ●●● ●●●● zero or more many one or more 1.40 one to 40 5 exactly 5 3,5,8 exactly 3, 5, or 8

属性表示:多重性 zero or more; "many" one or more one to 40 exactly 5 T T T T * 1..* 1..40 5 T 3, 5, 8 exactly 3, 5, or 8

●●●●● ●●●● 属性表示:角色名 ●●● ●●● ●●●● Employer Company Person Employee

属性表示:角色名 Company Person Employer Employee

刷新页面下载完整文档
VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
相关文档