1 / 12

COP 3330

COP 3330. Notes 4/13. Today’s Topics. UML Class Diagrams. UML Class Diagrams. UML stands for Unified Modeling Language There are many types of diagrams specified by UML, but we'll only focus on class diagrams UML class diagrams depict structural relationships among classes.

fell
Download Presentation

COP 3330

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. COP 3330 Notes 4/13

  2. Today’s Topics • UML Class Diagrams

  3. UML Class Diagrams • UML stands for Unified Modeling Language • There are many types of diagrams specified by UML, but we'll only focus on class diagrams • UML class diagrams depict structural relationships among classes

  4. UML Class Diagrams • A class is represented as a rectangle subdivided into three areas • Example: Simplified Student class

  5. UML Class Diagrams • A field is specified with its access modifier first, then its name, then a :, then the type • e.g. on the previous slide, the Java code equivalent of the field would be private double gpa;

  6. UML Class Diagrams • A method is specified with access modifier first, then its name, then its formal parameters in parentheses, then a :, then its return type • e.g. the Java code equivalent of the method header would be public void setGPA(double newgpa)

  7. UML Class Diagrams • Access modifiers: The visibility of fields and methods are represented by the first character before their names • Private: - • Public: + • Protected: #

  8. UML Class Diagrams • Other modifiers: • If a method or field is underlined that indicates that it is static • If a method, field, or class name is italicized, that indicates that it is abstract

  9. UML Class Diagrams • Relationships among classes • Generalization (extends in Java) • Realization (implements in Java) • Arrow with dashed line allows details of the interface to be specified • Lollipop does not

  10. UML Class Diagrams • Relationships among classes • Aggregation: One type of has-a relationship • Indicates weak life-cycle dependence • e.g. an AcademicDepartment can be destroyed, yet its Students live on • Composition: Another type of has-a relationship • Indicates strong life-cycle dependence • e.g. When a car is destroyed, so is its engine

  11. UML Class Diagrams • Relationships among classes • Pretty much any other relationship is association

  12. UML Class Diagrams • Example: Extremely simplified class diagram of Assignment 3 (fields and methods omitted for clarity)

More Related