Difference between Record, Class, and Patch

vl

#1

Hello, I have just start studying VL, and find difficulty in differentiate Record, Class, and Patch. I studied that Record is immutable, copied by cloning; and Class is mutable, copied by reference. (Right?) However, I don’t understand it thoroughly. Does that mean when I changed the value in an instance of a Class, the same property would be also changed in another instance? Is there any example I can follow? When should I use Record? When should I use Class?

How about (Datatype) Patch? According to the following glossary, it’s defined to be a “Process Node”. What is the difference between Class and Patch? Class seems to be doing the same thing in the girlpower examples.

Anyway, I am confused LOL.

Glossary link: https://vvvv.gitbooks.io/the-gray-book/content/en/GLOSSARY.html


#2

the idea would be that you start with a Patch and only switch to anything else if you need to.
You’ll see that in the node browser only one node shows up, a node that represents the whole patch. We call this a process node as it represents a living entity, one instance of your patch that lives as long as the surrounding patch so to say.

If you want to have a fine grained control over the lifetime of the instances of your data type - by calling create and storing instances in spreads - you need to switch to record or class. Record is the first one that shows up because we would like you to start with that one. It is suited best for use in a data flow world. When thinking about what data is flowing over your links, you can think of snapshots. Let’s say an output is connected to several consuming nodes: every downstream node will see the same data, the same snapshot, like an email that you sent to several consumers, unable to change afterwards.
When using a class you pretty much send a reference to the memory (ram) where your specific instance is stored. Now every consumer can act on that memory and change it. Some of the consuming nodes might see an already changed object. This is why we’d recommend to use classes only locally to improve performance.

Currently though you also need to switch to class if you want to get a patch show up in vvvv. We’ll fix that.


#3

pick the analogy you like best

  • ROM vs RAM
  • CD-ROM vs CD-RAM
  • Music record vs Cassette tape
  • classic Chat vs Google Wave

And then also. In this forum i like to edit my posts (bad style) to get rid of typos. So different consumers see different versions. You can see why this is a bad idea. In Riot chat i didn’t find a way to do the same… https://vvvv.org/blog/chat-vvvv-on-matrix.org


#4

Thank you very much! @gregsn

Thus, when Node A, which is a Class, sent variable v = 1 to both Node B and Node C, when Node B changed v = 2, Node C would recognized that v changed from 1 to 2. Am I correct? And it won’t happen when Node A were a Record.


#5

exactly


#6

Thank you :)


#7

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.