Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💡If you are using PlantUML for class diagrams ... turn off the icons #114

Open
okkhoy opened this issue Oct 25, 2021 · 0 comments
Open

Comments

@okkhoy
Copy link

okkhoy commented Oct 25, 2021

If you are using plant UML, the default styling produces diagrams that use icons for various things like class, interface, public etc.,
You can turn off the icons feature to give a more standardized UML diagram using the notations we have learned in the class.

See example below:

The code:

@startuml
abstract class MyTaskList{
  - taskList:ArrayList
  - {static} taskCount: int

  +getTaskCount() : int
}

MyTaskList <|-- DeadlineList
DeadlineList : - deadLine: Date
DeadlineList : getDeadline() : Date
DeadlineList : print()

interface Printable
Printable <|.. DeadlineList
Printable : print()

MyTaskList o-- Task
Task --> "<<Enumeration>> \n TimeUnit"
Task : - taskName: String
Task : + getTaskName()

enum "<<Enumeration>> \n TimeUnit" {
  DAYS
  HOURS
  MINUTES
}
@enduml

Produces the diagram below. The icons are annotated for quick reference.

image

You can draw the same diagram using the code below to turn off the icons:

@startuml

hide circle
skinparam classAttributeIconSize 0

class "{abstract} \n MyTaskList"{
  - taskList:ArrayList
  - {static} taskCount: int

  + {static} getTaskCount() : int
}

"{abstract} \n MyTaskList" <|-- DeadlineList
DeadlineList : - deadLine: Date
DeadlineList : getDeadline() : Date
DeadlineList : print()

interface "<<interface>> \n Printable"
"<<interface>> \n Printable" <|.. DeadlineList
"<<interface>> \n Printable" : print()

"{abstract} \n MyTaskList" o-- Task
Task --> "<<Enumeration>> \n TimeUnit"
Task : - taskName: String
Task : + getTaskName()

enum "<<Enumeration>> \n TimeUnit" {
  DAYS
  HOURS
  MINUTES
}
@enduml

You get this diagram:
image

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

No branches or pull requests

1 participant