August 23, 2009

Function vs Class

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

Parametric Processing

Those graphic reminds me of IKEA pillowcase...

Going through a processing tutorial book, "Processing -A Programming Handbook for Visual Designers and Artists."

Those veins are constructed only using "function." I'll try the similar graphic using "class" to see the difference next time.