PlantUML

October 16, 2019

I learned UML at school a score of years ago. Then, I moved on to real-world design with a pen and paper.

I looked at the funny syntax: text-based, program-like code that resulted in a beautiful UML diagram second to my drawings. It also has an extension for Visual Studio Code.

Check it out at http://plantuml.com/

Below is a simple CachedCollection design to solve expensive collection process object OnDemandCollection with CachedCollection

@startuml
interface Collection<T>
class OnDemandCollection<T>
class CachedCollection<T>

Collection <|-- OnDemandCollection
Collection <|-- CachedCollection
CachedCollection "1" *-- "1" Collection
@enduml

Here’s the output of it:

@startuml
interface Collection<T>
class OnDemandCollection<T>
class CachedCollection<T>

Collection <|-- OnDemandCollection
Collection <|-- CachedCollection
CachedCollection "1" *-- "1" Collection
@enduml

For example, OnDemandCollection is a collection that would collect web content from web sites (slow and expensive network requests). When reusing its contents in an app, CachedCollection can be used to avoid re-download if the app expects the same content to be shared between different operations avoiding building caching in the app.


© 2023 Kee Nam