You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I reviewed the README file to see if the feature is in the major future work.
I performed a cursory search to see if the feature request is relevant, not redundant, nor in conflict with other tickets.
Is your feature request related to a problem? Please describe.
This remains an area with coding pattern discrepancies between CFE core and CFS apps, and also different between CFS apps to some degree as well.
The CFE core and sample app (which is supposed to be the example of "best practice") do validation on the message before calling the handler. For example:
case SAMPLE_APP_NOOP_CC:
if (SAMPLE_APP_VerifyCmdLength(&SBBufPtr->Msg, sizeof(SAMPLE_APP_NoopCmd_t)))
{
SAMPLE_APP_Noop((SAMPLE_APP_NoopCmd_t *)SBBufPtr);
}
This is different from LC, which does a similar check, but done inside each handler, for example:
if (LC_VerifyMsgLength(&BufPtr->Msg, ExpectedLength))
{
/*
** Ignore AP sample requests if disabled at the application level
*/
if (LC_AppData.CurrentLCState!=LC_STATE_DISABLED)
{
/*
Describe the solution you'd like
CFS Apps should follow the best practices/patterns set forth in the framework code. (there are reasons for the pattern being recommended practice)
Additional context
The pattern recommended in the framework (checking before calling, as done in sample_app) has several advantages:
Each command handler function has a unique type-safe prototype, that cannot be interchanged with another handler without triggering a type mismatch compiler error.
All typecasting/conversions are confined to one place, and it is nearby to the place that the verification is done - which eases maintainability because check and conversion are all in close proximity and any mismatches will be more visible.
It spreads out the cyclomatic complexity. In the non-recommended pattern, there is a case where the length check fails, and the entire handler is essentially skipped. This adds to the cyclomatic complexity of every handler. In the recommended pattern, those checks are done prior to the invocation of the handler, so the handler can focus solely on its intended purpose - doing the command itself.
Requester Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered:
Isolate the message verification and dispatch from the general message
processing. Functions in the "cmds" file now strictly handle the
command content, and do not get involved in general validation.
Isolate the message verification and dispatch from the general message
processing. Functions in the "cmds" file now strictly handle the
command content, and do not get involved in general validation.
Isolate the message verification and dispatch from the general message
processing. Functions in the "cmds" file now strictly handle the
command content, and do not get involved in general validation.
Isolate the message verification and dispatch from the general message
processing. Functions in the "cmds" file now strictly handle the
command content, and do not get involved in general validation.
Checklist (Please check before submitting)
Is your feature request related to a problem? Please describe.
This remains an area with coding pattern discrepancies between CFE core and CFS apps, and also different between CFS apps to some degree as well.
The CFE core and sample app (which is supposed to be the example of "best practice") do validation on the message before calling the handler. For example:
This is different from LC, which does a similar check, but done inside each handler, for example:
LC/fsw/src/lc_cmds.c
Lines 143 to 150 in 2f177ae
Describe the solution you'd like
CFS Apps should follow the best practices/patterns set forth in the framework code. (there are reasons for the pattern being recommended practice)
Additional context
The pattern recommended in the framework (checking before calling, as done in sample_app) has several advantages:
Requester Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: