Zend Framework

camelCase example is MixedCase instead of camelCase

Details

  • Type: Docs:  Problem Docs: Problem
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.5.1
  • Fix Version/s: 1.5.2
  • Component/s: Zend_Controller
  • Labels:
    None
  • Language:
    English

Description

In the note titled CamelCasedNamingConventions at
http://framework.zend.com/manual/en/zend.controller.basics.html
the discussion is talking about camelCased controller and action names,
but the controller name is MixedCased instead of camelCased.

So, change:
FooBarController::bazBatAction()
to
fooBarController::bazBatAction()

Although it's a minor change, it is the topic of the note...

Activity

Hide
James Dempster added a comment -

I don't see this problem on the page supplied. Maybe it's been fixed already?

Show
James Dempster added a comment - I don't see this problem on the page supplied. Maybe it's been fixed already?
Hide
Dennis Fogg added a comment -

nope, the problem is still there. the line is:

FooBarController::bazBatAction(), you'd refer to it on the url as /foo-

and it should be:

fooBarController::bazBatAction(), you'd refer to it on the url as /foo-

note the lower case for the first character of the sentence (camelCase for controller name).

Show
Dennis Fogg added a comment - nope, the problem is still there. the line is: FooBarController::bazBatAction(), you'd refer to it on the url as /foo- and it should be: fooBarController::bazBatAction(), you'd refer to it on the url as /foo- note the lower case for the first character of the sentence (camelCase for controller name).
Hide
James Dempster added a comment -

Ah I see what you mean.

Although from my testing I've found that you need the filename to be FooBarController.php and the class name can be either.

Show
James Dempster added a comment - Ah I see what you mean. Although from my testing I've found that you need the filename to be FooBarController.php and the class name can be either.
Hide
Wil Sinclair added a comment -

Please evaluate and categorize as necessary.

Show
Wil Sinclair added a comment - Please evaluate and categorize as necessary.
Hide
Dennis Fogg added a comment -

James,

I appreciate your thoroughness in testing the documentation change!
It's an interesting point that you raise.

In addition, there are coding standards to consider.
The naming convention for classes is at:
http://framework.zend.com/manual/en/coding-standard.naming-conventions.html#coding-standard.naming-conventions.classes
but it does not mention camelCase vs MixedCase.
This coding standard is for zend framework code, but since zend framework code will likely use controllers and actions, this coding standard will likey apply to controller naming also.

Show
Dennis Fogg added a comment - James, I appreciate your thoroughness in testing the documentation change! It's an interesting point that you raise. In addition, there are coding standards to consider. The naming convention for classes is at: http://framework.zend.com/manual/en/coding-standard.naming-conventions.html#coding-standard.naming-conventions.classes but it does not mention camelCase vs MixedCase. This coding standard is for zend framework code, but since zend framework code will likely use controllers and actions, this coding standard will likey apply to controller naming also.
Hide
Dennis Fogg added a comment -

After reading the coding standard for a 2nd time ( http://framework.zend.com/manual/en/coding-standard.naming-conventions.html#coding-standard.naming-conventions.classes ), I noticed the paragraph:

If a class name is comprised of more than one word, the first letter of each new word must be capitalized. Successive capitalized letters are not allowed, e.g. a class "Zend_PDF" is not allowed while "Zend_Pdf" is acceptable.

and since all ZF code is under the Zend directory, then all subsequent words will be capitalized which implies MixedCase class names.

Also, filenames seem to follow the class names from http://framework.zend.com/manual/en/coding-standard.naming-conventions.html#coding-standard.naming-conventions.filenames :

File names must follow the mapping to class names described above.

Show
Dennis Fogg added a comment - After reading the coding standard for a 2nd time ( http://framework.zend.com/manual/en/coding-standard.naming-conventions.html#coding-standard.naming-conventions.classes ), I noticed the paragraph: If a class name is comprised of more than one word, the first letter of each new word must be capitalized. Successive capitalized letters are not allowed, e.g. a class "Zend_PDF" is not allowed while "Zend_Pdf" is acceptable. and since all ZF code is under the Zend directory, then all subsequent words will be capitalized which implies MixedCase class names. Also, filenames seem to follow the class names from http://framework.zend.com/manual/en/coding-standard.naming-conventions.html#coding-standard.naming-conventions.filenames : File names must follow the mapping to class names described above.
Hide
James Dempster added a comment -

Does this mean the issue can now be closed?

Thanks,

Show
James Dempster added a comment - Does this mean the issue can now be closed? Thanks,
Hide
Dennis Fogg added a comment -

This issue is still unresolved and should remain open, in my opinion.

The issue is: should the controller class (and filename) be camelCase or MixedCase?
And the answer to this should be in the docs (probably in that note titled CamelCasedNamingConventions )
In the note, the controller name should be made consistent in both the description and the example given.

Show
Dennis Fogg added a comment - This issue is still unresolved and should remain open, in my opinion. The issue is: should the controller class (and filename) be camelCase or MixedCase? And the answer to this should be in the docs (probably in that note titled CamelCasedNamingConventions ) In the note, the controller name should be made consistent in both the description and the example given.
Hide
Dennis Fogg added a comment -

Any progress on this issue?
The issue is really about recommending the naming convention for controller classes and files and putting that recommendation in the docs (or correcting the docs so they reflect that naming convention).

This post is the current recommendation:
http://www.nabble.com/Re%3A-Naming-Recommendation-for-Controllers%2C-Actions%2C-and-URLs-using-zend_controller-p16366206.html
Is that still the recommendation?
Are both camelCase and MixedCase ok and supported in the future?
Better to figure this out and tell ZF users than to force each user to spend time figuring out for themselves.

Show
Dennis Fogg added a comment - Any progress on this issue? The issue is really about recommending the naming convention for controller classes and files and putting that recommendation in the docs (or correcting the docs so they reflect that naming convention). This post is the current recommendation: http://www.nabble.com/Re%3A-Naming-Recommendation-for-Controllers%2C-Actions%2C-and-URLs-using-zend_controller-p16366206.html Is that still the recommendation? Are both camelCase and MixedCase ok and supported in the future? Better to figure this out and tell ZF users than to force each user to spend time figuring out for themselves.
Hide
Matthew Weier O'Phinney added a comment -

Dennis – this is not a major issue. Most developers figure it out from the examples, and don't know the difference between MixedCase and camelCase and assume they are the same thing. At best, this is a minor documentation issue.

Additionally, we publish documentation only with new releases, so even if I get it into svn this minute, it will not be on the site for several weeks. Please have patience.

Show
Matthew Weier O'Phinney added a comment - Dennis – this is not a major issue. Most developers figure it out from the examples, and don't know the difference between MixedCase and camelCase and assume they are the same thing. At best, this is a minor documentation issue. Additionally, we publish documentation only with new releases, so even if I get it into svn this minute, it will not be on the site for several weeks. Please have patience.
Hide
Matthew Weier O'Phinney added a comment -

Scheduling for next mini release.

Show
Matthew Weier O'Phinney added a comment - Scheduling for next mini release.
Hide
Matthew Weier O'Phinney added a comment -

Resolved in trunk

Show
Matthew Weier O'Phinney added a comment - Resolved in trunk
Hide
Wil Sinclair added a comment -

Changing to comply with new IT coventions for components.

Show
Wil Sinclair added a comment - Changing to comply with new IT coventions for components.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
15m
Original Estimate - 15 minutes
Remaining:
15m
Remaining Estimate - 15 minutes
Logged:
Not Specified
Time Spent - Not Specified