NYCPHP Meetup

NYPHP.org

[nycphp-talk] Constants interfaces

Kenneth Dombrowski kenneth at ylayali.net
Wed Sep 3 09:41:12 EDT 2008


Hi Michael, 

I have to disagree. 

On 08-09-03 02:07 -0400, Michael B Allen wrote:
> 
> Consider the following:
> 
>   interface Math_Constants {
> 
>       const PI = 3.14159265;
 
No, that's not at all what an interface is for.  An interface is nothing
more than a contract which specifies what methods its implementors must
define, it is not a sneaky way to implement multiple inheritance 

> I think PI would qualify as part of an interface definition. The value
> of PI will never change.

If it will never change, there is no value in including it as part of an
interface definition 

Some libs with a lot of constants define a dedicated class for them,
others implement them in a parent class, both are valid strategies which
make sense in different situations

Kenneth 




More information about the talk mailing list