Gamma and OOP principles like encapsulation?

Hi!
I have attended the webinar yesterday by @joreg (thanks again!) on OOP and gamma.

While some parts are now much clearer to me (like creating an object in gamma), I am still struggling to combine the things I read in tutorials on c#/oop with the examples in gamma. As I wasn’t able to formulate this question yesterday - it took some time, sorry! - I take the second best option and ask it here now :-)

In basically every tutorial on oop I stumble upon 4 principles of oop:

My question is: Are these principles used in gamma?
And in addition: Can they be used? Is it helpful to create patches in gamma using these principles? Is it a good idea to use these principles? Or are these principles mainly useful in textual programming languages?

For instance “Encapsulation”: Is this principle used in gamma, for example when building a particle system, like in the “Spray”-Example in the gamma help browser?

Is there maybe an example patch, where the idea of oop/encapsulation can be illustrated? In a lot of tutorials they use the image of cars as objects, being able to do different things like “start”, “stop” and “move” (for example in this video: https://www.youtube.com/watch?v=pTB0EiLXUC8 at 1:20min). Can a particle in a particle system be thought of as such an object? What would be the equivalent of “start”, “stop”, “move”?

Thanks in advance, any help is largely appreciated!

In object-oriented programming (OOP), encapsulation refers to the bundling of data with the methods that operate on that data, or the restricting of direct access to some of an object’s components.[1] Encapsulation is used to hide the values or state of a structured data object inside a class, preventing unauthorized parties’ direct access to them. Publicly accessible methods are generally provided in the class (so-called “getters” and “setters”) to access the values, and other client classes call these methods to retrieve and modify the values within the object.

That’s exactly what was shown in the webinar, the pads of a patch represent the data/values of the data type and the operations are the methods that operate on that data.

And on all other questions yes, VL has all of that, except inheritance. and it makes total sense to use, or at least learn from those patterns in OOP.

here are some good examples on polymorphism and abstraction:

1 Like

great, thank you! and thanks for the github-link - this looks very cool!

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