- The MDriven Book: Table of Contents
- What is MDriven
- Introduction - The MDriven Book
- Praise to UML
- What if UML was forbidden
- What is not to like
- What is next
- Information design
- Short introduction to UMLâ class diagram
- Association classes
- UML Inheritance
- Polymorphism
- Composite and Aggregate and what they imply
- Derived attributes & associations
- UML â State machines
- Constraints
- The ViewModel
- The declarative ViewModel
- Prototyping
- Taking It Further Still
- What an Action can do
- Global actions
- Action names
- Microsoft Office and OpenDocument as a Report generator
- Available Actions
- Introducing MDriven Server
- Security concerns for MDriven Server
- MDrivenServer Summarized
- Certain important constructs
- MDrivenServer periodic server-side actions
- Luckily UML is Not Forbidden
- Import data from other SQL servers
- SQLExport from MDriven Server
- Seeker view
- Installing TurnKey as an Azure WebApp
- Set up MDriven Turnkey on premise
- MDriven Turnkey architecture
- Security
- Information security
- Access control system in MDriven
- Testing
- The MDriven Book
Associations between classes are easy enough to understand. Car has 4 wheels.
But in the information system we build, it may be obvious that a Car owns all its Wheels; the car and all its wheels can be looked at as a complete entity of their own â a composite. If the Car is scrapped, the wheels are also implicitly thrown away. A Composite in UML is created by decorating the association with a filled diamond:
For any well-behaving MDD tool, this decoration should imply a cascading delete of all associated wheels when the Car is deleted.
A composite also signals to the UML reader that the Car and Wheels are created at the same time and may not be meaningful on their own. So some will argue that the model should be changed from â0..1 Carâ to â1 Carâ (i.e wheel must always belong to exactly one car):
On the other hand, this might not be the best idea for the domain we are modeling now. If the system we build is one that describes a garbage sorting facility, we may want to say: âYes, a car often has wheels, and the car and its wheels can be looked at as an entity of their own (a composite), but we sometimes want to take this composite apart and treat the parts separatelyâ. If this is the case, the aggregate decoration can be used:
The aggregation symbol signals to the UML reader that the connection between Car and Wheel is âstrong and commonâ and that âCar owns wheelsâ is more appropriate to the domain than âWheel owns Carâ (this also applies to the composite symbol).
A well-behaving MDD tool should probably prohibit the deletion of a Car until the Wheels are gone - so that the scrap yard guys do not delete a car while the valuable wheels are still on it.
To sum it up: Composite is stronger than Aggregate. Both symbols imply that the domain sometimes looks at the classes as a bigger unit. The symbols help the UML reader understand the larger compositions in the domain. The symbols imply specific destruction behavior to well-behaving Model-Driven Development Frameworks (MDD-Frameworks).
What Does MDriven Do[edit | edit source]
Each Association end in MDriven has the âDelete Actionâ property:
The DeleteAction can be set to one of these values:
| DeleteAction on the Wheels Association | Calling Car.AsIObject().Delete() |
| Allow | will work even if you have wheels left on the car, but the wheels will be left dangling |
| Prohibit | will not work as long as you have wheels on the car |
| Cascade | will delete any remaining wheels |
| <Default> | If the association end is Composite, treat as Cascade; if the association end is Aggregate, treat as Prohibit; if the association end has aggregation==none, treat as Allow |
The recommendation is to leave the DeleteAction on <Default> and use the Aggregation setting to control the delete action AND help UML readers understand the domain.
Deleting Wheels Without the Car[edit | edit source]
Assuming that your context is the Car:
this.Wheels.delete
would delete the wheels.
Note! Not only unlinking them. If you would like to unlink them, do:
this.Wheels->clear
Note: if you use the aggregation of type Composite, you would create "floating" objects that have a validation error of not having the Car association set.
The MDriven Book - Next Chapter: Derived attributes & associations

