rfc:class-naming
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:class-naming [2017/06/03 12:00] – created fleshgrinder | rfc:class-naming [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2017-06-03 | * Date: 2017-06-03 | ||
* Author: Richard Fussenegger, | * Author: Richard Fussenegger, | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | The PHP coding standard does not cover how class names should be written. This leads to friction within the userland community that is now largely following the [[http:// | + | The PHP coding standard does not cover how class names should be written. This leads to friction within the userland community that is now largely following the [[http:// |
===== Proposal ===== | ===== Proposal ===== | ||
- | Extend the coding standard to explicitly specify how abbreviations and acronyms are to be handled when writing user-level class names. The current rule is: | + | Extend the coding standard to explicitly specify how abbreviations and acronyms/ |
> Classes should be given descriptive names. Avoid using abbreviations where possible. Each word in the class name should start with a capital letter, without underscore delimiters (CamelCaps starting with a capital letter). The class name should be prefixed with the name of the ' | > Classes should be given descriptive names. Avoid using abbreviations where possible. Each word in the class name should start with a capital letter, without underscore delimiters (CamelCaps starting with a capital letter). The class name should be prefixed with the name of the ' | ||
Line 24: | Line 24: | ||
> — [[https:// | > — [[https:// | ||
- | While it is stated that abbreviations | + | While it is stated that abbreviations should be avoided, it is silent on what to do if they are used; especially in the case of acronyms/ |
- | - **PascalCase except Acronyms** — which is how the majority of user-level class names are written, and it matches the approach of many other programming languages. | + | - **PascalCase except Acronyms/ |
- **Always PascalCase** — which is basically what [[http:// | - **Always PascalCase** — which is basically what [[http:// | ||
- **Do Nothing** — which of course automatically means that any approach is allowed, and the community discussions around this topic will continue. | - **Do Nothing** — which of course automatically means that any approach is allowed, and the community discussions around this topic will continue. | ||
Line 36: | Line 36: | ||
> **IMPORTANT!** | > **IMPORTANT!** | ||
- | ==== PascalCase except Acronyms ==== | + | ==== PascalCase except Acronyms/ |
- | > Class names should be descriptive nouns in PascalCase and as short as possible. Each word in the class name should start with a capital letter, without underscore delimiters. The class name should be prefixed with the name of the " | + | > Class names should be descriptive nouns in PascalCase and as short as possible. Each word in the class name should start with a capital letter, without underscore delimiters. The class name should be prefixed with the name of the " |
> | > | ||
> Good: | > Good: | ||
Line 45: | Line 45: | ||
> ' | > ' | ||
> ' | > ' | ||
+ | > ' | ||
+ | > ' | ||
> ' | > ' | ||
> ' | > ' | ||
+ | > ' | ||
> | > | ||
> Bad: | > Bad: | ||
Line 54: | Line 57: | ||
> ' | > ' | ||
> ' | > ' | ||
+ | > ' | ||
> ' | > ' | ||
> ' | > ' | ||
+ | > ' | ||
> | > | ||
> — [[https:// | > — [[https:// | ||
==== Always PascalCase ==== | ==== Always PascalCase ==== | ||
- | > Class names should be descriptive nouns in PascalCase and as short as possible. Each word in the class name should start with a capital letter, without underscore delimiters. The class name should be prefixed with the name of the " | + | > Class names should be descriptive nouns in PascalCase and as short as possible. Each word in the class name should start with a capital letter, without underscore delimiters. The class name should be prefixed with the name of the " |
> | > | ||
> Good: | > Good: | ||
Line 68: | Line 73: | ||
> ' | > ' | ||
> ' | > ' | ||
+ | > ' | ||
> ' | > ' | ||
> ' | > ' | ||
+ | > ' | ||
> | > | ||
> Bad: | > Bad: | ||
Line 77: | Line 84: | ||
> ' | > ' | ||
> ' | > ' | ||
+ | > ' | ||
> ' | > ' | ||
> ' | > ' | ||
+ | > ' | ||
> | > | ||
> — [[https:// | > — [[https:// | ||
Line 89: | Line 98: | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
- | Simple 50%+1 majority vote with three options: | + | Simple 50%+1 majority vote: |
- | | + | <doodle title=" |
- | - **Always PascalCase** | + | * Yes |
- | - **Do Nothing** | + | * No |
+ | </ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | <doodle title=" | ||
+ | * PascalCase except Acronyms | ||
+ | | ||
+ | </ | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | |||
+ | ===== References ===== | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
rfc/class-naming.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1