I'll try and sum up what we discussed in #zftalk.2 today.

For instance; I am having some issues understanding some of the votes.
  My main concern is ultimately consistency in the naming of itself and
there seems like there might be an option missing as well.  From my
point of view having an AbstractClient and then a ClientInterface does

I'd like to first point out that, anecdotally speaking, when it comes to standards in both Java and PHP (talking mature-ish projects), AbstractFoo and FooInterface seem to be the more popular scheme. For example, PHPUnit, Assetic (uses Base instead of Abstract, but its a prefix), Doctrine and Symfony to name a few.

There is a difference in naming because these two things are not fundamentally the same. One is an incomplete class whereas the other is a contract. The thread in common is that they are "types".

But more importantly, I feel like since the API of PHP is English, English rules have applied, and feel more correct for a number of developers. In the case of AbstractFoo, for example, this relationship between an adjective and noun/subject, "Abstract" being the adjective and "Foo" being the noun/subject. The word "Abstract" is modifying the noun "Foo".

http://www.edufind.com/english/grammar/adjectives_form.php

In the case of FooInterface though, I think we have a case of a compound noun, where the primary subject is the Interface and it is modified by a type, in this case "Foo".

http://www.edufind.com/english/grammar/nouns4.cfm

It is for those reasons I think you see the votes tallying the way they are. But, I am only guessing here, I have no hard evidence as to why people vote the way they do, and why the status-quo in other languages is the way it is.. Or at least, I have not found a source to fall back on.

not make a ton of sense (other than they read better when sounding them
out).  Either they should all be prefixed or all be suffixed.  Having a
mix of the two just complicates things and does not add to a specific
linguistic pattern.

See the above for the English grammar patterns at play here.

I also believe an option is missing for traits to follow the AClient,
IClient and there should be a TClient.  Basically I feel like any
pattern should be followed as if it should be a suffix or a prefix and

There was not a lot of support in the IRC channel today for Hungarian notation, and as such no one suggested TFoo as a pattern for traits.

would just like to understand others point of view regarding the naming
convention.

A great thing about doing this is within file searching by pattern; you
could now do a "^(A|I|T)[A-Z]" for a regular expression or replacing the
A|I|T with Abstract|Interface|Trait.  Not doing this also feels a bit
like haystack needle or needle haystack.  :)

I think people fall back on what feels natural, even in cases where they don't fully understand the how's and why's of one preference over another. The links I've posted above I think might answer why in the English language, you'll see people favor the AbstractFoo and FooInterface patterns.

Hope that helps with the reasoning.

-ralph


--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to