By Dennis Collin
Dynamo scripting environment has been available for several years now and the provision of scripts can make many tasks easier to perform. When creating scripts, it is a good idea to follow Coding Standards so that it makes it easier for anyone, including yourself to be able to read, understand and diagnose what you have set out in a script. Coding standards apply to how nodes are grouped, assigned colours and how nodes and variables are named within the script. One such standard used by the Python and .Net framework community is outlined below.
When working with Nodes, the recommended practice is to keep the original node name as a prefix, separated with a pipe symbol, then a description as to what the node does. This can be done by double-clicking the node and editing the node name to suit.
Naming convention in code is applicable to all objects including:
- Class Names
- Member Variables
- Local Variables
- Lists
- Constants
Colour coding of groups and naming of nodes can be seen for an example script in the illustration below.
Following these guidelines makes it a lot easier to diagnose problems with scripts or understanding the thought process behind a script. Especially when some time has elapsed between the scripts creation and the time looking through it.
For further information, the following links may be of interest.
Framework Design Guidelines here
Python Recommendations here
Opmerkingen (0 opmerkingen)