unified modeling language (uml) - virginia techcourses.cs.vt.edu/~cs1706/notes/uml.pdf · unified...
TRANSCRIPT
![Page 1: Unified Modeling Language (UML) - Virginia Techcourses.cs.vt.edu/~cs1706/notes/uml.pdf · Unified Modeling Language (UML) Created Date: 10/18/2004 11:45:26 AM](https://reader036.vdocuments.us/reader036/viewer/2022081613/5fb99ff653cbef235c1b0150/html5/thumbnails/1.jpg)
Unified Modeling Language
(UML)
![Page 2: Unified Modeling Language (UML) - Virginia Techcourses.cs.vt.edu/~cs1706/notes/uml.pdf · Unified Modeling Language (UML) Created Date: 10/18/2004 11:45:26 AM](https://reader036.vdocuments.us/reader036/viewer/2022081613/5fb99ff653cbef235c1b0150/html5/thumbnails/2.jpg)
UML
• Graphical notation to support expressing Object-Oriented Designs in a compact form• Notation is quite expressive, includes many different
types of diagrams, and can be used to generate code
• We will use Class diagrams from UML• Capture a high level description of a class as well as
the relationships with other classes.
![Page 3: Unified Modeling Language (UML) - Virginia Techcourses.cs.vt.edu/~cs1706/notes/uml.pdf · Unified Modeling Language (UML) Created Date: 10/18/2004 11:45:26 AM](https://reader036.vdocuments.us/reader036/viewer/2022081613/5fb99ff653cbef235c1b0150/html5/thumbnails/3.jpg)
Simple text notation
• The UML diagrams have a simple text notation to indicate visibility.
• Consider a class with a member variable of type String called “name”
Notation Meaning Example
- private - name : String
+ public + name : String orname : String
# protected # name : String
![Page 4: Unified Modeling Language (UML) - Virginia Techcourses.cs.vt.edu/~cs1706/notes/uml.pdf · Unified Modeling Language (UML) Created Date: 10/18/2004 11:45:26 AM](https://reader036.vdocuments.us/reader036/viewer/2022081613/5fb99ff653cbef235c1b0150/html5/thumbnails/4.jpg)
Graphical Notations
• Class diagram• Name on top, usually
bolded• Attributes are member vars• Operations are methods
• Interface diagram• Adds the stereotype
designation <<interface>>
![Page 5: Unified Modeling Language (UML) - Virginia Techcourses.cs.vt.edu/~cs1706/notes/uml.pdf · Unified Modeling Language (UML) Created Date: 10/18/2004 11:45:26 AM](https://reader036.vdocuments.us/reader036/viewer/2022081613/5fb99ff653cbef235c1b0150/html5/thumbnails/5.jpg)
Inheritance
• Inheritance relates two classes
• One class is defined as an extension of the other• Existing one is called: base
class, superclass• New class called: subclass,
or derived class
• Connected in diagram with arrow with white triangle
![Page 6: Unified Modeling Language (UML) - Virginia Techcourses.cs.vt.edu/~cs1706/notes/uml.pdf · Unified Modeling Language (UML) Created Date: 10/18/2004 11:45:26 AM](https://reader036.vdocuments.us/reader036/viewer/2022081613/5fb99ff653cbef235c1b0150/html5/thumbnails/6.jpg)
Aggregation
• One class is made up of others (aggregation of objects)
• BigClass is defined in terms of other classes• Some of member vars are
objects of another class
![Page 7: Unified Modeling Language (UML) - Virginia Techcourses.cs.vt.edu/~cs1706/notes/uml.pdf · Unified Modeling Language (UML) Created Date: 10/18/2004 11:45:26 AM](https://reader036.vdocuments.us/reader036/viewer/2022081613/5fb99ff653cbef235c1b0150/html5/thumbnails/7.jpg)
Association
• Relationship between objects• Different from aggregation
because objects are considered “complete”whether the association is in place or not.
• Example: student object has an association with several course sections, the ones that she is registered in.
• Can have cardinality
![Page 8: Unified Modeling Language (UML) - Virginia Techcourses.cs.vt.edu/~cs1706/notes/uml.pdf · Unified Modeling Language (UML) Created Date: 10/18/2004 11:45:26 AM](https://reader036.vdocuments.us/reader036/viewer/2022081613/5fb99ff653cbef235c1b0150/html5/thumbnails/8.jpg)
Association
• Sometimes the association is an object by itself
• Often when the association holds data
• Example: employment associates Person with Company, includes information about employment date, position title, etc.