Enterprise Architect version 14.0

download
purchase

enzh-CNcsnlfrdehiiditkoplptruskessv

My Profile

Social Media Channels

facebook  twitter  youtube   linkedin

 

We've just released a major upgrade to the Parallel Agile CodeBot.  As you might already know, CodeBot generates database schema, database access functions, and a REST API to access the database from a UML domain model.  But you might not know specifically how the class diagram is interpreted during code generation.

Here’s a simple domain model for a video editor that allows you to annotate an image for machine learning.

domainmodel

This example only uses Aggregation, but several other relationships are possible.  The table below explains how CodeBot interprets what’s on the diagram.

UML relationships

You should find Composition useful for creating nested JSON structures; something which particularly lends itself to MongoDB collections, where the recommended “best practice” is that child elements with a strong ownership relationship are nested within each parent element, rather than being put into separate collections.

All other relationship types – Dependency, Realization, Responsibility etc (ad infinitum) – are treated as “non-semantic” by CodeBot, so can safely be used to define more abstract concepts that document the model rather than drive it.

How Multiplicity affects what’s generated

If you define multiplicity in the relationships (e.g. 0..1, 1..*), CodeBot uses these wherever possible for validation checks. If you don’t define the multiplicity, it defaults to either “0..1” or “1”, depending on the context.

Multiplicity also affects whether fields are generated as a single item or a list of items. Additionally, in languages that support optional types (e.g. Option in Scala, or Optional in Java), a multiplicity of 0..1 will be generated as an optional type.

Let’s quickly illustrate that with some brief code examples:

multiplicity

Try CodeBot for free at http://www.parallelagile.com/codebot.html

 

Published in Tutorials