1 / 31

UML Class Diagrams

UML Class Diagrams. Chapter 16 Applying UML and Patterns Craig Larman. Objective. 자주 사용되는 UML Class Diagram 에 대한 소개 우리가 지금까지 공부해온 객체 기술을 정리해 본다 . static object modeling. officially in UML. ,. the top format is. used to distinguish the package. SuperclassFoo. name from the class name.

xena-henry
Télécharger la présentation

UML Class Diagrams

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. UML Class Diagrams Chapter 16 Applying UML and Patterns Craig Larman

  2. Objective • 자주 사용되는 UML Class Diagram에 대한 소개 • 우리가 지금까지 공부해온 객체 기술을 정리해 본다. • static object modeling 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  3. officially in UML , the top format is used to distinguish the package SuperclassFoo name from the class name or SuperClassFoo { abstract } unofficially , the second alternative is common - classOrStaticAttribute : Int + publicAttribute : String 3 common - privateAttribute compartments assumedPrivateAttribute isInitializedAttribute : Bool = true java . awt :: Font 1 . classifier name aCollection : VeggieBurger [ * ] or attributeMayLegallyBeNull : String [ 0 .. 1 ] java . awt . Font 2 . attributes finalConstantAttribute : Int = 5 { readOnly } / derivedAttribute plain : Int = 0 { readOnly } 3 . operations bold : Int = 1 { readOnly } + classOrStaticMethod () name : String + publicMethod () style : Int = 0 assumedPublicMethod () ... an interface - privateMethod () shown with a # protectedMethod () getFont ( name : String ) : Font keyword ~ packageVisibleMethod () getName () : String «constructor» SuperclassFoo ( Long ) ... methodWithParms ( parm 1 : String , parm 2 : Float ) methodReturnsSomething () : VeggieBurger methodThrowsException () { exception IOException } «interface» abstractMethod () Runnable Fruit abstractMethod 2 () { abstract } // alternate dependency run () finalMethod () { leaf } // no override in subclass ... synchronizedMethod () { guarded } ... interface implementation and subclassing SubclassFoo PurchaseOrder 1 ... ... order run () ... ... association with multiplicities - 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” 16.1 UML 적용하기: 클래스 다이어그램의 일반적 표기법 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  4. 두 가지 관점에서 본 UML Class Diagram 16.2 정의: Design Class Diagram 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  5. 16.3 Classifier • 클래스, 인터페이스, 유즈케이스, 액터들을 포함하는 UML의 많은 요소 • 행위적이고 구조적인 특색을 표현하는 모델링의 요소 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  6. 16.4 UML 속성을 보여주는 방법 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  7. 도메인 모델과 DCD의 차이점 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  8. 가이드 라인: 속성 표현을 위하여 속성과 연관 중 선택한다면? • 기본 데이터 타입을 갖는 속성은 속성으로 다른 것은 연관으로 표현 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  9. 컬렉션 속성 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  10. Register «method» // pseudo - code or a specific language is OK ... public void enterItem ( id , qty ) endSale () { enterItem ( id , qty ) ProductDescription desc = catalog . getProductDescription ( id ) ; makeNewSale () sale . makeLineItem ( desc , qty ) ; makePayment ( cashTendered ) } 15.6 노트 기호: 메모, 주석, 제약사항, 메소드 몸체 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  11. Register «method» // pseudo - code or a specific language is OK ... public void enterItem ( id , qty ) endSale () { enterItem ( id , qty ) ProductDescription desc = catalog . getProductDescription ( id ) ; makeNewSale () sale . makeLineItem ( desc , qty ) ; makePayment ( cashTendered ) } 16.6 오퍼레이션과 메소드 • 오퍼레이션의 형식 • 자바와 같은 언어도 사용가능 • 클래스 다이어그램에서 메소드 표현 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  12. 기타 이슈 • 생성자 • create를 사용 • 구현 시 각 언어에 맞게 변환하여 사용할 것 • <<constructor>>의 스테레오 타입을 사용할 수도 있다. • 접근자 • getPrice(), setPrice() • 주로 생략 • 중요한 정보를 포함하지 않음 • Noise가 될 수 있음 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  13. 16.7 키워드 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  14. 스테레오 타입 <<destroy>> : 이미 정의된 키워드 <<authorship>> : 사용자 정의 16.7 스테레오 타입, 프로파일, 태그 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  15. using the stereotype declaring the stereotype a tool will probably allow a popup to fill in the tag values , extension UML once an element has been stereotyped with «authorship» relationship to a basic UML metamodel term – Element «authorship» «metaclass» «stereotype» «authorship» author = “craig” Element Authorship Square status = “tested” author : String ... ... status : String 프로파일 금오공과대학 컴퓨터공학부 컴퓨터공학전공 • UML Profile: UML Profile은 UML의 기본 빌딩 블록들을 특별한 목적에 맞도록 UML의 stereotype과 tagged value 두 가지 자체 확장 메커니즘을 사용해서 확장한 것이다. • 특정한 모델링 개념의 정의  UML의 확장 기능 • stereo type, tags, constraints • 예. 프로젝트 관리를 위한 UML 프로파일, 데이터 모델링을 위한 UML 프로파일

  16. 16.8 UML 프로퍼티 • a property is "a named value denoting a characteristic of an element. • A property has semantic impact • Some properties are predefined and Others can be user-defined. • Properties of elements may be presented in many ways • {name1=value1, name2=value2} • ex. {abstract, visibility=public}. where {abstract=true}. 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  17. Generalization 금오공과대학 컴퓨터공학부 컴퓨터공학전공 • In a domain model • it implies the superclass is a superset and the subclass is a subset. • in a DCD software-perspective class diagram • it implies OOPL inheritance from the superclass to subclass.

  18. 금오공과대학 컴퓨터공학부 컴퓨터공학전공 • abstract classes and operations can be shown either • with an {abstract} tag • or by italicizing the name • 왜, abstract class가 필요한가? • final classes are shown with the {leaf} tag.

  19. 16.11 의존 관계 • 공급자의 변경이 클라이언트에게도 영향을 주는 관계 • 클라이언트  공급자 • 결합도의 또 다른 형태 • 예 • 공급자 타입의 속성을 갖는 형태 • 공급자에게 메시지를 보내는 형태 • 공급자 클래스 타입의 매개 변수를 받는 형태 • 공급자가 슈퍼클래스이거나 인터페이스인 형태 • 이미 의존관계가 표시되는 경우 사용하지 말 것 • 예. 상속 관계, 인터페이스의 구현, 연관 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  20. 가이드 라인 • 객체들간의 전역 변수, 매개변수, 지역 변수, 정적 메소드의 의존 관계 표현 • 예. 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  21. 의존관계 레이블 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  22. socket line notation Timer Window 1 uses the Timer dependency line notation Window 1 interface Window 2 has a dependency on the required interface it has a Timer interface when it collaborates with a Clock 2 object «interface» Clock 2 Timer ... Window 2 Timer getTime () getTime () ... Clock 1 implements and provides the Clock 3 Timer interface ... Timer Clock 1 Window 3 getTime () ... ... getTime () socket line notation ... lollipop notation indicates Clock 3 implements and provides the Timer interface to clients Window 3 has a dependency on the Timer interface when it collaborates provided interface Timer is a with a Clock 3 object 16.12 인터페이스 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  23. 16.13 어그리게이션과 컴포지션 • Aggregation • 느슨한 전체와 부분 관계 • 연관과 별 차이가 없다. • 가능하면 사용하지 말 것 • Composition • 강한 전체와 부분 관계 • Composition 관계는 1) 특정 시간에 부분은 전체에 포함 2) 부분은 항상 하나의 전체에 포함 3) 전체는 부분의 생성과 삭제를 책임 진다. 즉 전체가 없어지면 부분도 자동으로 삭제되어야 한다. 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  24. 16.14 제약 사항 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  25. 16.15 한정적 연관관계 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  26. 16.16 연관 클래스 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  27. 16.17 Singleton 클래스 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  28. the attribute type may be expressed in official UML , with the template binding K parameterized or template «interface» syntax requiring an arrow interfaces and classes List or in another language , such as Java template parameter K is a clear () ... Board squares : List < K Square > anonymous class with or template binding complete squares : List < Square > T ArrayList ... elements : T [*] ArrayList < T Square > ... clear () clear () for example , the elements attribute is an ... ... array of type T , parameterized and bound before actual use . there is a chance the UML 2 “arrow” symbol will eventually be replaced with something else e . g . , ‘ = ’ 16.18 템플릿 클래스와 인터페이스 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  29. 16.19 사용자 정의 구획 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  30. active class Clock «interface» Runnable ... run () run () ... 16.20 액티브 클래스 • 자신의 쓰레드를 실행하고 제어 금오공과대학 컴퓨터공학부 컴퓨터공학전공

  31. 16.21 Interaction Diagram and Class Diagram • Interaction Diagram을 그리고 나서 Class Diagram을 그린다. 금오공과대학 컴퓨터공학부 컴퓨터공학전공

More Related