BMeshUnity icon indicating copy to clipboard operation
BMeshUnity copied to clipboard

[Proposal]: Change public fields to properties

Open MechWarrior99 opened this issue 4 years ago • 1 comments

Summary

Change all public fields to either be properties or to private fields if applicable.

Motivation

There are numerus advantages to properties over fields, which include being able restrict setting the value of properties, more clearly communicate the intended usage of it, and being able to change how they function without introducing breaking changes. For BMesh specifically this would be especially useful to prevent manually setting the values of properties like Edge.loop. Public fields also do not follow the C# design guidelines

Drawbacks

This is a breaking change as it would also involve renaming all fields from using camelCasing to PascalCasing to follow C# design guidelines for property naming. It would be a breaking change for anyone that is setting a value of a field that is changed to a get only property. However they should not be doing that anyways so that would be desired I believe.

I would be happy to create a PR with required changes if it is desired after any further discussion.

MechWarrior99 avatar Jul 11 '21 14:07 MechWarrior99

Agreed, in its current state the API is not safe at all, it assumes that the user knows a bit what they're doing.

eliemichel avatar Jul 11 '21 17:07 eliemichel