This is a core package that provides an API to work with XOD projects.
Manipulate with entities only using API functions or you can get unhandled exceptions.
-
Clear naming
The function name clearly informs about the expected result.
And always should begins with the action verb and ends with the subject.
The action verb may be abbreviated (like assoc
).
For example, createLink
, rebasePatch
, getPinType
, assocNode
.
-
Getters and Setters for primitive properties
Should looks like getSomeoneSomething
or setSomeoneSomething
.
For example, getNodeLabel
and setNodeLabel
.
-
Getters for lists
Should begin with list
and ends with the word in the plural form.
For example, listNodes
.
-
Getters for entities
In spite of the relationship of entities among themselves as nested
within each other — we obtain them using only the name of the entity,
regardless of their parents.
For example, listPatches
, listNodes
.
-
Getters with filtering/grouping
This is a common rule for all getters.
If getter have any filtering or grouping rule it ends with this rule.
Begin rule with prepositions by
, with
and without
.
For example, getPatchByPath
, listPatchWithNodes
.
-
Check functions
If function checks something and returns boolean, it looks like a question.
For example, isValidIdentifier
, hasPins
.