Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider having pure getter/setter methods #39

Open
tonihele opened this issue Mar 24, 2024 · 2 comments
Open

Consider having pure getter/setter methods #39

tonihele opened this issue Mar 24, 2024 · 2 comments

Comments

@tonihele
Copy link

Consider having pure getter/setter methods. For example in PhysicsCharacter.java, getUpDirection and setUp (I assume these are a pair despite the difference in naming), the getter actually takes in a parameter. With pure getter/setter I mean a getter is parameterless and returns the type whereas a setter takes one parameter of the type returning void. I also assume that in this example case getUpDirection takes a parameter as an optimization and it could be just omitted with a parameterless overload. Another example in this said class is get/setGravity.

This request comes from the jMonkeyEngine SDK, so it probably doesn't have any relation to actual usage in simulations/games. The SDK allows the user to modify object values in visual editors. These editors are based on basic Java Bean (?) properties.

PhysicsCharacter

@stephengold
Copy link
Owner

Thanks for the suggestion.

@stephengold
Copy link
Owner

@tonihele: I've given this a lot of thought.

I want to support the SDK's scene explorer interfacing with Minie. Being unfamiliar with scene-explorer internals, I don't actually know how difficult it is for it to handle non-pure getters. I am assuming it's difficult, since if it were easy you wouldn't have opened this issue.

From the standpoint of maintaining Minie, adding redundant API would be a step in the wrong direction, not an optimization.

Minie has many vector parameters. I don't know the exact number ... a hundred, perhaps? Some of them already have both single- and double-precision getters. I can imagine how adding a few pure getters might eventually create an expectation that every Minie parameter should have pure getters, both for single and double precision. However, I doubt the SDK will ever need or use so many getters.

I assume the SDK is interested only in a fraction of the available vector parameters. You would know better than I which ones those are. To save needless guesswork, please enumerate them here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants