Skip to content

INV Best practices

benjboyer edited this page Dec 27, 2020 · 5 revisions

Only one INV object per file

To avoid more complexity, you should always keep yourself to 1 INV object.

// Ok
inv {
   name 'my-inv'
}
// Not ok
inv {
    name 'my-inv'
}
inv {
    name 'my-second-inv'
}

Use 'need' and 'publish' suffix for delegated broadcast and require statements

To facilitate the recognition of a delegated statement, by convention,

  • for a broadcast delegate statement, add the 'publish' suffix to the enclosed closure/method;
  • for a require delegate statement, add the 'need' suffix to the enclosed closure/method.

The suffixes 'require' and 'broadcast' are not not recommended since it is harder for consumers to guess who will eventually owns the statements.

// Ok
inv {
    ...
    broadcast { Something } using {
        ready {[
            publishElse: {
                broadcast { Else }
            }           
        ]}   
    }
}
//Not ok
inv {
    ...
    broadcast { Something } using {
        ready {[
            getElse: {
                broadcast { Else }
            }           
        ]}   
    }
}
// Ok
inv {
    ...
    broadcast { Something } using {
        ready {[
            needElse: {
                require { Else }
            }           
        ]}   
    }
}
// Not ok
inv {
    ...
    broadcast { Something } using {
        ready {[
            requireElse: {
                require { Else }
            }           
        ]}   
    }
}