|
|
CS++CodeReview
|
|
|
=================
|
|
|
|
|
|
This is the recommendation for a code review of a CS++-Package.
|
|
|
|
|
|
Prepare for Code Review using VI-Analyzer
|
|
|
-----------------------------------------
|
|
|
|
|
|
A package should be checked for NI LabVIEW coding conventions using a prepared configuration file,
|
|
|
_VI-Analyzer-Configuration.cfg_, contained in the CS++Core package. This avoid unnecessary checks and asures common criteria.
|
|
|
|
|
|
Acceptance criteria:
|
|
|
|
|
|
- The *Amount of Failures should not exceed 5%* of all configured tests.
|
|
|
- *High Rank Tests* failures need a good reason.
|
|
|
- *Other Test Failures* should be inspected and cured if possible.
|
|
|
- *Low Rank Tests* belong mostly to cosmetics category, but should not be ignored.
|
|
|
|
|
|
Checklist for the Code Review
|
|
|
-----------------------------
|
|
|
- File Structure
|
|
|
- Refer to the CS++Core package as recommended file structure as an example.
|
|
|
- Choose folders _Libraries, Classes, Actors_ for corresponding objects.
|
|
|
- The _Actor Framework Message Maker_ saves the actor message classes into folders parallel to its corresponding actor class folder.
|
|
|
- It is recommended to store an actor class together with its message classes into one lvlib.
|
|
|
- Error
|
|
|
- Provide a custom _Package_-error.txt-file containing all error description generated within this package.
|
|
|
- Use _LV>Menu>Tools>Advanced>Edit Error Codes..._ to create a custom error file.
|
|
|
- Move it to the package folder and
|
|
|
- Create a hard link in user.lib\errors: `mklink [/h] Link Target`.
|
|
|
- Search Package-VIs for _Error Cluster from Error Code.vi_ and check for correct error numbers.
|
|
|
- Respect NI Error Convention:
|
|
|
- *Error:* Error.Status=True AND Error.code<>0.
|
|
|
- *Warning:* Error.Status=False AND Error.code<>0.
|
|
|
- Classes
|
|
|
- Class-Attribute Accessor-VIs
|
|
|
- Write accessors should provide error handling (error in and out).
|
|
|
- Read accessors do not need error handling since reading an attribute value can not cause errors. Dataflow is guaranteed by the object wire.
|
|
|
- Check access scope! Choose access scope as private as possible.
|
|
|
- Class-Methods
|
|
|
- Check access scope! Choose access scope as private as possible.
|
|
|
- Dynamic-Dispatch-VIs
|
|
|
- Check for item settings and provide good reason!
|
|
|
- Require descendant classes to override this dynamic dispatch VI.
|
|
|
- Require overrides of this dynamic dispatch VI to always invoke the Call Parent Node.
|
|
|
- Provide a hint in VI description whether the Override-VI should provide pre- and/or post processing (Implement derived class specific code before or after the Call-Parent-VI).
|
|
|
- Check for reentrant option. All VIs waiting for time-out or expected long execution time should be set to reentrant!
|
|
|
- Class-Messages
|
|
|
- Check access scope! Choose access scope as private as possible. Most message will be public.
|
|
|
- Class-Initialization
|
|
|
- CS++Base and CS++BaseActor provide a dynamic-dispatch-VI to read initialization data from Variant. All items are stored as Variant attribute of type String.
|
|
|
- Some attributes may be required. Those should be checked for existence.
|
|
|
- Other attributes are optional. They do not need to be checked.
|
|
|
- In any case valid default values should be provided.
|
|
|
- A string conversion to numeric (Dbl, Sgl, etc.) need to be converted using the decimal point! Valid default have to be specified here, too.
|
|
|
- Provide a sample ini-file.
|
|
|
- No dynamic resources should be allocated here. Dynamic resources should be allocated in _After Launch Init Core.vi_.
|
|
|
- Process Variables
|
|
|
- Provide a sample Shared-Variable.lvlib.
|
|
|
- Check for *Single Writer* option.
|
|
|
- PV's published by an actor should be set to *Single Writer=True*.
|
|
|
- PV's an actor subscribes to for set values should also be set to *Single Writer=True*.
|
|
|
- PV's an actor subscribes to for receiving commands via network should be set to *Single Writer=False*.
|
|
|
- Check for *Network buffering* option.
|
|
|
- The logging should be deactivated, maybe except for commands.
|
|
|
- Documentation
|
|
|
- The package should be documented on the CS++-Wiki.
|
|
|
- The developer should at least provide the corresponding markdown-files.
|
|
|
|
|
|
To be continued ... |