Skip to content

Instantly share code, notes, and snippets.

@acgerhold
Created December 12, 2023 15:39
Show Gist options
  • Save acgerhold/734e010dc63d07cd8b11006bef409aa3 to your computer and use it in GitHub Desktop.
Save acgerhold/734e010dc63d07cd8b11006bef409aa3 to your computer and use it in GitHub Desktop.
KindleClassDiagram
@startuml
'https://plantuml.com/class-diagram
class Users {
- name : String
- address : String
- email : String
}
class UserAccount {
- userId : String
- ownedBooks : List<Book>
- recentlyViewed : List<Book>
--
- updateUserInfo() : void
}
enum MobileDevice {
- smartPhone
- Tablet
- Laptop
}
class Book {
- userRating : Double
- sampleBook : boolean
- paidBook : boolean
--
+ getPaymentClient : Payment
+ downloadBook : Book
}
class Payment {
- paymentId : String
- amount : Double
--
- processPayments() : void
- verifyMainUser(userId : String) : boolean
}
enum PaymentTypes {
- creditCard
- paypal
}
class Recommender {
- getRecommendedBooks(recentlyViewed : List<Book>) : List<Book>
- recommendToUser() : Book
}
Users *-- UserAccount
UserAccount o-- MobileDevice
MobileDevice o-- Book
UserAccount o-- Payment
UserAccount o-- Recommender
PaymentTypes o-- Payment
@enduml
@gcziprusz
Copy link

lg

@gcziprusz
Copy link

The relationship between PaymentTypes and Payment should be drawn the other way around PaymentTypes --o Payment showing that Payment has-a PaymentTypes or Payment is composed of PaymentTypes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment