Hi,
Forgive my frequent noob questions.
Is a 'Protocol' (User manual p.88 and p.159) the same as the definition in Wikipedia or 'contract' as defined in this book ? So a class of node (parent type) will always accept and output a certain type or set of data?
I think I understand the importance of protocols so that nodes all work together as expected since each class of node has a minimum of expected intputs and outputs. But Vuo seems to focus protocols on image classes rather than the other 46 classes of nodes e.g File -> New Composition from Template -> Protocol [all image node related].
I guess I'm trying to figure out whether my understanding of a protocol is correct and whether it means the same thing in Vuo.
Comments
A protocol in Vuo is like a
A protocol in Vuo is like a protocol or interface in object-oriented programming (the Wikipedia article that you linked to). A protocol says that a composition must have published input and output ports with certain names and data types.
The 3 existing protocols in Vuo — Image Generator, Image Filter, Image Transition — all relate to images because they were created for the purpose of interfacing with other applications (VDMX, CoGe, Resolume) that use them in video processing.
Protocols in Vuo don't have to be related to images. Hypothetically, if an application developer wanted to use Vuo plugins for some other purpose, then they could define their own protocol. For example, they could make an audio processing application that accepts any Vuo composition with a published input port called
audio
of type Audio Samples and a published output port calledoutputAudio
of type Audio Samples. Any composition that inputs Audio Samples, processes them in some way, and outputs the result, would conform to the application's "audio filter" protocol.To reiterate the user manual, the idea of a protocol is basically about filling in a blank. Whenever you're working with a composition and swapping out one node for another that fits in the same place —
Bulge Image
instead ofTwirl Image
,Make Oval Layer
instead ofMake Rectangle Layer
,Calculate Sine
instead ofCalculate Cosine
— you're working with the general idea of protocols, even if not using them by name.The idea of a protocol in Vuo is less strict than what people often mean when they refer to a "contract" in computer science. A contract spells out certain assumptions (preconditions, postconditions, invariants) in a precise way that supports a formal analysis of program correctness. While extremely few programmers are writing formal contracts, many (I would hope most) try informally to document and check the most important assumptions. One example with Vuo protocols is that, if you try to export a movie from an Image Generator composition that doesn't actually output images, then the movie export will report an error.