I am trying to model a part of my VUE app with UML. I used a class diagram to show the structure and a sequence diagram to show one specific behavior.
There are some things I am not sure about:
- in regards to the class diagram: the
Form
copmonent imports the datacriteria
, whos criterium is passed to the child and the option to the grand-child. So each instance of the childFormItem
holds one criterium of criteria and each instance of the grandchildBaseRadio
holds one option of the options array. So the data flow is through the parent. Can I still relatecriterium - FormItem
andoption - BaseRadio
as indicated by the blue composition arrows? - in regards to the sequence diagram, my aim is to visualize the cross-component data flow and custom event communication with emitting events and passing props. I sketched these as synchronous messages, since they don't return anything but this feels weird?
- are the functions called within one component supposed to be reflexive messages? (as shown in the sequence diagram for
setoption(option):void
for example). And I guess the presentation of computed propertiesintegrationChance
andintegrationProspectPercentage
as reflexive message is wrong, since they dont represent functions?
Here, the draft of the UML class-diagram sketching the VUE app:
And the sequence diagram:
And here the description of what this app does:
- The data for the function is imported as a JSON Object
criteria
. - For each criterium (e.g. gender, age, etc.)
criteria
holds an object namedcriterium
, which has a label and an array options. The options array holds anoption
for each attribute (male, female, etc.). - Each
option
has a name (e.g. male) and a correspondent value (e.g. 0). - The
Form
component imports thecriteria
object and two other components:FormItem
andFormResultBar
. The Form holds only oneFormResultBar
. For eachcriterium
incriteria
the form holds oneFormItem
and for eachoption
theFormItem
holds oneBaseRadio
button. - When the user clicks on a
BaseRadio
button, its computed propertyselectedValue
emits an event to theFormItem
, passing the value of the option that was clicked and the correspondentcriteriumKey
. - The
FormItem
component then sets the selected option (setOption()
) and saves it (saveOption(option, criteriumKey)
by emitting an event to the parent componentForm
and passing the parametersoption
andcriteriumKey
. In the Form component thesaveOption(option, criteriumKey)
saves the selectedOption
by storing it in the selections Object. - The selections Object holds all the selected options for each criterium. The computed property
integrationChance
inForm
item then calculcates the integrationChance by adding all the values of the options stored in selections. The methodintegrationChancePercentage
transform the logisitic regression value into percentages. TheintegrationChancePercentage
is then passed as the prop “result” to theFormResultBar
, where the result gets displayed.
You can find the implemented part of the application here.