UML Diagrams Flashcards
Dependency: Class diagrams
http://www.cs.utsa.edu/~cs3443/uml/uml.html#:~:text=Unidirectional%20Association%3A%20An%20object%20might,direction%20might%20not%20be%20modeled.
A dependency is when one object uses another object in its method. Let’s say Person reads Book. The book object is passed into the person read method.
Unidirectional association: class diagrams
http://www.cs.utsa.edu/~cs3443/uml/uml.html#:~:text=Unidirectional%20Association%3A%20An%20object%20might,direction%20might%20not%20be%20modeled.
This is when one object has a property of another object, but the other object does not have the reverse. Person and Book. A person can own many books, Person has a Books[] property, but a book would not have a list of its owners. The book object will never call a method on Person, but Person might call a method on book
NOTE: unidirectional associations can have many-many relationships. Just bc a book does not have a person property, does not mean many people do not own many books and many books are not owned by many people.
Bidirectional association: class diagrams
http://www.cs.utsa.edu/~cs3443/uml/uml.html#:~:text=Unidirectional%20Association%3A%20An%20object%20might,direction%20might%20not%20be%20modeled.
Two objects store each other in fields. A Person object has Book[] and Book has Person[]. A person has a list of all their books and a book has a list of all their owners.
By default, most associates are assumed to be bidirectional.
Aggregation: class diagrams
http://www.cs.utsa.edu/~cs3443/uml/uml.html#:~:text=Unidirectional%20Association%3A%20An%20object%20might,direction%20might%20not%20be%20modeled.
Object A owns Object B. In the person and book example, we would assume a different book for each different physical copy. And the person would own that copy of the book. The book will usually be owned by 1 person.
A flight/airport is a good example for unidirectional vs aggregation. A flight has an airport property, but it does not own it, and the airport does not have a flight property. A singular book can be owned by 1 person.
The key distinction is if the book is shared or owned by one person (I believe)
Composition: class diagrams
http://www.cs.utsa.edu/~cs3443/uml/uml.html#:~:text=Unidirectional%20Association%3A%20An%20object%20might,direction%20might%20not%20be%20modeled.
in addition to the aggregation relationship, A owns B, B cannot exist without A. If we assume a book is a digital copy and only 1 person can own it ever, then the copy cannot exist without a Person object.
abstract class/interface: class diagrams
Shows a standard interface/class relationship. Crew and teacher all inherit the Person interface.
sequence diagram
A sequence diagram is a uml diagram that shows the flow of messages for a particular function (user logs into account). It shows the objects it interacts with, the flow of those objects, what data is exchanged, and in what order. Sequence diagrams help model object behavior in a specific use case.
activity diagram
Activity diagrams show a flowchart of from one activity to another (think smash flowcharts). It shows the message flow from one activity to another. In the example a user searches for a product on amazon. They have an option to search for a product or click a product on the home page.