-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Rename properties for Color() #2092
Comments
I agree that h, s and v are not that obvious, but when I read |
I can guess what it stands for, but you should never have to guess. With experience a user can learn, but they shouldn't have to learn this sort of thing. All its doing is further increasing the cognitive load on the dev for the sake of typing a tiny number of extra characters. |
And even then, these are components of the common color format which is referred to as HSV in most of the literature. So I think if you are going to bother using HSV, you would know what That said, I don't see why we can't introduce aliases for all of them for a bit more explicitness? |
I'd suggest deprecating the single characters and only keeping the full words. It's much better practice. If Godot is fine with single characters for this, why not for other "obvious" things too? Before you know it you have an abstruse collection of properties and methods (so just like the linux command line...). If Godot is to be the "Easy to use" is sells itself as, it shouldn't go down that route. (This applies to any other classes/methods that have such single-character properties that are not either |
The GLSL/Godot shader language types use |
In most code, having a property be a single letter is a bad idea and is best avoided because it's not very verbose or discoverable. However, the core data structures are frequently used enough that the above does not apply. It is a reasonable expectation that users should know what the members of a (Aside from that, there is a very huge argument for not changing it because of existing/standardized/historical usage, but I think the argument for keeping these as
To quote reduz on the topic of having two APIs for the same thing: |
And he is correct in the ideal world, but we already have aliases for some methods at least, and I am not sure that all of them are getting removed for 4.x API clean up. Also, in shaders everything is a A better argument against aliases would be potential conflicts with color names (in case of RGB). HSV is not vulnerable to that though. |
Agreed, because it's ubiquitous across most of society. Which is why I'm only talking about
What you're proposing is making things more difficult than they need to be... why? Lets look at it this way: Benefits of current method:
Detriments:
(Missing any from either list?) Godot sells it self as "easy to use". Putting up what are effectively arbitrary barriers is the opposite of that. And yes, you can say "but it's only a few characters", and you're right, but I've begun to notice that Godot has lots of these little barriers and they add up. |
Being easy (or rather easier) to use doesn't mean that it comes without any cognitive load. There are things that people need to learn which won't come naturally. This is not a game constructor type of engine, it doesn't abstract all of the technical stuff for the sake of making a kid friendly UX. You still have to learn about its domain and peculiarities of gamedev. Because that's the only way to reach proficiency and not sacrifice flexibility. Godot doesn't claim to be anything else. |
The proposed change conflicts with the constants. Of course, we can rename the constants to I think because there are relatively few such properties in the API ( |
@dalexeev The constants will almost certainly be renamed in 4.0. Either to |
Closing due to lack of support (see reactions on OP). For future reference, color constants were renamed to uppercase in godotengine/godot#45144 for Godot 4.0. |
Describe the problem or limitation you are having in your project
The Color() method has a bunch of properties which are all one single character:
https://docs.godotengine.org/en/latest/classes/class_color.html
This is terrible. You shouldn't do this in personal code; you absolutely shouldn't do it in a public API except where there's unanimous understanding (i.e.: x, y for Vectors).
Worse it's not even being consistent in its use of them. "b" means blue as a property; I'm guessing it doesn't mean that in
linear_interpolate(b,t)
?A user should be able to glance at their code and instantly know what it does, not wonder what
Color.v
represents.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Properties with descriptive names. This includes in the methods (
linear_interpolate(b,t)
; b and t == ?)Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
The text was updated successfully, but these errors were encountered: