Optimizing the Readability

0
Hey guys, Can someone help me with this part of the learning path:   Building an Event App Using Microflows -  3.2.3 Optimizing the Readability   As you probably have experienced, the validation microflow has become quite long, but we do need all of these steps. So, what can we do to not only improve the readability, but also the reusability and maintainability? We can make use of sub-microflows. Let’s see how easy it is to extract a part of our validation microflow. To see what makes sense to extract, we check where we can make a logical separation in these validations. Ideally,you would first validate if all required fields are filled in, then move on to validating any dependencies. This is exactly where it makes sense to create a sub-microflow. Select the variable and all the checks for the required fields. Then right-click the selection and choose Extract sub-microflow. Give the sub-microflow a fitting name like VAL_ProgramItem_RequiredInfo. Do keep in mind that the VAL prefix is used for (sub-)microflows forvalidation purposes, other sub-microflows will have a SUB prefix. Note: In case you get a notification that based on the selected artifacts you cannot extract a sub-microflow. This is probably because you have selected a Parameter and/or a Start event. You can’t select an End event either. Make sure you don’t select any of them when creating the sub-microflow. Now try to do this for the second part of the validation microflow and you can call this sub-microflow VAL_ProgramItem_Dependencies. Make sure to add a decision after the first sub-microflow that leads to an end event. Otherwise the dependency sub-microflow might cause unwanted errors if it tries to do comparisons with dates that have not been filled in or retrieve a day that hasn’t been selected. You’ll notice that you get errors stating that the Parameter ‘Valid’ cannot be changed. This is because you cannot change primitive input parameters (Boolean, Integer, DateTime etc.) within a sub-microflow. Since is after the decision in the main microflow, it is better to create a fresh variable to use. This part won’t be reached unless everything before this point was valid.     Regards, SKH
asked
0 answers