Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to UML Lian Yu Department of Computer Science and Engineering Arizona State University Tempe, AZ 85259.

Similar presentations


Presentation on theme: "Introduction to UML Lian Yu Department of Computer Science and Engineering Arizona State University Tempe, AZ 85259."— Presentation transcript:

1 Introduction to UML Lian Yu Department of Computer Science and Engineering Arizona State University Tempe, AZ 85259

2 UML, UML Diagrams UML stands for the Unified Modeling Language UML diagrams show/visualize relationships among classes and objects Several types of UML diagrams exist, each designed to show specific aspects of object-oriented program design

3 Class Diagram A UML class diagram consists of one or more classes, each with sections for the class name, attributes, and methods Depending on the goal of the diagram, the attribute and/or methods sections can be left out of any class Lines between classes represent associations Associations/aggregation can show multiplicity

4 Class Diagram Attributes and methods may be marked as: Private, indicating they are not visible to callers outside the class Protected, they are only visible to children of the class Public, they are visible to all SymbolMeaning +-#+-# Public Private Protected

5 UML Class Diagrams A UML class diagram for the FlipRace program: FlipRace main (args : String[]) : void Coin face : int flip() : void isHeads() : boolean toString() : String 12

6 Object Diagram A UML object diagram consists of one or more instantiated objects. It is a snapshot of the objects during an executing program, showing data values coin1 : Coin face = 0 coin2 : Coin face = 1

7 Association in UML Two classes having a general association Those classes are “aware” of each other Objects of those classes may use each other for the specific services This sometimes is referred to as a use relationship

8 Association When a class participates in an association, it has a specific role that it plays in that relationship A role is just the face the class at the near end of the association presents to the class at the other end of the association. association role name

9 Aggregation in UML An aggregate object is an object that contains references to other objects For example, an Account object contains a reference to a String object (the owner's name) An aggregate object represents a has-a relationship A bank account has a name Likewise, a student may have one or more addresses

10 Aggregation in UML An aggregation association is shown in a UML class diagram using an open diamond at the aggregate end StudentBody + main (args : String[]) : void + toString() : String 12 Student - firstName : String - lastName : String - homeAddress : Address - schoolAddress : Address + toString() : String - streetAddress : String - city : String - state : String - zipCode : long Address

11 Tools to Draw UML Diagrams Microsoft Visio Rational Rose


Download ppt "Introduction to UML Lian Yu Department of Computer Science and Engineering Arizona State University Tempe, AZ 85259."

Similar presentations


Ads by Google