-
Notifications
You must be signed in to change notification settings - Fork 11
Class naming convention #814
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
Comments
👎 for suffixes, the general feedback from previous questions like this has been to keep prefixes. At least for game objects (anything that goes into a registry), prefixes should remain. The only case where the prefix is not useful for matching two alike-prefixed things together is a block and it's pair itemblock. The |
Suffixese.g. PROs
CONs
Prefixese.g. PROs
CONs
Personally I prefer prefixes, but I feel it is necessary to lay out an objective list of pros and cons. If you have any I missed here, feel free to comment and I will add them. But reasons like "it's better" and other subjective things do not belong here. |
@kashike |
I've mentioned this in previous discussions and will reiterate here: neither prefixes nor suffixes are objectively better for IDE discovery. It's entirely up to what "property" of the class you're interested in for you search. A prefix search like 'Block*' is probably better if you're not entirely certain what class a block is associated with, since you see a neatly aligned list where you can focus on the suffix. Suffixes, on the other hand, arguably are better when you're looking for anything that is e.g. related to chests. Typing in 'Chest' would immediately yield the associated block, tile entity, GUI and container class, with the important part similarly aligned. In summary, one might say that prefixes are favourable for "type"-related searches while suffixes benefit "object"-related searches. Hence, what you listed as pro for prefixes above is ultimately subjective and I'd request it to be either removed or changed such that it reflects the concrete search benefit. Then you should also add the pro I outlined above to suffixes, though. |
@PaleoCrafter I updated the list to better reflect the objective benefits. |
if we change prefixes to suffixes will ItemBlock be renamed BlockItem |
I'm indifferent about the prefix suffix thing but I definitely think the interface and enum prefix should not be dropped. the prefix allows you to immediately see what kind of class something is and it's very self explanatory. The Enum prefix could be changed to E if anyone is bothered by the length. |
Big 👍 from me to change to suffixes. It feels more natural from a programming point of view -- most professional settings use suffixes for this kind of thing. Also,
I don't fully agree with that, it's exactly as easy to enter "block flower" as "flower block" in the symbol search, at least on IDEs capable of substring searches. Eg, typing "Flower" in Intellij on a 1.12 project I happen to have open right now: The fact the block class starts with Block is irrelevant there -- you get the same overview. |
@gigaherz, it is of course correct that IDEs will search for substrings, but the argument goes beyond the act of finding anything at all. IDEs still prefer prefix matches over substrings in their search results and you don't want to walk through a long list to get to the actually desired result. Plus, I'd argue that if the top search results share a common prefix, it's a lot easier to parse the important information quickly. So it's not so much about the search function itself, but the representation of results that differs and favours prefixes (be they "type" or "object"). |
I would also say keep the |
I'll be glad to see |
The only value in keeping Prefixes are when you are looking for a Block but aren't sure what it is but would know it when you see it. Which is of little value in my opinion. Besides any modern IDE does exactly what @gigaherz showed above so Prefix is even more useless. Now I/Enum prefixing ha some logic behind it. Unless you look at the object's definition you may not know exactly what it is at face value. Even so, it only takes a moment to see it and then that Prefix looses all value. So I would still axe those as well. That way we can finally start making MCP consistent (at least the class names). |
Personally speaking:
In short, I don't need the name to explicitly tell me that it's an interface, otherwise we should be renaming literally everything to be abstract or interfaced or enumed etc. For example, we would/should rename
As for preferring With regards to fixing the classes that are now more generic, they should be just a |
Personally I prefer prefixes for registry items, I can understand getting rid of the Either way it looks like a majority of people would prefer to use suffix naming anyway, so my opinion isn't really going to change anything. I'll just continue using the naming I prefer in my own projects and get used to suffix naming in Minecraft itself. |
Just a note. I am going to leave this up to the community, I've instructed @kashike to create a new issue, with each of these choices as a separate comment on that issue. So people can vote using the 👍 and 👎 reactions. As having it all in one comment is a "all or nothing" vote, which is not good. This way we have a documented source for why things were chosen. As for my 2 cents. 'IInterface': This, I take full blame for, it's a personal coding preference, blame the project I was working on directly before the first pass of class names being a C# one where this is a common pattern. I am perfectly fine with removing them.
Are there any other things that need to be brought up? The plan is to have the deadline for votes/new class names be Monday. So I can finish the 1.14 update. Note: Anyone who wants to help with new class names for 1.14, #mcpconfig on the Forge discord. |
Uh oh!
There was an error while loading. Please reload this page.
We're planning to do the following changes to make things consistent, and 1.14 is a good time to do it with the large changes.
I
prefix for interfacesEnum
prefix for enumerationsFooBlock
,FooItem
, etcBlock
prefix is actually a block (applies elsewhere too):BlockMatcher
is actually a predicateBlockPattern
is actually a pattern that can be matched in the worldBlockState
is actually a state of a blockFooBlock
,FooItem
are both grouped together, rather thanBlockFoo
[... many others ...]ItemFoo
Biome
andFeature
classes for an exampleDeadline for feedback is Monday (29/04/2019).
The text was updated successfully, but these errors were encountered: