In the beginning it was not clear for me what are the differences between "function" and "class" -given that both are sort of like a package that gives me a certain output depending on variables-.
Both look fairly similar to me as long as I'm working on a certain frame, but now I see that -as some professionals have told me- "class" can deal with more complex procedure. It is still hard to keep track with where I should assign variables.
In this case, world calls "class vein" multiple times in loop, and each "class vein" calls "class leaf" in loop. For example, color of leaves are defined in "class leaf" and number of leaves per vein is defined in "class vein."
Here is the source code comparison.
processing CLASS vs processing FUNCTION