Exploring Parameter Default Values as a Requirement #2149
John-P-Cargille
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey All,
I was recently providing some feedback--mostly for readability and clarity--on this page from the F' User's Guide entitled "Data Constructs: Commands, Events, Channels, and Parameters" and wanted to create a separate discussion for one thing I found especially interesting. In the "Parameters" section, when it talks about the properties of parameters, the last item is "4. default value: default values are assigned in the event the parameter cannot be retrieved." This sentence would suggest to me that a default value is an integral part of any parameter declaration, but I've never encountered this as a requirement before in any other materials I've looked at; for instance, the FPP User's Guide section on Parameter default values (section 9.8.2) seems to strongly suggest using default values, but does not insist on them.
To test this principle in practice, I created a simple project with a single component, parameter, and event, where the event would only emit if the parameter bool agreed with the component bool parameter; I intentionally did not give the parameter a default value. In running the ground data system and testing my command, I found that the parameter had automatically been set to false. So it seems that default parameters are in fact not required, but what the value subsequently is set to is determined by the FSW implementation, as the FPP guide says.
So my question is thus: if there is any concern that said implementation will get it wrong, why make default parameter values optional? Personally, as a user, I would prefer to get a compiler error when trying to build a project and subsequently be forced to set an explicit default value for a parameter, rather than leaving open the possibility that I forget about it until it causes some sort of issue on a spacecraft already in orbit. I honestly don't know what the rationale for this is, and I'd be curious to hear from anyone who does; maybe the thought is that, in making the user set a default value, it creates some sort of rigidity in the implementation code?
Long story short, I am in favor of forcing parameters to have defined default values. What are y'all's thoughts?
Beta Was this translation helpful? Give feedback.
All reactions