Re: Interface naming standards?
| From: | Olivier Guilyardi | Date: | Thu, 01 Jun 2006 17:16:36 +0000 |
| Subject: | Re: Interface naming standards? | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-42726@lists.php.net to get a copy of this message | ||
Hi
Matthew Weier O'Phinney wrote:
On 6/1/06, Joe Stump <jstump@enotes.com> wrote:1.) In the PHP manual they use iFoo (the "i" for interface)Bah! That means that the file sorts differently, making visual grouping ugly.
2.) Maybe Interface_Foo?Same thing.
In Structures_DataGrid, the base class of all DataSource drivers is : Structures_DataGrid_DataSource This is were all DataSource drivers reside : Structures/DataGrid/DataSource/ As Matthew say, the following makes sense : Structures_DataGrid_DataSource_Interface But it's also logical to put the interface at the same level as the base class: Structures_DataGrid_IDataSource or Structures_DataGrid_DataSourceInterface Hope it helps -- og3.) Name it whatever I please, which means there's no indication that it's an interface?No, use the word Interface in the class name...I, personally, prefer putting "Interface" or some other keyword into the name of the interface so it's clear in code (ie. if ($foo instance of DB_Interface)).I've been going with Foo_Interface, but usually it's even further down the tree: Foo/Adapter/Interface.php -> class Foo_Adapter_InterfaceFoo/Adapter/Bar.php -> class Foo_Adapter_Bar implements it