Postponed on #1809930: [META] Many core class names violate naming standards
Beta phase evaluation
Issue category | Task because most fixed issues tagged coding standards are marked as tasks |
---|---|
Issue priority | Not critical |
Unfrozen changes | Not Unfrozen |
Disruption | Changing classnames during beta phase would be very disruptive for core/contributed and custom modules/themes. |
Problem/Motivation
As per discussion in #1809930: [META] Many core class names violate naming standards, many class names in the UUID namespace violate Drupal's naming standards (see http://drupal.org/node/608152). Fixing these class names to be more self-explanitory will help code be self-documenting and ease the introduction of new contributors.
Proposed resolution
Below is a list of classes Drupal/Component/Uuid namespace, along with the proposed changes. The attached .txt file is CSV, and contains the same information.
- Com -> UUIDBackendCOM
- Pecl -> UUIDBackendPECL
- Php -> UUIDBackendPHP
- Uuid
- UuidInterface
User interface changes
None
API changes
(API changes/additions that would affect module, install profile, and theme developers, including examples of before/after code if appropriate)
Renaming classes in Core is likely to require large updates to existing patches and contributed modules. If we intend to enforce the naming standard, it should be done as soon as possible.
Comment | File | Size | Author |
---|---|---|---|
#5 | uuid_clasnames-1815988-5.patch | 35.45 KB | threewestwinds |
#4 | uuid_clasnames-1815988-4.patch | 35.4 KB | threewestwinds |
Comments
Comment #1
mitchell CreditAttribution: mitchell commented(tagging)
Comment #2
skwashd CreditAttribution: skwashd commentedI'd disagree with this. The whole idea of namespacing is that you don't need to have massive class names. I'm worried we are going to end up with something like this in Drupal http://javadoc.bugaco.com/com/sun/java/swing/plaf/nimbus/InternalFrameIn... (link credit: @msonnabaum)
My comment probably belongs on the naming convention issue, but I found while searching for UUID issues, so I've left it here.
Comment #3
threewestwinds CreditAttribution: threewestwinds commentedTo quote jhodgon from the Meta issue linked up top, "That standard has already been adopted, sorry." At this point, it's decided on, and this issue to to enforce the decision, not make it.
That's not to say the linked you attached isn't made of pure horror, and I'd hate to see that sort of thing appear in Drupal. :O
If you wanted to address it, then I'd suggest either opening a new issue to change the naming conventions or reopen #1507828: [policy, no patch] Revised standards for class naming within namespaces, where the current convention was discussed and decided upon.
Comment #4
threewestwinds CreditAttribution: threewestwinds commentedHere is a first stab at a patch. Let's see how badly I broke everything.
Comment #5
threewestwinds CreditAttribution: threewestwinds commentedOops, that patch file didn't include quite all of the changes it should have (missed a few Pecl -> UUIDBackendPECL changes). Let's hope this one is a bit better.
Comment #6
jhodgdonWe need to resolve #1627350: Patch for: Case of acronyms in class names (SomethingXSSClassName versus SomethingXssClassName) soon! (That has to do with case of acronyms in class names).
But that aside... When I look at the UUID classes, I see this.
The main class is currently called "Uuid", and it's documented as "Factory class for UUIDs". So, it might make more sense to call it UuidFactory? Just calling it "Uuid" doesn't really tell what it does.... Hmm. Well, as I read the documentation further, it's not actually a just a factory class in the normal sense of the term Factory
http://en.wikipedia.org/wiki/Factory_(software_concept)
So really... scratch that. I think the class name Uuid is good (plus or minus a capitalization change), and the documentation should be changed so it doesn't say it's a factory class. It isn't.
OK, moving on... The member variable $plugin on that class (which is of type UuidInterface), says "Holds the UUID implementation", and the documentation on the Uuid class also mentions "the UUID implementation" in other places. So I think maybe the interface class should be called UuidImplementationInterface, and the 3 specific implementations should have "Implementation" rather than "Backend" in their names? Otherwise, the documentation on the Uuid factory class should be changed to refer to "backends" instead of "implementations", but I think probably "implementation" is more accurate.
Comment #7
jhodgdonSee also #1924818: Things that are not really factories should not be documented as factories
Comment #8
threewestwinds CreditAttribution: threewestwinds commentedI was not aware of that issue on changing the naming standard - I'll hold off on having another go at this patch until we have our standard settled.
I disagree with Backend -> Implementation though - I don't think that implementation describes what's happening any better, and I'm against adding syllables unless there's a descriptive gain. Our classes are not Uuid implementations - they're pointers that know how to talk to the actual implementations. In this case, I'd say the documentation is what should be changed.
Comment #9
jhodgdonI'm OK with changing the documentation in that case. What I'd like to avoid is having the docs say one thing and the class names (which are really kind of documentation too) say something else. And I still think that the interface should have the word "backend" or "implementation" in it (same as the backend/implementation classes) -- otherwise it looks like it's an interface for the overall Uuid class, which is not correct.
Comment #10
manningpete CreditAttribution: manningpete commentedComment #21
quietone CreditAttribution: quietone as a volunteer commentedPostponed on parent.
Comment #22
quietone CreditAttribution: quietone as a volunteer commentedAdd tag
Comment #28
quietone CreditAttribution: quietone as a volunteer commentedThe naming convention change in March 2013.