SysML: OptionsPattern[] “Generalizations” using Join:" Example: HelpM` helper classes new functions

Gallery
Tutorial
This content has been marked as discussing an ADVANCED topic!
Another example using the Webel MArg, MOpt, MFunction, MMethod, MClass and MPackage classes from the HelpM` package, showing how SysMLv1 Blocks can be used to represent the 'opts' Parameter OptionsPattern[] for each new function for creating objects of each MTools class:
Click on the image to view it full size
For reference, an associated Policy Note (you don't need to visit this link yet): The options group strategy and the "Mathematica Join as SysML Generalization" strategy both have some pros and cons, both for the Wolfram Language coding and the SysML modelling. It is mostly of advantage when there are a lot of options, and where subsets of the options are shared by some (typically "private") functions:
  • Pro: Cleaner options management, especially where options are propagated from one function to another (both in the coding and SysML modelling).
  • Pro: Options groups can leverage a Webel ODR Map (Options, Docs, Rules) Association or an AOR Map (Arguments, Options, Rules) Association via the '$k$wl$opts' key (explored in detail in later slides).
  • Con: In SysML have to "unpack" each option in the 'opts' group in Activity Diagrams using ReadStructuralFeatureAction (corresponds to OptionValue[]), but this has the advantage Pro: that it makes it clear where propagated options are eventually used.
  • Con: When using an AOR Map via the '$k$wl$opts' key AND when using "Mathematica Join as SysML Generalization" directly on options groups they can get out of sync with their corresponding AOR Map Associations (the solution to which is to use merged AOR Map Associations instead of Join on options groups).
  • Con: If coding in an IDE, one sometimes has to remember what the options for a function are (because they are "hidden" in an options group), but it's easy to check using Options[] in a notebook.
There's another (even more) detailed example of this "Mathematica Join as SysML Generalization" approach for OptionsPattern[] groups modelled as SysMLv1 Blocks later in this trail:
Up next
Notes
Snippets (quotes/extracts)
Visit also
Visit also (backlinks)
Related slides (includes other tutorials)
Related slides (backlinks, includes other tutorials)