The Hifi JS API has more than one strategy for exposing parameters and properties. I’m wondering if anyone has an opinion as to which make the mose sense.
(1) Some features can accessed by setters/getters with a format like:
Foo.setBar(value) and Foo.getBar()
var oldVelocity = MyAvatar.getVelocity(); MyAvatar.setVelocity(newVelocity);
(2) Other features are accessed via a “property” which can be used to both get and set:
var oldPosition = MyAvatar.position; MyAvatar.position = newPosition;
(3) There is a third pattern that looks like:
var properties = Particles.getProperties() Particles.addParticle(properties)
So what system do you prefer?
Personally I kinda like method (3) “set/getProperties()” system because we can add new properties without adding new function calls. It also allows for object API introspection. However system (1) and/or (2) can make for a bit more readable code since the code will tend to read more like english sentences.