UML Class Diagrams
文章推薦指數: 80 %
Class (i.e. static) methods and fields are indicated by underlining; Constant (i.e. final) fields are indicated via naming convention: constants should be in ... UMLClassDiagrams ClassName visattribute:type visoperation(arglist):returntype where vis=visibility(+forpublic,-forprivate) attribute=datamember(akafield) operation=method(orconstructor) Note: Thearglistisalistofparametertypes(e.g.,int,double,String); parameternamesarenotincludedintheUMLclassdiagram Methodsthatdon'treturnavalue(i.e.voidmethods)shouldgiveareturntypeofvoid Class(i.e.static)methodsandfieldsareindicatedbyunderlining Constant(i.e.final)fieldsareindicatedvianamingconvention:constantsshouldbeinALL_CAPS Example: UMLdiagram Employee -name:String -payRate:double -EMPLOYEE_ID:int -nextID:int +STARTING_PAY_RATE:double +Employee(String) +Employee(String,double) +getName():String +getEmployeeID():int +getPayRate():double +changeName(String):void +changePayRate(double):void +getNextID():int CorrespondingJavaClass publicclassEmployee{ privateStringname; privatedoublepayRate; privatefinalintEMPLOYEE_ID; privatestaticintnextID=1000; publicstaticfinaldoubleSTARTING_PAY_RATE=7.75; publicEmployee(Stringname){ this.name=name; EMPLOYEE_ID=getNextID(); payRate=STARTING_PAY_RATE; } publicEmployee(Stringname,doublestartingPay){ this.name=name; EMPLOYEE_ID=getNextID(); payRate=startingPay; } publicStringgetName(){returnname;} publicintgetEmployeeID(){returnEMPLOYEE_ID;} publicdoublegetPayRate(){returnpayRate;} publicvoidchangeName(StringnewName){name=newName;} publicvoidchangePayRate(doublenewRate){payRate=newRate;} publicstaticintgetNextID(){ intid=nextID; nextID++; returnid; } }
延伸文章資訊
- 1UML Class Diagrams
Class (i.e. static) methods and fields are indicated by underlining; Constant (i.e. final) fields...
- 2UML class diagram
Class Diagrams. A UML class diagram is a graph-like view of a domain or design model. Nodes repre...
- 3Day 4 軟體設計及架構---Class Diagram - iT 邦幫忙
... 結構圖中的類別圖(Class Diagram),類別圖某部分來說和物件圖(Object Diagram) ... 類別圖描述了類別的型態,以及類別之間的靜態關連(static relat...
- 4Create a UML static structure diagram - Microsoft Support
Use a static structure diagram to show a static view of a system's classes, their attributes and ...
- 5Class diagram - Wikipedia
In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of stat...