12.05 UML Diagram
#UML #class-diagram #usecase-diagram #unit-3
UML Diagrams are a form of modeling language used within software design
They are used for building and refining software architecture based on user requirements
UML is just the modeling language.
class, sequence, collab, usecase
Class Diagram
- class diagrams have shit like classes and functions in them
- they have information about those functions like parameters and return type of the functions
- they also have class variables on the classes
classDiagram
class Library {
-name: String
-location: String
+addBook(book: Book)
+registerMember(member: Member)
}
class Book {
-title: String
-author: String
-isbn: String
-isAvailable: Boolean
+checkout()
+returnBook()
}
class Member {
-name: String
-memberId: String
+borrowBook(book: Book)
+returnBook(book: Book)
}
class Librarian {
-employeeId: String
+manageBooks()
+assistMember(member: Member)
}
Library "1" --> "*" Book
Library "1" --> "*" Member
Library "1" --> "*" Librarian
Member --> Book : borrows >
Librarian --> Book : manages >Sequence Diagram
- Shows how objects interact with eachother and the order those interactions occur.
- Processes are represented vertically and interactions are represented horizontally
- interactions contain arrows to show their direction
- interactions are ordered from top to bottom based on their chronological order of execution (just bullshiot)
sequenceDiagram
participant Member
participant Librarian
participant Library
participant Book
Member->>Librarian: request to borrow(bookId)
Librarian->>Library: findBook(bookId)
Library-->>Librarian: book
Librarian->>Book: checkout()
Book-->>Librarian: status updated
Librarian-->>Member: confirm checkoutCollaboration Diagram
- They are similar to sequence diagram but the focus is on messages passed between objects
- same information is being represented in both ways
sequenceDiagram
participant Member
participant Book
participant Librarian
participant Library
Note over Member,Librarian: Collaboration to borrow a book
Member->>Librarian: Request book
Librarian->>Library: Lookup book
Library-->>Librarian: Provide book
Librarian->>Book: checkout()
Book-->>Librarian: confirm
Librarian-->>Member: Hand over bookUse Case Diagram
- STICK MAN LES GO
- shows a graphic overview of the actors involved in a system and how different functions are needed to interact between those actors
