yuml-thumbnail2My experience at work is that most people have difficulty to read UML Diagrams if they don’t have an english sentence which translates them in layman’s term. And it’s even more difficult for them to draw the relations between entities especially when they have to show the type of relations (distinguishing simple association from specialized ones - aggregation or composition) and the cardinalities. So why not do the contrary: write english sentences and translate it to an UML diagram thanks to a high level DSL ? The advantage is obvious: Business Analysts can much more easily trace back the Diagrams to Software Requirements and Functional Specifications.

In part I, we created an english DSL on top of yUML DSL for UML Use Case Diagrams. In part II, we want to extend it with UML Class Diagrams so as to be able to interpret these english-UML samples syntax:


A Customer is a User
A Customer has 1-2 Address
A Customer is defined by First Name, Last Name, Email
A Customer has Order(s)
An Order has LineItem(s) (at least 1)
An Order uses 1 PaymentMethod
PaymentMethod can be Credit, Cash, Check
A Product is defined by Description, Weight / getPricePerWeight, getWeight
A Product is used by LineItem(s)

In this Sub-Part IIa we’ll first see how we would like to translate each of these business sentences to yUML:


[note: A Customer is a User]
[User]^[Customer]

yuml-customer-is-a-user


[note: A Customer has 1-2 Address]
[Customer]++1-2[Address]

yuml-customer-address2


[note: A Customer is defined by]
[Customer|First Name;Last Name;Email]

yuml-customer-is-defined-by


[note: A Customer has Order(s)]
[Customer]++1-0..*[Order]

yuml-customer-has-orders


[note: An Order has LineItem(s) (at least 1)]
[Order]++1-1..*[LineItem]

yuml-order-lineitems


[note: An Order uses 1 PaymentMethod]
[Order]0..*->1[PaymentMethod]

yuml-order-paymentmethod


[note: PaymentMethod can be]
[PaymentMethod]^[Credit]
[PaymentMethod]^[Cash]
[PaymentMethod]^[Check]

yuml-payment-method-can-be


[note: Product is defined by]
[Product|Description;Weight|getPricePerWeight();getWeight()]

yuml-product-is-defined-by


[note: A LineItem refers to 1 Product]
[LineItem]0..*->1[Product]

yuml-lineitem-product

In Part IIb (not written yet, so wait maybe about one week when I will get some time and inspiration :) ), we’ll see how to implement our english-like DSL for UML Class Diagrams.

Bookmark and Share