Skip to content

3.0 RFC: Function notation #4499

Description

@davidyell

TL;DR
Abandon the _protected() and __private() convention.

Proposal
Cake has been in development for a long time now and when it started it supported very old PHP versions. When PHP4 was around there were no visibility keywords, which is why a convention of prefixing methods was adopted.

I think that this old convention should be dropped in the next major version of the framework.

Reasoning
At CakeFest 2014 @jameswatts said in his community keynote that we should be working to help market the framework and push it within the community with colleagues, friends and peers. I feel that having a new major version of the framework still using a convention which was born in PHP4 will give nay-sayers good ammunition to keep on with their 'Cake still uses php4 conventions'.

The newer frameworks are being sold to developers on the software engineering patterns that they implement and how they solve problems. The next major version of the framework has done lots to address this angle of promoting the framework, so it seems odd to me that such an old convention should still exist in the new major version of the framework.

Pros

  • Keeps the framework modern.
  • Takes away ammunition from nay-sayers.
  • A major release to the framework creates a solid break from old conventions.
  • IDEs have moved on since back-in-the-day, so devs will see method visibility.
  • Less to type 😉

Cons

  • Will be lots of change for no functional benefit.
  • Will cause plugin developers to change any existing 3.x plugins in development.
  • Sniffs need updating.

Thoughts
I am interested to discuss this issue as I really feel that it is a simple change which will really push the framework on as perceived by potential users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions