Re: On BC and interfaces
| From: | Leigh | Date: | Thu, 06 Sep 2012 15:01:02 +0000 |
| Subject: | Re: On BC and interfaces | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62869@lists.php.net to get a copy of this message | ||
> Basically we shouldn't break any interfaces that are user-facing but
> we are free to change things internally as much as we want as long as the
> external interface is honored.
So how do you actually go about adding a feature that requires an
interface change?
Take for example the SessionHandler class, that implements
SessionHandlerInterface.
Now lets say you want to add functionality to the class that allows a
user to override create_sid, and provide user-generated session ids.
It doesn't make sense to add it to the class and not the interface, so
what do you do?
* Add to SessionHandlerInterface and break BC?
* Create SessionHandlerInterfaceEx that extends the original, and have
the the class implement that?
* Create SessionHandlerInterfaceEx that contains only the new method,
and have the class implement both interfaces?
* Add to the class, but do not touch the interface?