Re: Interface naming standards?

From: Date: Thu, 01 Jun 2006 16:54:20 +0000
Subject: Re: Interface naming standards?
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-42724@lists.php.net to get a copy of this message
Hi Joe, Joe Stump wrote: > All, > > I'm currently working on a package that I plan on having an interface > defined in. The CS docs are completely void on the subject of naming > interfaces and, before I go coding my interface, I'd like to hear a bit > from the list about the subject ... > > 1.) In the PHP manual they use iFoo (the "i" for interface) > > 2.) Maybe Interface_Foo? > > 3.) Name it whatever I please, which means there's no indication that > it's an interface? > > 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)). > > Thoughts? > > --Joe I guess it depends greatly on the scope. If it's mainly to be used for your package only, then I'd think it's up to you. Although I would favor something like "Foo/Bar/Interface.php" that could be used to describe an interface to object that can be Foo_Bar's. This way it would be easy to find the interface definition when you're doing "$obj instanceof Foo_Bar_Interface" If we place the interface declaration in "Foo/iBar.php", then the instanceof would become "$obj instanceof Foo_iBar" By habit with PEAR naming convention I would go with Foo_Bar_Instance even though longer. iFoo_Bar doesn't seem resonnable IMO. Foo_iBar could work... -Philippe

« previous php.pear.dev (#42724) next »